-
Notifications
You must be signed in to change notification settings - Fork 0
/
disastrOS.h
48 lines (35 loc) · 1.34 KB
/
disastrOS.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "disastrOS_pcb.h"
#include "linked_list.h"
#ifdef _DISASTROS_DEBUG_
#include <stdio.h>
#define disastrOS_debug(...) printf(__VA_ARGS__)
#else //_DISASTROS_DEBUG_
#define disastrOS_debug(...) ;
#endif //_DISASTROS_DEBUG_
// initializes the structures and spawns a fake init process
void disastrOS_start(void (*f)(void*), void* args, char* logfile);
// generic syscall
int disastrOS_syscall(int syscall_num, ...);
// classical process control
int disastrOS_getpid(); // this should be a syscall, but we have no memory separation, so we return just the running pid
int disastrOS_fork();
void disastrOS_exit(int exit_value);
int disastrOS_wait(int pid, int* retval);
void disastrOS_preempt();
void disastrOS_spawn(void (*f)(void*), void* args );
void disastrOS_shutdown();
// timers
void disastrOS_sleep(int);
// respurces (files)
int disastrOS_openResource(int resource_id, int type, int mode);
int disastrOS_closeResource(int fd) ;
int disastrOS_destroyResource(int resource_id);
// mq
int disastrOS_openMessageQueue(int id, int mode);
int disastrOS_closeMessageQueue(int fd);
int disastrOS_MessageQueue_write(int id, char* write_buffer, int len);
int disastrOS_MessageQueue_read(int id, char* buf, int len);
int disastrOS_MessageQueue_destroy(int id);
// debug function, prints the state of the internal system
void disastrOS_printStatus();