1 #ifndef _LINUX_MSG_H
2 #define _LINUX_MSG_H
3 #include <linux/ipc.h>
4
5 /* msgrcv options */
6 #define MSG_NOERROR 010000 /* no error if message is too big */
7 #define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
8
9
10 /* one msg structure for each message */
11 struct msg {
12 struct msg *msg_next; /* next message on queue */
13 long msg_type;
14 char *msg_spot; /* message text address */
15 short msg_ts; /* message text size */
16 };
17
18 /* one msqid structure for each queue on the system */
19 struct msqid_ds {
20 struct ipc_perm msg_perm;
21 struct msg *msg_first; /* first message on queue */
22 struct msg *msg_last; /* last message in queue */
23 time_t msg_stime; /* last msgsnd time */
24 time_t msg_rtime; /* last msgrcv time */
25 time_t msg_ctime; /* last change time */
26 struct wait_queue *wwait;
27 struct wait_queue *rwait;
28 ushort msg_cbytes; /* current number of bytes on queue */
29 ushort msg_qnum; /* number of messages in queue */
30 ushort msg_qbytes; /* max number of bytes on queue */
31 ushort msg_lspid; /* pid of last msgsnd */
32 ushort msg_lrpid; /* last receive pid */
33 };
34
35
36 /* message buffer for msgsnd and msgrcv calls */
37 struct msgbuf {
38 long mtype; /* type of message */
39 char mtext[1]; /* message text */
40 };
41
42
43 struct msginfo {
44 int msgpool;
45 int msgmap;
46 int msgmax;
47 int msgmnb;
48 int msgmni;
49 int msgssz;
50 int msgtql;
51 ushort msgseg;
52 };
53
54 #define MSGMNI 128 /* <= 1K */ /* max # of msg queue identifiers */
55 #define MSGMAX 4056 /* <= 4056 */ /* max size of message (bytes) */
56 #define MSGMNB 16384 /* ? */ /* default max size of a message queue */
57
58 /* unused */
59 #define MSGPOOL (MSGMNI*MSGMNB/1024) /* size in kilobytes of message pool */
60 #define MSGTQL MSGMNB /* number of system message headers */
61 #define MSGMAP MSGMNB /* number of entries in message map */
62 #define MSGSSZ 16 /* message segment size */
63 #define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ) /* max no. of segments */
64 #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
65
66 #ifdef __KERNEL__
67
68 /* ipcs ctl commands */
69 #define MSG_STAT 11
70 #define MSG_INFO 12
71
72 #endif /* __KERNEL__ */
73
74 #endif /* _LINUX_MSG_H */