3 * Copyright (C) 1992 Krishna Balasubramanian
5 * Removed all the remaining kerneld mess
6 * Catch the -EFAULT stuff properly
7 * Use GFP_KERNEL for messages as in 1.2
8 * Fixed up the unchecked user space derefs
9 * Copyright (C) 1998 Alan Cox & Andi Kleen
11 * /proc/sysvipc/msg support (c) 1999 Dragos Acostachioaie <dragos@iname.com>
13 * mostly rewritten, threaded and wake-one semantics added
14 * MSGMAX limit removed, sysctl's added
15 * (c) 1999 Manfred Spraul <manfred@colorfullife.com>
17 * support for audit of ipc object properties and permission changes
18 * Dustin Kirkland <dustin.kirkland@us.ibm.com>
22 * Pavel Emelianov <xemul@openvz.org>
25 #include <linux/capability.h>
26 #include <linux/msg.h>
27 #include <linux/spinlock.h>
28 #include <linux/init.h>
30 #include <linux/proc_fs.h>
31 #include <linux/list.h>
32 #include <linux/security.h>
33 #include <linux/sched.h>
34 #include <linux/syscalls.h>
35 #include <linux/audit.h>
36 #include <linux/seq_file.h>
37 #include <linux/rwsem.h>
38 #include <linux/nsproxy.h>
39 #include <linux/ipc_namespace.h>
41 #include <asm/current.h>
42 #include <linux/uaccess.h>
45 /* one msg_receiver structure for each sleeping receiver */
47 struct list_head r_list;
48 struct task_struct *r_tsk;
54 struct msg_msg *r_msg;
57 /* one msg_sender for each sleeping sender */
59 struct list_head list;
60 struct task_struct *tsk;
64 #define SEARCH_EQUAL 2
65 #define SEARCH_NOTEQUAL 3
66 #define SEARCH_LESSEQUAL 4
67 #define SEARCH_NUMBER 5
69 #define msg_ids(ns) ((ns)->ids[IPC_MSG_IDS])
71 static inline struct msg_queue *msq_obtain_object(struct ipc_namespace *ns, int id)
73 struct kern_ipc_perm *ipcp = ipc_obtain_object_idr(&msg_ids(ns), id);
76 return ERR_CAST(ipcp);
78 return container_of(ipcp, struct msg_queue, q_perm);
81 static inline struct msg_queue *msq_obtain_object_check(struct ipc_namespace *ns,
84 struct kern_ipc_perm *ipcp = ipc_obtain_object_check(&msg_ids(ns), id);
87 return ERR_CAST(ipcp);
89 return container_of(ipcp, struct msg_queue, q_perm);
92 static inline void msg_rmid(struct ipc_namespace *ns, struct msg_queue *s)
94 ipc_rmid(&msg_ids(ns), &s->q_perm);
97 static void msg_rcu_free(struct rcu_head *head)
99 struct ipc_rcu *p = container_of(head, struct ipc_rcu, rcu);
100 struct msg_queue *msq = ipc_rcu_to_struct(p);
102 security_msg_queue_free(msq);
107 * newque - Create a new msg queue
109 * @params: ptr to the structure that contains the key and msgflg
111 * Called with msg_ids.rwsem held (writer)
113 static int newque(struct ipc_namespace *ns, struct ipc_params *params)
115 struct msg_queue *msq;
117 key_t key = params->key;
118 int msgflg = params->flg;
120 msq = ipc_rcu_alloc(sizeof(*msq));
124 msq->q_perm.mode = msgflg & S_IRWXUGO;
125 msq->q_perm.key = key;
127 msq->q_perm.security = NULL;
128 retval = security_msg_queue_alloc(msq);
130 ipc_rcu_putref(msq, ipc_rcu_free);
134 msq->q_stime = msq->q_rtime = 0;
135 msq->q_ctime = get_seconds();
136 msq->q_cbytes = msq->q_qnum = 0;
137 msq->q_qbytes = ns->msg_ctlmnb;
138 msq->q_lspid = msq->q_lrpid = 0;
139 INIT_LIST_HEAD(&msq->q_messages);
140 INIT_LIST_HEAD(&msq->q_receivers);
141 INIT_LIST_HEAD(&msq->q_senders);
143 /* ipc_addid() locks msq upon success. */
144 id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni);
146 ipc_rcu_putref(msq, msg_rcu_free);
150 ipc_unlock_object(&msq->q_perm);
153 return msq->q_perm.id;
156 static inline void ss_add(struct msg_queue *msq, struct msg_sender *mss)
159 __set_current_state(TASK_INTERRUPTIBLE);
160 list_add_tail(&mss->list, &msq->q_senders);
163 static inline void ss_del(struct msg_sender *mss)
165 if (mss->list.next != NULL)
166 list_del(&mss->list);
169 static void ss_wakeup(struct list_head *h, int kill)
171 struct msg_sender *mss, *t;
173 list_for_each_entry_safe(mss, t, h, list) {
175 mss->list.next = NULL;
176 wake_up_process(mss->tsk);
180 static void expunge_all(struct msg_queue *msq, int res,
181 struct wake_q_head *wake_q)
183 struct msg_receiver *msr, *t;
185 list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
186 wake_q_add(wake_q, msr->r_tsk);
187 WRITE_ONCE(msr->r_msg, ERR_PTR(res));
192 * freeque() wakes up waiters on the sender and receiver waiting queue,
193 * removes the message queue from message queue ID IDR, and cleans up all the
194 * messages associated with this queue.
196 * msg_ids.rwsem (writer) and the spinlock for this message queue are held
197 * before freeque() is called. msg_ids.rwsem remains locked on exit.
199 static void freeque(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
201 struct msg_msg *msg, *t;
202 struct msg_queue *msq = container_of(ipcp, struct msg_queue, q_perm);
205 expunge_all(msq, -EIDRM, &wake_q);
206 ss_wakeup(&msq->q_senders, 1);
208 ipc_unlock_object(&msq->q_perm);
212 list_for_each_entry_safe(msg, t, &msq->q_messages, m_list) {
213 atomic_dec(&ns->msg_hdrs);
216 atomic_sub(msq->q_cbytes, &ns->msg_bytes);
217 ipc_rcu_putref(msq, msg_rcu_free);
221 * Called with msg_ids.rwsem and ipcp locked.
223 static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
225 struct msg_queue *msq = container_of(ipcp, struct msg_queue, q_perm);
227 return security_msg_queue_associate(msq, msgflg);
230 SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
232 struct ipc_namespace *ns;
233 static const struct ipc_ops msg_ops = {
235 .associate = msg_security,
237 struct ipc_params msg_params;
239 ns = current->nsproxy->ipc_ns;
241 msg_params.key = key;
242 msg_params.flg = msgflg;
244 return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params);
247 static inline unsigned long
248 copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version)
252 return copy_to_user(buf, in, sizeof(*in));
257 memset(&out, 0, sizeof(out));
259 ipc64_perm_to_ipc_perm(&in->msg_perm, &out.msg_perm);
261 out.msg_stime = in->msg_stime;
262 out.msg_rtime = in->msg_rtime;
263 out.msg_ctime = in->msg_ctime;
265 if (in->msg_cbytes > USHRT_MAX)
266 out.msg_cbytes = USHRT_MAX;
268 out.msg_cbytes = in->msg_cbytes;
269 out.msg_lcbytes = in->msg_cbytes;
271 if (in->msg_qnum > USHRT_MAX)
272 out.msg_qnum = USHRT_MAX;
274 out.msg_qnum = in->msg_qnum;
276 if (in->msg_qbytes > USHRT_MAX)
277 out.msg_qbytes = USHRT_MAX;
279 out.msg_qbytes = in->msg_qbytes;
280 out.msg_lqbytes = in->msg_qbytes;
282 out.msg_lspid = in->msg_lspid;
283 out.msg_lrpid = in->msg_lrpid;
285 return copy_to_user(buf, &out, sizeof(out));
292 static inline unsigned long
293 copy_msqid_from_user(struct msqid64_ds *out, void __user *buf, int version)
297 if (copy_from_user(out, buf, sizeof(*out)))
302 struct msqid_ds tbuf_old;
304 if (copy_from_user(&tbuf_old, buf, sizeof(tbuf_old)))
307 out->msg_perm.uid = tbuf_old.msg_perm.uid;
308 out->msg_perm.gid = tbuf_old.msg_perm.gid;
309 out->msg_perm.mode = tbuf_old.msg_perm.mode;
311 if (tbuf_old.msg_qbytes == 0)
312 out->msg_qbytes = tbuf_old.msg_lqbytes;
314 out->msg_qbytes = tbuf_old.msg_qbytes;
324 * This function handles some msgctl commands which require the rwsem
325 * to be held in write mode.
326 * NOTE: no locks must be held, the rwsem is taken inside this function.
328 static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd,
329 struct msqid_ds __user *buf, int version)
331 struct kern_ipc_perm *ipcp;
332 struct msqid64_ds uninitialized_var(msqid64);
333 struct msg_queue *msq;
337 if (cmd == IPC_SET) {
338 if (copy_msqid_from_user(&msqid64, buf, version))
342 down_write(&msg_ids(ns).rwsem);
345 ipcp = ipcctl_pre_down_nolock(ns, &msg_ids(ns), msqid, cmd,
346 &msqid64.msg_perm, msqid64.msg_qbytes);
352 msq = container_of(ipcp, struct msg_queue, q_perm);
354 err = security_msg_queue_msgctl(msq, cmd);
360 ipc_lock_object(&msq->q_perm);
361 /* freeque unlocks the ipc object and rcu */
365 if (msqid64.msg_qbytes > ns->msg_ctlmnb &&
366 !capable(CAP_SYS_RESOURCE)) {
371 ipc_lock_object(&msq->q_perm);
372 err = ipc_update_perm(&msqid64.msg_perm, ipcp);
376 msq->q_qbytes = msqid64.msg_qbytes;
378 msq->q_ctime = get_seconds();
379 /* sleeping receivers might be excluded by
380 * stricter permissions.
382 expunge_all(msq, -EAGAIN, &wake_q);
383 /* sleeping senders might be able to send
384 * due to a larger queue size.
386 ss_wakeup(&msq->q_senders, 0);
394 ipc_unlock_object(&msq->q_perm);
399 up_write(&msg_ids(ns).rwsem);
403 static int msgctl_nolock(struct ipc_namespace *ns, int msqid,
404 int cmd, int version, void __user *buf)
407 struct msg_queue *msq;
413 struct msginfo msginfo;
420 * We must not return kernel stack data.
421 * due to padding, it's not enough
422 * to set all member fields.
424 err = security_msg_queue_msgctl(NULL, cmd);
428 memset(&msginfo, 0, sizeof(msginfo));
429 msginfo.msgmni = ns->msg_ctlmni;
430 msginfo.msgmax = ns->msg_ctlmax;
431 msginfo.msgmnb = ns->msg_ctlmnb;
432 msginfo.msgssz = MSGSSZ;
433 msginfo.msgseg = MSGSEG;
434 down_read(&msg_ids(ns).rwsem);
435 if (cmd == MSG_INFO) {
436 msginfo.msgpool = msg_ids(ns).in_use;
437 msginfo.msgmap = atomic_read(&ns->msg_hdrs);
438 msginfo.msgtql = atomic_read(&ns->msg_bytes);
440 msginfo.msgmap = MSGMAP;
441 msginfo.msgpool = MSGPOOL;
442 msginfo.msgtql = MSGTQL;
444 max_id = ipc_get_maxid(&msg_ids(ns));
445 up_read(&msg_ids(ns).rwsem);
446 if (copy_to_user(buf, &msginfo, sizeof(struct msginfo)))
448 return (max_id < 0) ? 0 : max_id;
454 struct msqid64_ds tbuf;
460 memset(&tbuf, 0, sizeof(tbuf));
463 if (cmd == MSG_STAT) {
464 msq = msq_obtain_object(ns, msqid);
469 success_return = msq->q_perm.id;
471 msq = msq_obtain_object_check(ns, msqid);
480 if (ipcperms(ns, &msq->q_perm, S_IRUGO))
483 err = security_msg_queue_msgctl(msq, cmd);
487 kernel_to_ipc64_perm(&msq->q_perm, &tbuf.msg_perm);
488 tbuf.msg_stime = msq->q_stime;
489 tbuf.msg_rtime = msq->q_rtime;
490 tbuf.msg_ctime = msq->q_ctime;
491 tbuf.msg_cbytes = msq->q_cbytes;
492 tbuf.msg_qnum = msq->q_qnum;
493 tbuf.msg_qbytes = msq->q_qbytes;
494 tbuf.msg_lspid = msq->q_lspid;
495 tbuf.msg_lrpid = msq->q_lrpid;
498 if (copy_msqid_to_user(buf, &tbuf, version))
500 return success_return;
513 SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
516 struct ipc_namespace *ns;
518 if (msqid < 0 || cmd < 0)
521 version = ipc_parse_version(&cmd);
522 ns = current->nsproxy->ipc_ns;
527 case MSG_STAT: /* msqid is an index rather than a msg queue id */
529 return msgctl_nolock(ns, msqid, cmd, version, buf);
532 return msgctl_down(ns, msqid, cmd, buf, version);
538 static int testmsg(struct msg_msg *msg, long type, int mode)
544 case SEARCH_LESSEQUAL:
545 if (msg->m_type <= type)
549 if (msg->m_type == type)
552 case SEARCH_NOTEQUAL:
553 if (msg->m_type != type)
560 static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg,
561 struct wake_q_head *wake_q)
563 struct msg_receiver *msr, *t;
565 list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
566 if (testmsg(msg, msr->r_msgtype, msr->r_mode) &&
567 !security_msg_queue_msgrcv(msq, msg, msr->r_tsk,
568 msr->r_msgtype, msr->r_mode)) {
570 list_del(&msr->r_list);
571 if (msr->r_maxsize < msg->m_ts) {
572 wake_q_add(wake_q, msr->r_tsk);
573 WRITE_ONCE(msr->r_msg, ERR_PTR(-E2BIG));
575 msq->q_lrpid = task_pid_vnr(msr->r_tsk);
576 msq->q_rtime = get_seconds();
578 wake_q_add(wake_q, msr->r_tsk);
579 WRITE_ONCE(msr->r_msg, msg);
588 long do_msgsnd(int msqid, long mtype, void __user *mtext,
589 size_t msgsz, int msgflg)
591 struct msg_queue *msq;
594 struct ipc_namespace *ns;
597 ns = current->nsproxy->ipc_ns;
599 if (msgsz > ns->msg_ctlmax || (long) msgsz < 0 || msqid < 0)
604 msg = load_msg(mtext, msgsz);
612 msq = msq_obtain_object_check(ns, msqid);
618 ipc_lock_object(&msq->q_perm);
624 if (ipcperms(ns, &msq->q_perm, S_IWUGO))
627 /* raced with RMID? */
628 if (!ipc_valid_object(&msq->q_perm)) {
633 err = security_msg_queue_msgsnd(msq, msg, msgflg);
637 if (msgsz + msq->q_cbytes <= msq->q_qbytes &&
638 1 + msq->q_qnum <= msq->q_qbytes) {
642 /* queue full, wait: */
643 if (msgflg & IPC_NOWAIT) {
648 /* enqueue the sender and prepare to block */
651 if (!ipc_rcu_getref(msq)) {
656 ipc_unlock_object(&msq->q_perm);
661 ipc_lock_object(&msq->q_perm);
663 ipc_rcu_putref(msq, msg_rcu_free);
664 /* raced with RMID? */
665 if (!ipc_valid_object(&msq->q_perm)) {
671 if (signal_pending(current)) {
672 err = -ERESTARTNOHAND;
677 msq->q_lspid = task_tgid_vnr(current);
678 msq->q_stime = get_seconds();
680 if (!pipelined_send(msq, msg, &wake_q)) {
681 /* no one is waiting for this message, enqueue it */
682 list_add_tail(&msg->m_list, &msq->q_messages);
683 msq->q_cbytes += msgsz;
685 atomic_add(msgsz, &ns->msg_bytes);
686 atomic_inc(&ns->msg_hdrs);
693 ipc_unlock_object(&msq->q_perm);
702 SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
707 if (get_user(mtype, &msgp->mtype))
709 return do_msgsnd(msqid, mtype, msgp->mtext, msgsz, msgflg);
712 static inline int convert_mode(long *msgtyp, int msgflg)
714 if (msgflg & MSG_COPY)
715 return SEARCH_NUMBER;
717 * find message of correct type.
718 * msgtyp = 0 => get first.
719 * msgtyp > 0 => get first message of matching type.
720 * msgtyp < 0 => get message with least type must be < abs(msgtype).
726 return SEARCH_LESSEQUAL;
728 if (msgflg & MSG_EXCEPT)
729 return SEARCH_NOTEQUAL;
733 static long do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
735 struct msgbuf __user *msgp = dest;
738 if (put_user(msg->m_type, &msgp->mtype))
741 msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz;
742 if (store_msg(msgp->mtext, msg, msgsz))
747 #ifdef CONFIG_CHECKPOINT_RESTORE
749 * This function creates new kernel message structure, large enough to store
750 * bufsz message bytes.
752 static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz)
754 struct msg_msg *copy;
757 * Create dummy message to copy real message to.
759 copy = load_msg(buf, bufsz);
765 static inline void free_copy(struct msg_msg *copy)
771 static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz)
773 return ERR_PTR(-ENOSYS);
776 static inline void free_copy(struct msg_msg *copy)
781 static struct msg_msg *find_msg(struct msg_queue *msq, long *msgtyp, int mode)
783 struct msg_msg *msg, *found = NULL;
786 list_for_each_entry(msg, &msq->q_messages, m_list) {
787 if (testmsg(msg, *msgtyp, mode) &&
788 !security_msg_queue_msgrcv(msq, msg, current,
790 if (mode == SEARCH_LESSEQUAL && msg->m_type != 1) {
791 *msgtyp = msg->m_type - 1;
793 } else if (mode == SEARCH_NUMBER) {
794 if (*msgtyp == count)
802 return found ?: ERR_PTR(-EAGAIN);
805 long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgflg,
806 long (*msg_handler)(void __user *, struct msg_msg *, size_t))
809 struct msg_queue *msq;
810 struct ipc_namespace *ns;
811 struct msg_msg *msg, *copy = NULL;
813 ns = current->nsproxy->ipc_ns;
815 if (msqid < 0 || (long) bufsz < 0)
818 if (msgflg & MSG_COPY) {
819 if ((msgflg & MSG_EXCEPT) || !(msgflg & IPC_NOWAIT))
821 copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax));
823 return PTR_ERR(copy);
825 mode = convert_mode(&msgtyp, msgflg);
828 msq = msq_obtain_object_check(ns, msqid);
836 struct msg_receiver msr_d;
838 msg = ERR_PTR(-EACCES);
839 if (ipcperms(ns, &msq->q_perm, S_IRUGO))
842 ipc_lock_object(&msq->q_perm);
844 /* raced with RMID? */
845 if (!ipc_valid_object(&msq->q_perm)) {
846 msg = ERR_PTR(-EIDRM);
850 msg = find_msg(msq, &msgtyp, mode);
853 * Found a suitable message.
854 * Unlink it from the queue.
856 if ((bufsz < msg->m_ts) && !(msgflg & MSG_NOERROR)) {
857 msg = ERR_PTR(-E2BIG);
861 * If we are copying, then do not unlink message and do
862 * not update queue parameters.
864 if (msgflg & MSG_COPY) {
865 msg = copy_msg(msg, copy);
869 list_del(&msg->m_list);
871 msq->q_rtime = get_seconds();
872 msq->q_lrpid = task_tgid_vnr(current);
873 msq->q_cbytes -= msg->m_ts;
874 atomic_sub(msg->m_ts, &ns->msg_bytes);
875 atomic_dec(&ns->msg_hdrs);
876 ss_wakeup(&msq->q_senders, 0);
881 /* No message waiting. Wait for a message */
882 if (msgflg & IPC_NOWAIT) {
883 msg = ERR_PTR(-ENOMSG);
887 list_add_tail(&msr_d.r_list, &msq->q_receivers);
888 msr_d.r_tsk = current;
889 msr_d.r_msgtype = msgtyp;
891 if (msgflg & MSG_NOERROR)
892 msr_d.r_maxsize = INT_MAX;
894 msr_d.r_maxsize = bufsz;
895 msr_d.r_msg = ERR_PTR(-EAGAIN);
896 __set_current_state(TASK_INTERRUPTIBLE);
898 ipc_unlock_object(&msq->q_perm);
903 * Lockless receive, part 1:
904 * We don't hold a reference to the queue and getting a
905 * reference would defeat the idea of a lockless operation,
906 * thus the code relies on rcu to guarantee the existence of
908 * Prior to destruction, expunge_all(-EIRDM) changes r_msg.
909 * Thus if r_msg is -EAGAIN, then the queue not yet destroyed.
914 * Lockless receive, part 2:
915 * The work in pipelined_send() and expunge_all():
916 * - Set pointer to message
917 * - Queue the receiver task for later wakeup
918 * - Wake up the process after the lock is dropped.
920 * Should the process wake up before this wakeup (due to a
921 * signal) it will either see the message and continue ...
923 msg = READ_ONCE(msr_d.r_msg);
924 if (msg != ERR_PTR(-EAGAIN))
928 * ... or see -EAGAIN, acquire the lock to check the message
931 ipc_lock_object(&msq->q_perm);
934 if (msg != ERR_PTR(-EAGAIN))
937 list_del(&msr_d.r_list);
938 if (signal_pending(current)) {
939 msg = ERR_PTR(-ERESTARTNOHAND);
943 ipc_unlock_object(&msq->q_perm);
947 ipc_unlock_object(&msq->q_perm);
955 bufsz = msg_handler(buf, msg, bufsz);
961 SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
962 long, msgtyp, int, msgflg)
964 return do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg, do_msg_fill);
968 void msg_init_ns(struct ipc_namespace *ns)
970 ns->msg_ctlmax = MSGMAX;
971 ns->msg_ctlmnb = MSGMNB;
972 ns->msg_ctlmni = MSGMNI;
974 atomic_set(&ns->msg_bytes, 0);
975 atomic_set(&ns->msg_hdrs, 0);
976 ipc_init_ids(&ns->ids[IPC_MSG_IDS]);
980 void msg_exit_ns(struct ipc_namespace *ns)
982 free_ipcs(ns, &msg_ids(ns), freeque);
983 idr_destroy(&ns->ids[IPC_MSG_IDS].ipcs_idr);
987 #ifdef CONFIG_PROC_FS
988 static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
990 struct user_namespace *user_ns = seq_user_ns(s);
991 struct msg_queue *msq = it;
994 "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",
1002 from_kuid_munged(user_ns, msq->q_perm.uid),
1003 from_kgid_munged(user_ns, msq->q_perm.gid),
1004 from_kuid_munged(user_ns, msq->q_perm.cuid),
1005 from_kgid_munged(user_ns, msq->q_perm.cgid),
1014 void __init msg_init(void)
1016 msg_init_ns(&init_ipc_ns);
1018 ipc_init_proc_interface("sysvipc/msg",
1019 " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n",
1020 IPC_MSG_IDS, sysvipc_msg_proc_show);