forked from rhit-csse332/userlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
csse332_lib.h
55 lines (45 loc) · 1.24 KB
/
csse332_lib.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
49
50
51
52
53
54
55
#ifndef __CSSE332_LIB_H
#define __CSSE332_LIB_H
#include <stdlib.h>
#define PROCFS_PATH "/proc/csse332/status"
/* Change these values if you are using different characters */
#define REGISTER_CHAR 'R'
#define WITHDRAW_CHAR 'W'
#define YIELD_CHAR 'Y'
/* register_process_pid - Register a process with the module
*
* @pid the pid of the process to register
*
* @return 0 on success, error number on failure
*/
int register_process_pid(pid_t pid);
/* withdraw_process_pid - Withdraw a process from the module
*
* @pid the pid of the process to withdraw
*
* @return 0 on success, error number on failure
*/
int withdraw_process_pid(pid_t pid);
/* yield_process_pid - voluntarily yield the CPU
*
* @pid the pid of the process yielding
*
* @return 0 on success, error number on failure
*/
int yield_process_pid(pid_t pid);
/* register_process - Register a process by extracting its pid
*
* @return 0 on success, error number on failure
*/
int register_process(void);
/* withdraw_process - Withdraw a process by extracting its pid
*
* @return 0 on success, error number on failure
*/
int withdraw_process(void);
/* yield - voluntarily yield the CPU
*
* @return 0 on success, error number on failure
*/
int yield(void);
#endif /* csse332_lib.h */