1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux << 2 #ifndef _UAPI_LINUX_MSG_H 1 #ifndef _UAPI_LINUX_MSG_H 3 #define _UAPI_LINUX_MSG_H 2 #define _UAPI_LINUX_MSG_H 4 3 5 #include <linux/ipc.h> 4 #include <linux/ipc.h> 6 5 7 /* ipcs ctl commands */ 6 /* ipcs ctl commands */ 8 #define MSG_STAT 11 7 #define MSG_STAT 11 9 #define MSG_INFO 12 8 #define MSG_INFO 12 10 #define MSG_STAT_ANY 13 << 11 9 12 /* msgrcv options */ 10 /* msgrcv options */ 13 #define MSG_NOERROR 010000 /* no error if 11 #define MSG_NOERROR 010000 /* no error if message is too big */ 14 #define MSG_EXCEPT 020000 /* recv any ms 12 #define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/ 15 #define MSG_COPY 040000 /* copy (not r 13 #define MSG_COPY 040000 /* copy (not remove) all queue messages */ 16 14 17 /* Obsolete, used only for backwards compatibi 15 /* Obsolete, used only for backwards compatibility and libc5 compiles */ 18 struct msqid_ds { 16 struct msqid_ds { 19 struct ipc_perm msg_perm; 17 struct ipc_perm msg_perm; 20 struct msg *msg_first; /* fir 18 struct msg *msg_first; /* first message on queue,unused */ 21 struct msg *msg_last; /* las 19 struct msg *msg_last; /* last message in queue,unused */ 22 __kernel_old_time_t msg_stime; /* las !! 20 __kernel_time_t msg_stime; /* last msgsnd time */ 23 __kernel_old_time_t msg_rtime; /* las !! 21 __kernel_time_t msg_rtime; /* last msgrcv time */ 24 __kernel_old_time_t msg_ctime; /* las !! 22 __kernel_time_t msg_ctime; /* last change time */ 25 unsigned long msg_lcbytes; /* Reu 23 unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */ 26 unsigned long msg_lqbytes; /* dit 24 unsigned long msg_lqbytes; /* ditto */ 27 unsigned short msg_cbytes; /* cur 25 unsigned short msg_cbytes; /* current number of bytes on queue */ 28 unsigned short msg_qnum; /* num 26 unsigned short msg_qnum; /* number of messages in queue */ 29 unsigned short msg_qbytes; /* max 27 unsigned short msg_qbytes; /* max number of bytes on queue */ 30 __kernel_ipc_pid_t msg_lspid; /* pid 28 __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */ 31 __kernel_ipc_pid_t msg_lrpid; /* las 29 __kernel_ipc_pid_t msg_lrpid; /* last receive pid */ 32 }; 30 }; 33 31 34 /* Include the definition of msqid64_ds */ 32 /* Include the definition of msqid64_ds */ 35 #include <asm/msgbuf.h> 33 #include <asm/msgbuf.h> 36 34 37 /* message buffer for msgsnd and msgrcv calls 35 /* message buffer for msgsnd and msgrcv calls */ 38 struct msgbuf { 36 struct msgbuf { 39 __kernel_long_t mtype; /* typ !! 37 long mtype; /* type of message */ 40 char mtext[1]; /* mes !! 38 char mtext[1]; /* message text */ 41 }; 39 }; 42 40 43 /* buffer for msgctl calls IPC_INFO, MSG_INFO 41 /* buffer for msgctl calls IPC_INFO, MSG_INFO */ 44 struct msginfo { 42 struct msginfo { 45 int msgpool; 43 int msgpool; 46 int msgmap; 44 int msgmap; 47 int msgmax; 45 int msgmax; 48 int msgmnb; 46 int msgmnb; 49 int msgmni; 47 int msgmni; 50 int msgssz; 48 int msgssz; 51 int msgtql; 49 int msgtql; 52 unsigned short msgseg; 50 unsigned short msgseg; 53 }; 51 }; 54 52 55 /* 53 /* 56 * MSGMNI, MSGMAX and MSGMNB are default value !! 54 * Scaling factor to compute msgmni: 57 * modified by sysctl. !! 55 * the memory dedicated to msg queues (msgmni * msgmnb) should occupy 58 * !! 56 * at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c): 59 * MSGMNI is the upper limit for the number of !! 57 * up to 8MB : msgmni = 16 (MSGMNI) 60 * namespace. !! 58 * 4 GB : msgmni = 8K 61 * It has been chosen to be as large possible !! 59 * more than 16 GB : msgmni = 32K (IPCMNI) 62 * scenarios where userspace causes overflows << 63 * operations of the form retrieve current lim << 64 * << 65 * MSGMNB is the default size of a new message << 66 * decrease the size with msgctl(IPC_SET), roo << 67 * (actually: CAP_SYS_RESOURCE) can both incre << 68 * size. The optimal value is application depe << 69 * 16384 is used because it was always used (s << 70 * << 71 * MAXMAX is the maximum size of an individual << 72 * (per-namespace) limit that applies for all << 73 * It's set to 1/2 of MSGMNB, to ensure that a << 74 * the queue. This is also an arbitrary choice << 75 */ 60 */ >> 61 #define MSG_MEM_SCALE 32 76 62 77 #define MSGMNI 32000 /* <= IPCMNI */ /* !! 63 #define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */ 78 #define MSGMAX 8192 /* <= INT_MAX */ /* m 64 #define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ 79 #define MSGMNB 16384 /* <= INT_MAX */ /* d 65 #define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ 80 66 81 /* unused */ 67 /* unused */ 82 #define MSGPOOL (MSGMNI * MSGMNB / 1024) /* si 68 #define MSGPOOL (MSGMNI * MSGMNB / 1024) /* size in kbytes of message pool */ 83 #define MSGTQL MSGMNB /* number of 69 #define MSGTQL MSGMNB /* number of system message headers */ 84 #define MSGMAP MSGMNB /* number of 70 #define MSGMAP MSGMNB /* number of entries in message map */ 85 #define MSGSSZ 16 /* message s 71 #define MSGSSZ 16 /* message segment size */ 86 #define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) / 72 #define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */ 87 #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG 73 #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) 88 74 89 75 90 #endif /* _UAPI_LINUX_MSG_H */ 76 #endif /* _UAPI_LINUX_MSG_H */ 91 77
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.