blob: d0bb3448157afd10649f000e1aeef47c501f0965 [file] [log] [blame]
Nicholas Flintham1e3d3112013-04-10 10:48:38 +01001#ifndef _LINUX_MSG_H
2#define _LINUX_MSG_H
3
4#include <linux/ipc.h>
5
6#define MSG_STAT 11
7#define MSG_INFO 12
8
9#define MSG_NOERROR 010000
10#define MSG_EXCEPT 020000
11
12struct msqid_ds {
13 struct ipc_perm msg_perm;
14 struct msg *msg_first;
15 struct msg *msg_last;
16 __kernel_time_t msg_stime;
17 __kernel_time_t msg_rtime;
18 __kernel_time_t msg_ctime;
19 unsigned long msg_lcbytes;
20 unsigned long msg_lqbytes;
21 unsigned short msg_cbytes;
22 unsigned short msg_qnum;
23 unsigned short msg_qbytes;
24 __kernel_ipc_pid_t msg_lspid;
25 __kernel_ipc_pid_t msg_lrpid;
26};
27
28#include <asm/msgbuf.h>
29
30struct msgbuf {
31 long mtype;
32 char mtext[1];
33};
34
35struct msginfo {
36 int msgpool;
37 int msgmap;
38 int msgmax;
39 int msgmnb;
40 int msgmni;
41 int msgssz;
42 int msgtql;
43 unsigned short msgseg;
44};
45
46#define MSG_MEM_SCALE 32
47
48#define MSGMNI 16
49#define MSGMAX 8192
50#define MSGMNB 16384
51
52#define MSGPOOL (MSGMNI * MSGMNB / 1024)
53#define MSGTQL MSGMNB
54#define MSGMAP MSGMNB
55#define MSGSSZ 16
56#define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ)
57#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
58
59#ifdef __KERNEL__
60#include <linux/list.h>
61
62struct msg_msg {
63 struct list_head m_list;
64 long m_type;
65 int m_ts;
66 struct msg_msgseg* next;
67 void *security;
68
69};
70
71struct msg_queue {
72 struct kern_ipc_perm q_perm;
73 time_t q_stime;
74 time_t q_rtime;
75 time_t q_ctime;
76 unsigned long q_cbytes;
77 unsigned long q_qnum;
78 unsigned long q_qbytes;
79 pid_t q_lspid;
80 pid_t q_lrpid;
81
82 struct list_head q_messages;
83 struct list_head q_receivers;
84 struct list_head q_senders;
85};
86
87extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
88 size_t msgsz, int msgflg);
89extern long do_msgrcv(int msqid, long *pmtype, void __user *mtext,
90 size_t msgsz, long msgtyp, int msgflg);
91
92#endif
93
94#endif