1 #ifndef _LINUX_MSG_H
2 #define _LINUX_MSG_H
3 #include <linux/ipc.h>
4
5
6 #define MSG_NOERROR 010000
7 #define MSG_EXCEPT 020000
8
9
10 struct msqid_ds {
11 struct ipc_perm msg_perm;
12 struct msg *msg_first;
13 struct msg *msg_last;
14 time_t msg_stime;
15 time_t msg_rtime;
16 time_t msg_ctime;
17 struct wait_queue *wwait;
18 struct wait_queue *rwait;
19 ushort msg_cbytes;
20 ushort msg_qnum;
21 ushort msg_qbytes;
22 ushort msg_lspid;
23 ushort msg_lrpid;
24 };
25
26
27 struct msgbuf {
28 long mtype;
29 char mtext[1];
30 };
31
32
33 struct msginfo {
34 int msgpool;
35 int msgmap;
36 int msgmax;
37 int msgmnb;
38 int msgmni;
39 int msgssz;
40 int msgtql;
41 ushort msgseg;
42 };
43
44 #define MSGMNI 128
45 #define MSGMAX 4056
46 #define MSGMNB 16384
47
48
49 #define MSGPOOL (MSGMNI*MSGMNB/1024)
50 #define MSGTQL MSGMNB
51 #define MSGMAP MSGMNB
52 #define MSGSSZ 16
53 #define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ)
54 #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
55
56 #ifdef __KERNEL__
57
58
59 struct msg {
60 struct msg *msg_next;
61 long msg_type;
62 char *msg_spot;
63 short msg_ts;
64 };
65
66
67 #define MSG_STAT 11
68 #define MSG_INFO 12
69
70 asmlinkage int sys_msgget (key_t key, int msgflg);
71 asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
72 asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp,
73 int msgflg);
74 asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf);
75
76 #endif
77
78 #endif