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/slab.h>
27 #include <linux/msg.h>
28 #include <linux/spinlock.h>
29 #include <linux/init.h>
31 #include <linux/proc_fs.h>
32 #include <linux/list.h>
33 #include <linux/security.h>
34 #include <linux/sched.h>
35 #include <linux/syscalls.h>
36 #include <linux/audit.h>
37 #include <linux/seq_file.h>
38 #include <linux/rwsem.h>
39 #include <linux/nsproxy.h>
40 #include <linux/ipc_namespace.h>
42 #include <asm/current.h>
43 #include <asm/uaccess.h>
47 * one msg_receiver structure for each sleeping receiver:
50 struct list_head r_list
;
51 struct task_struct
*r_tsk
;
57 struct msg_msg
*volatile r_msg
;
60 /* one msg_sender for each sleeping sender */
62 struct list_head list
;
63 struct task_struct
*tsk
;
67 #define SEARCH_EQUAL 2
68 #define SEARCH_NOTEQUAL 3
69 #define SEARCH_LESSEQUAL 4
71 #define msg_ids(ns) ((ns)->ids[IPC_MSG_IDS])
73 #define msg_unlock(msq) ipc_unlock(&(msq)->q_perm)
75 static void freeque(struct ipc_namespace
*, struct kern_ipc_perm
*);
76 static int newque(struct ipc_namespace
*, struct ipc_params
*);
78 static int sysvipc_msg_proc_show(struct seq_file
*s
, void *it
);
82 * Scale msgmni with the available lowmem size: the memory dedicated to msg
83 * queues should occupy at most 1/MSG_MEM_SCALE of lowmem.
84 * Also take into account the number of nsproxies created so far.
85 * This should be done staying within the (MSGMNI , IPCMNI/nr_ipc_ns) range.
87 void recompute_msgmni(struct ipc_namespace
*ns
)
90 unsigned long allowed
;
94 allowed
= (((i
.totalram
- i
.totalhigh
) / MSG_MEM_SCALE
) * i
.mem_unit
)
96 nb_ns
= atomic_read(&nr_ipc_ns
);
99 if (allowed
< MSGMNI
) {
100 ns
->msg_ctlmni
= MSGMNI
;
104 if (allowed
> IPCMNI
/ nb_ns
) {
105 ns
->msg_ctlmni
= IPCMNI
/ nb_ns
;
109 ns
->msg_ctlmni
= allowed
;
112 void msg_init_ns(struct ipc_namespace
*ns
)
114 ns
->msg_ctlmax
= MSGMAX
;
115 ns
->msg_ctlmnb
= MSGMNB
;
117 recompute_msgmni(ns
);
119 atomic_set(&ns
->msg_bytes
, 0);
120 atomic_set(&ns
->msg_hdrs
, 0);
121 ipc_init_ids(&ns
->ids
[IPC_MSG_IDS
]);
125 void msg_exit_ns(struct ipc_namespace
*ns
)
127 free_ipcs(ns
, &msg_ids(ns
), freeque
);
131 void __init
msg_init(void)
133 msg_init_ns(&init_ipc_ns
);
135 printk(KERN_INFO
"msgmni has been set to %d\n",
136 init_ipc_ns
.msg_ctlmni
);
138 ipc_init_proc_interface("sysvipc/msg",
139 " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n",
140 IPC_MSG_IDS
, sysvipc_msg_proc_show
);
144 * msg_lock_(check_) routines are called in the paths where the rw_mutex
147 static inline struct msg_queue
*msg_lock(struct ipc_namespace
*ns
, int id
)
149 struct kern_ipc_perm
*ipcp
= ipc_lock(&msg_ids(ns
), id
);
152 return (struct msg_queue
*)ipcp
;
154 return container_of(ipcp
, struct msg_queue
, q_perm
);
157 static inline struct msg_queue
*msg_lock_check(struct ipc_namespace
*ns
,
160 struct kern_ipc_perm
*ipcp
= ipc_lock_check(&msg_ids(ns
), id
);
163 return (struct msg_queue
*)ipcp
;
165 return container_of(ipcp
, struct msg_queue
, q_perm
);
168 static inline void msg_rmid(struct ipc_namespace
*ns
, struct msg_queue
*s
)
170 ipc_rmid(&msg_ids(ns
), &s
->q_perm
);
174 * newque - Create a new msg queue
176 * @params: ptr to the structure that contains the key and msgflg
178 * Called with msg_ids.rw_mutex held (writer)
180 static int newque(struct ipc_namespace
*ns
, struct ipc_params
*params
)
182 struct msg_queue
*msq
;
184 key_t key
= params
->key
;
185 int msgflg
= params
->flg
;
187 msq
= ipc_rcu_alloc(sizeof(*msq
));
191 msq
->q_perm
.mode
= msgflg
& S_IRWXUGO
;
192 msq
->q_perm
.key
= key
;
194 msq
->q_perm
.security
= NULL
;
195 retval
= security_msg_queue_alloc(msq
);
202 * ipc_addid() locks msq
204 id
= ipc_addid(&msg_ids(ns
), &msq
->q_perm
, ns
->msg_ctlmni
);
206 security_msg_queue_free(msq
);
211 msq
->q_stime
= msq
->q_rtime
= 0;
212 msq
->q_ctime
= get_seconds();
213 msq
->q_cbytes
= msq
->q_qnum
= 0;
214 msq
->q_qbytes
= ns
->msg_ctlmnb
;
215 msq
->q_lspid
= msq
->q_lrpid
= 0;
216 INIT_LIST_HEAD(&msq
->q_messages
);
217 INIT_LIST_HEAD(&msq
->q_receivers
);
218 INIT_LIST_HEAD(&msq
->q_senders
);
222 return msq
->q_perm
.id
;
225 static inline void ss_add(struct msg_queue
*msq
, struct msg_sender
*mss
)
228 current
->state
= TASK_INTERRUPTIBLE
;
229 list_add_tail(&mss
->list
, &msq
->q_senders
);
232 static inline void ss_del(struct msg_sender
*mss
)
234 if (mss
->list
.next
!= NULL
)
235 list_del(&mss
->list
);
238 static void ss_wakeup(struct list_head
*h
, int kill
)
240 struct list_head
*tmp
;
244 struct msg_sender
*mss
;
246 mss
= list_entry(tmp
, struct msg_sender
, list
);
249 mss
->list
.next
= NULL
;
250 wake_up_process(mss
->tsk
);
254 static void expunge_all(struct msg_queue
*msq
, int res
)
256 struct list_head
*tmp
;
258 tmp
= msq
->q_receivers
.next
;
259 while (tmp
!= &msq
->q_receivers
) {
260 struct msg_receiver
*msr
;
262 msr
= list_entry(tmp
, struct msg_receiver
, r_list
);
265 wake_up_process(msr
->r_tsk
);
267 msr
->r_msg
= ERR_PTR(res
);
272 * freeque() wakes up waiters on the sender and receiver waiting queue,
273 * removes the message queue from message queue ID IDR, and cleans up all the
274 * messages associated with this queue.
276 * msg_ids.rw_mutex (writer) and the spinlock for this message queue are held
277 * before freeque() is called. msg_ids.rw_mutex remains locked on exit.
279 static void freeque(struct ipc_namespace
*ns
, struct kern_ipc_perm
*ipcp
)
281 struct list_head
*tmp
;
282 struct msg_queue
*msq
= container_of(ipcp
, struct msg_queue
, q_perm
);
284 expunge_all(msq
, -EIDRM
);
285 ss_wakeup(&msq
->q_senders
, 1);
289 tmp
= msq
->q_messages
.next
;
290 while (tmp
!= &msq
->q_messages
) {
291 struct msg_msg
*msg
= list_entry(tmp
, struct msg_msg
, m_list
);
294 atomic_dec(&ns
->msg_hdrs
);
297 atomic_sub(msq
->q_cbytes
, &ns
->msg_bytes
);
298 security_msg_queue_free(msq
);
303 * Called with msg_ids.rw_mutex and ipcp locked.
305 static inline int msg_security(struct kern_ipc_perm
*ipcp
, int msgflg
)
307 struct msg_queue
*msq
= container_of(ipcp
, struct msg_queue
, q_perm
);
309 return security_msg_queue_associate(msq
, msgflg
);
312 SYSCALL_DEFINE2(msgget
, key_t
, key
, int, msgflg
)
314 struct ipc_namespace
*ns
;
315 struct ipc_ops msg_ops
;
316 struct ipc_params msg_params
;
318 ns
= current
->nsproxy
->ipc_ns
;
320 msg_ops
.getnew
= newque
;
321 msg_ops
.associate
= msg_security
;
322 msg_ops
.more_checks
= NULL
;
324 msg_params
.key
= key
;
325 msg_params
.flg
= msgflg
;
327 return ipcget(ns
, &msg_ids(ns
), &msg_ops
, &msg_params
);
330 static inline unsigned long
331 copy_msqid_to_user(void __user
*buf
, struct msqid64_ds
*in
, int version
)
335 return copy_to_user(buf
, in
, sizeof(*in
));
340 memset(&out
, 0, sizeof(out
));
342 ipc64_perm_to_ipc_perm(&in
->msg_perm
, &out
.msg_perm
);
344 out
.msg_stime
= in
->msg_stime
;
345 out
.msg_rtime
= in
->msg_rtime
;
346 out
.msg_ctime
= in
->msg_ctime
;
348 if (in
->msg_cbytes
> USHORT_MAX
)
349 out
.msg_cbytes
= USHORT_MAX
;
351 out
.msg_cbytes
= in
->msg_cbytes
;
352 out
.msg_lcbytes
= in
->msg_cbytes
;
354 if (in
->msg_qnum
> USHORT_MAX
)
355 out
.msg_qnum
= USHORT_MAX
;
357 out
.msg_qnum
= in
->msg_qnum
;
359 if (in
->msg_qbytes
> USHORT_MAX
)
360 out
.msg_qbytes
= USHORT_MAX
;
362 out
.msg_qbytes
= in
->msg_qbytes
;
363 out
.msg_lqbytes
= in
->msg_qbytes
;
365 out
.msg_lspid
= in
->msg_lspid
;
366 out
.msg_lrpid
= in
->msg_lrpid
;
368 return copy_to_user(buf
, &out
, sizeof(out
));
375 static inline unsigned long
376 copy_msqid_from_user(struct msqid64_ds
*out
, void __user
*buf
, int version
)
380 if (copy_from_user(out
, buf
, sizeof(*out
)))
385 struct msqid_ds tbuf_old
;
387 if (copy_from_user(&tbuf_old
, buf
, sizeof(tbuf_old
)))
390 out
->msg_perm
.uid
= tbuf_old
.msg_perm
.uid
;
391 out
->msg_perm
.gid
= tbuf_old
.msg_perm
.gid
;
392 out
->msg_perm
.mode
= tbuf_old
.msg_perm
.mode
;
394 if (tbuf_old
.msg_qbytes
== 0)
395 out
->msg_qbytes
= tbuf_old
.msg_lqbytes
;
397 out
->msg_qbytes
= tbuf_old
.msg_qbytes
;
407 * This function handles some msgctl commands which require the rw_mutex
408 * to be held in write mode.
409 * NOTE: no locks must be held, the rw_mutex is taken inside this function.
411 static int msgctl_down(struct ipc_namespace
*ns
, int msqid
, int cmd
,
412 struct msqid_ds __user
*buf
, int version
)
414 struct kern_ipc_perm
*ipcp
;
415 struct msqid64_ds msqid64
;
416 struct msg_queue
*msq
;
419 if (cmd
== IPC_SET
) {
420 if (copy_msqid_from_user(&msqid64
, buf
, version
))
424 ipcp
= ipcctl_pre_down(&msg_ids(ns
), msqid
, cmd
,
425 &msqid64
.msg_perm
, msqid64
.msg_qbytes
);
427 return PTR_ERR(ipcp
);
429 msq
= container_of(ipcp
, struct msg_queue
, q_perm
);
431 err
= security_msg_queue_msgctl(msq
, cmd
);
440 if (msqid64
.msg_qbytes
> ns
->msg_ctlmnb
&&
441 !capable(CAP_SYS_RESOURCE
)) {
446 msq
->q_qbytes
= msqid64
.msg_qbytes
;
448 ipc_update_perm(&msqid64
.msg_perm
, ipcp
);
449 msq
->q_ctime
= get_seconds();
450 /* sleeping receivers might be excluded by
451 * stricter permissions.
453 expunge_all(msq
, -EAGAIN
);
454 /* sleeping senders might be able to send
455 * due to a larger queue size.
457 ss_wakeup(&msq
->q_senders
, 0);
465 up_write(&msg_ids(ns
).rw_mutex
);
469 SYSCALL_DEFINE3(msgctl
, int, msqid
, int, cmd
, struct msqid_ds __user
*, buf
)
471 struct msg_queue
*msq
;
473 struct ipc_namespace
*ns
;
475 if (msqid
< 0 || cmd
< 0)
478 version
= ipc_parse_version(&cmd
);
479 ns
= current
->nsproxy
->ipc_ns
;
485 struct msginfo msginfo
;
491 * We must not return kernel stack data.
492 * due to padding, it's not enough
493 * to set all member fields.
495 err
= security_msg_queue_msgctl(NULL
, cmd
);
499 memset(&msginfo
, 0, sizeof(msginfo
));
500 msginfo
.msgmni
= ns
->msg_ctlmni
;
501 msginfo
.msgmax
= ns
->msg_ctlmax
;
502 msginfo
.msgmnb
= ns
->msg_ctlmnb
;
503 msginfo
.msgssz
= MSGSSZ
;
504 msginfo
.msgseg
= MSGSEG
;
505 down_read(&msg_ids(ns
).rw_mutex
);
506 if (cmd
== MSG_INFO
) {
507 msginfo
.msgpool
= msg_ids(ns
).in_use
;
508 msginfo
.msgmap
= atomic_read(&ns
->msg_hdrs
);
509 msginfo
.msgtql
= atomic_read(&ns
->msg_bytes
);
511 msginfo
.msgmap
= MSGMAP
;
512 msginfo
.msgpool
= MSGPOOL
;
513 msginfo
.msgtql
= MSGTQL
;
515 max_id
= ipc_get_maxid(&msg_ids(ns
));
516 up_read(&msg_ids(ns
).rw_mutex
);
517 if (copy_to_user(buf
, &msginfo
, sizeof(struct msginfo
)))
519 return (max_id
< 0) ? 0 : max_id
;
521 case MSG_STAT
: /* msqid is an index rather than a msg queue id */
524 struct msqid64_ds tbuf
;
530 if (cmd
== MSG_STAT
) {
531 msq
= msg_lock(ns
, msqid
);
534 success_return
= msq
->q_perm
.id
;
536 msq
= msg_lock_check(ns
, msqid
);
542 if (ipcperms(&msq
->q_perm
, S_IRUGO
))
545 err
= security_msg_queue_msgctl(msq
, cmd
);
549 memset(&tbuf
, 0, sizeof(tbuf
));
551 kernel_to_ipc64_perm(&msq
->q_perm
, &tbuf
.msg_perm
);
552 tbuf
.msg_stime
= msq
->q_stime
;
553 tbuf
.msg_rtime
= msq
->q_rtime
;
554 tbuf
.msg_ctime
= msq
->q_ctime
;
555 tbuf
.msg_cbytes
= msq
->q_cbytes
;
556 tbuf
.msg_qnum
= msq
->q_qnum
;
557 tbuf
.msg_qbytes
= msq
->q_qbytes
;
558 tbuf
.msg_lspid
= msq
->q_lspid
;
559 tbuf
.msg_lrpid
= msq
->q_lrpid
;
561 if (copy_msqid_to_user(buf
, &tbuf
, version
))
563 return success_return
;
567 err
= msgctl_down(ns
, msqid
, cmd
, buf
, version
);
578 static int testmsg(struct msg_msg
*msg
, long type
, int mode
)
584 case SEARCH_LESSEQUAL
:
585 if (msg
->m_type
<=type
)
589 if (msg
->m_type
== type
)
592 case SEARCH_NOTEQUAL
:
593 if (msg
->m_type
!= type
)
600 static inline int pipelined_send(struct msg_queue
*msq
, struct msg_msg
*msg
)
602 struct list_head
*tmp
;
604 tmp
= msq
->q_receivers
.next
;
605 while (tmp
!= &msq
->q_receivers
) {
606 struct msg_receiver
*msr
;
608 msr
= list_entry(tmp
, struct msg_receiver
, r_list
);
610 if (testmsg(msg
, msr
->r_msgtype
, msr
->r_mode
) &&
611 !security_msg_queue_msgrcv(msq
, msg
, msr
->r_tsk
,
612 msr
->r_msgtype
, msr
->r_mode
)) {
614 list_del(&msr
->r_list
);
615 if (msr
->r_maxsize
< msg
->m_ts
) {
617 wake_up_process(msr
->r_tsk
);
619 msr
->r_msg
= ERR_PTR(-E2BIG
);
622 msq
->q_lrpid
= task_pid_vnr(msr
->r_tsk
);
623 msq
->q_rtime
= get_seconds();
624 wake_up_process(msr
->r_tsk
);
635 long do_msgsnd(int msqid
, long mtype
, void __user
*mtext
,
636 size_t msgsz
, int msgflg
)
638 struct msg_queue
*msq
;
641 struct ipc_namespace
*ns
;
643 ns
= current
->nsproxy
->ipc_ns
;
645 if (msgsz
> ns
->msg_ctlmax
|| (long) msgsz
< 0 || msqid
< 0)
650 msg
= load_msg(mtext
, msgsz
);
657 msq
= msg_lock_check(ns
, msqid
);
667 if (ipcperms(&msq
->q_perm
, S_IWUGO
))
668 goto out_unlock_free
;
670 err
= security_msg_queue_msgsnd(msq
, msg
, msgflg
);
672 goto out_unlock_free
;
674 if (msgsz
+ msq
->q_cbytes
<= msq
->q_qbytes
&&
675 1 + msq
->q_qnum
<= msq
->q_qbytes
) {
679 /* queue full, wait: */
680 if (msgflg
& IPC_NOWAIT
) {
682 goto out_unlock_free
;
689 ipc_lock_by_ptr(&msq
->q_perm
);
691 if (msq
->q_perm
.deleted
) {
693 goto out_unlock_free
;
697 if (signal_pending(current
)) {
698 err
= -ERESTARTNOHAND
;
699 goto out_unlock_free
;
703 msq
->q_lspid
= task_tgid_vnr(current
);
704 msq
->q_stime
= get_seconds();
706 if (!pipelined_send(msq
, msg
)) {
707 /* noone is waiting for this message, enqueue it */
708 list_add_tail(&msg
->m_list
, &msq
->q_messages
);
709 msq
->q_cbytes
+= msgsz
;
711 atomic_add(msgsz
, &ns
->msg_bytes
);
712 atomic_inc(&ns
->msg_hdrs
);
726 SYSCALL_DEFINE4(msgsnd
, int, msqid
, struct msgbuf __user
*, msgp
, size_t, msgsz
,
731 if (get_user(mtype
, &msgp
->mtype
))
733 return do_msgsnd(msqid
, mtype
, msgp
->mtext
, msgsz
, msgflg
);
736 static inline int convert_mode(long *msgtyp
, int msgflg
)
739 * find message of correct type.
740 * msgtyp = 0 => get first.
741 * msgtyp > 0 => get first message of matching type.
742 * msgtyp < 0 => get message with least type must be < abs(msgtype).
748 return SEARCH_LESSEQUAL
;
750 if (msgflg
& MSG_EXCEPT
)
751 return SEARCH_NOTEQUAL
;
755 long do_msgrcv(int msqid
, long *pmtype
, void __user
*mtext
,
756 size_t msgsz
, long msgtyp
, int msgflg
)
758 struct msg_queue
*msq
;
761 struct ipc_namespace
*ns
;
763 if (msqid
< 0 || (long) msgsz
< 0)
765 mode
= convert_mode(&msgtyp
, msgflg
);
766 ns
= current
->nsproxy
->ipc_ns
;
768 msq
= msg_lock_check(ns
, msqid
);
773 struct msg_receiver msr_d
;
774 struct list_head
*tmp
;
776 msg
= ERR_PTR(-EACCES
);
777 if (ipcperms(&msq
->q_perm
, S_IRUGO
))
780 msg
= ERR_PTR(-EAGAIN
);
781 tmp
= msq
->q_messages
.next
;
782 while (tmp
!= &msq
->q_messages
) {
783 struct msg_msg
*walk_msg
;
785 walk_msg
= list_entry(tmp
, struct msg_msg
, m_list
);
786 if (testmsg(walk_msg
, msgtyp
, mode
) &&
787 !security_msg_queue_msgrcv(msq
, walk_msg
, current
,
791 if (mode
== SEARCH_LESSEQUAL
&&
792 walk_msg
->m_type
!= 1) {
794 msgtyp
= walk_msg
->m_type
- 1;
804 * Found a suitable message.
805 * Unlink it from the queue.
807 if ((msgsz
< msg
->m_ts
) && !(msgflg
& MSG_NOERROR
)) {
808 msg
= ERR_PTR(-E2BIG
);
811 list_del(&msg
->m_list
);
813 msq
->q_rtime
= get_seconds();
814 msq
->q_lrpid
= task_tgid_vnr(current
);
815 msq
->q_cbytes
-= msg
->m_ts
;
816 atomic_sub(msg
->m_ts
, &ns
->msg_bytes
);
817 atomic_dec(&ns
->msg_hdrs
);
818 ss_wakeup(&msq
->q_senders
, 0);
822 /* No message waiting. Wait for a message */
823 if (msgflg
& IPC_NOWAIT
) {
824 msg
= ERR_PTR(-ENOMSG
);
827 list_add_tail(&msr_d
.r_list
, &msq
->q_receivers
);
828 msr_d
.r_tsk
= current
;
829 msr_d
.r_msgtype
= msgtyp
;
831 if (msgflg
& MSG_NOERROR
)
832 msr_d
.r_maxsize
= INT_MAX
;
834 msr_d
.r_maxsize
= msgsz
;
835 msr_d
.r_msg
= ERR_PTR(-EAGAIN
);
836 current
->state
= TASK_INTERRUPTIBLE
;
841 /* Lockless receive, part 1:
842 * Disable preemption. We don't hold a reference to the queue
843 * and getting a reference would defeat the idea of a lockless
844 * operation, thus the code relies on rcu to guarantee the
846 * Prior to destruction, expunge_all(-EIRDM) changes r_msg.
847 * Thus if r_msg is -EAGAIN, then the queue not yet destroyed.
848 * rcu_read_lock() prevents preemption between reading r_msg
849 * and the spin_lock() inside ipc_lock_by_ptr().
853 /* Lockless receive, part 2:
854 * Wait until pipelined_send or expunge_all are outside of
855 * wake_up_process(). There is a race with exit(), see
856 * ipc/mqueue.c for the details.
858 msg
= (struct msg_msg
*)msr_d
.r_msg
;
859 while (msg
== NULL
) {
861 msg
= (struct msg_msg
*)msr_d
.r_msg
;
864 /* Lockless receive, part 3:
865 * If there is a message or an error then accept it without
868 if (msg
!= ERR_PTR(-EAGAIN
)) {
873 /* Lockless receive, part 3:
874 * Acquire the queue spinlock.
876 ipc_lock_by_ptr(&msq
->q_perm
);
879 /* Lockless receive, part 4:
880 * Repeat test after acquiring the spinlock.
882 msg
= (struct msg_msg
*)msr_d
.r_msg
;
883 if (msg
!= ERR_PTR(-EAGAIN
))
886 list_del(&msr_d
.r_list
);
887 if (signal_pending(current
)) {
888 msg
= ERR_PTR(-ERESTARTNOHAND
);
897 msgsz
= (msgsz
> msg
->m_ts
) ? msg
->m_ts
: msgsz
;
898 *pmtype
= msg
->m_type
;
899 if (store_msg(mtext
, msg
, msgsz
))
907 SYSCALL_DEFINE5(msgrcv
, int, msqid
, struct msgbuf __user
*, msgp
, size_t, msgsz
,
908 long, msgtyp
, int, msgflg
)
912 err
= do_msgrcv(msqid
, &mtype
, msgp
->mtext
, msgsz
, msgtyp
, msgflg
);
916 if (put_user(mtype
, &msgp
->mtype
))
922 #ifdef CONFIG_PROC_FS
923 static int sysvipc_msg_proc_show(struct seq_file
*s
, void *it
)
925 struct msg_queue
*msq
= it
;
928 "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",