-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmessage_queue.h
More file actions
34 lines (28 loc) · 766 Bytes
/
Copy pathmessage_queue.h
File metadata and controls
34 lines (28 loc) · 766 Bytes
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
/*
** It defines the form of the
** message, the first member means
** the type of the message, the second
** member is the actual message struct.
** It also defines the message queue.
** The first two elements of the queue
** is the head and the tail of the queue.
*/
/*
** Premise headers:
** types.h
*/
#define MAX_PROCESS_NUM 1024
#define QUEUE_SIZE (4 * 1024 - 2 * sizeof(int)) / (sizeof(void*))
typedef struct message_queue
{
int head;
int tail;
void** queue[QUEUE_SIZE];
} MsgQueue;
MsgQueue** process_message_map;
int initProcessMsgMap();
int initProcessQueue(int pid);
int releaseProcessQueue(int pid);
void enqueue(int pid, void* message);
void dequeue(int pid, void* result);
void informHomeToOpenFile(char* process_name, char* file_name);