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>
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 <asm/uaccess.h>
46 * one msg_receiver structure for each sleeping receiver:
49 struct list_head r_list
;
50 struct task_struct
*r_tsk
;
56 struct msg_msg
*volatile r_msg
;
59 /* one msg_sender for each sleeping sender */
61 struct list_head list
;
62 struct task_struct
*tsk
;
66 #define SEARCH_EQUAL 2
67 #define SEARCH_NOTEQUAL 3
68 #define SEARCH_LESSEQUAL 4
70 #define msg_ids(ns) ((ns)->ids[IPC_MSG_IDS])
72 #define msg_unlock(msq) ipc_unlock(&(msq)->q_perm)
73 #define msg_buildid(id, seq) ipc_buildid(id, seq)
75 static void freeque(struct ipc_namespace
*, struct msg_queue
*);
76 static int newque(struct ipc_namespace
*, struct ipc_params
*);
78 static int sysvipc_msg_proc_show(struct seq_file
*s
, void *it
);
81 void msg_init_ns(struct ipc_namespace
*ns
)
83 ns
->msg_ctlmax
= MSGMAX
;
84 ns
->msg_ctlmnb
= MSGMNB
;
85 ns
->msg_ctlmni
= MSGMNI
;
86 atomic_set(&ns
->msg_bytes
, 0);
87 atomic_set(&ns
->msg_hdrs
, 0);
88 ipc_init_ids(&ns
->ids
[IPC_MSG_IDS
]);
92 void msg_exit_ns(struct ipc_namespace
*ns
)
94 struct msg_queue
*msq
;
95 struct kern_ipc_perm
*perm
;
99 down_write(&msg_ids(ns
).rw_mutex
);
101 in_use
= msg_ids(ns
).in_use
;
103 for (total
= 0, next_id
= 0; total
< in_use
; next_id
++) {
104 perm
= idr_find(&msg_ids(ns
).ipcs_idr
, next_id
);
107 ipc_lock_by_ptr(perm
);
108 msq
= container_of(perm
, struct msg_queue
, q_perm
);
113 up_write(&msg_ids(ns
).rw_mutex
);
117 void __init
msg_init(void)
119 msg_init_ns(&init_ipc_ns
);
120 ipc_init_proc_interface("sysvipc/msg",
121 " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n",
122 IPC_MSG_IDS
, sysvipc_msg_proc_show
);
126 * This routine is called in the paths where the rw_mutex is held to protect
127 * access to the idr tree.
129 static inline struct msg_queue
*msg_lock_check_down(struct ipc_namespace
*ns
,
132 struct kern_ipc_perm
*ipcp
= ipc_lock_check_down(&msg_ids(ns
), id
);
135 return (struct msg_queue
*)ipcp
;
137 return container_of(ipcp
, struct msg_queue
, q_perm
);
141 * msg_lock_(check_) routines are called in the paths where the rw_mutex
144 static inline struct msg_queue
*msg_lock(struct ipc_namespace
*ns
, int id
)
146 struct kern_ipc_perm
*ipcp
= ipc_lock(&msg_ids(ns
), id
);
149 return (struct msg_queue
*)ipcp
;
151 return container_of(ipcp
, struct msg_queue
, q_perm
);
154 static inline struct msg_queue
*msg_lock_check(struct ipc_namespace
*ns
,
157 struct kern_ipc_perm
*ipcp
= ipc_lock_check(&msg_ids(ns
), id
);
160 return (struct msg_queue
*)ipcp
;
162 return container_of(ipcp
, struct msg_queue
, q_perm
);
165 static inline void msg_rmid(struct ipc_namespace
*ns
, struct msg_queue
*s
)
167 ipc_rmid(&msg_ids(ns
), &s
->q_perm
);
171 * newque - Create a new msg queue
173 * @params: ptr to the structure that contains the key and msgflg
175 * Called with msg_ids.rw_mutex held (writer)
177 static int newque(struct ipc_namespace
*ns
, struct ipc_params
*params
)
179 struct msg_queue
*msq
;
181 key_t key
= params
->key
;
182 int msgflg
= params
->flg
;
184 msq
= ipc_rcu_alloc(sizeof(*msq
));
188 msq
->q_perm
.mode
= msgflg
& S_IRWXUGO
;
189 msq
->q_perm
.key
= key
;
191 msq
->q_perm
.security
= NULL
;
192 retval
= security_msg_queue_alloc(msq
);
199 * ipc_addid() locks msq
201 id
= ipc_addid(&msg_ids(ns
), &msq
->q_perm
, ns
->msg_ctlmni
);
203 security_msg_queue_free(msq
);
208 msq
->q_perm
.id
= msg_buildid(id
, msq
->q_perm
.seq
);
209 msq
->q_stime
= msq
->q_rtime
= 0;
210 msq
->q_ctime
= get_seconds();
211 msq
->q_cbytes
= msq
->q_qnum
= 0;
212 msq
->q_qbytes
= ns
->msg_ctlmnb
;
213 msq
->q_lspid
= msq
->q_lrpid
= 0;
214 INIT_LIST_HEAD(&msq
->q_messages
);
215 INIT_LIST_HEAD(&msq
->q_receivers
);
216 INIT_LIST_HEAD(&msq
->q_senders
);
220 return msq
->q_perm
.id
;
223 static inline void ss_add(struct msg_queue
*msq
, struct msg_sender
*mss
)
226 current
->state
= TASK_INTERRUPTIBLE
;
227 list_add_tail(&mss
->list
, &msq
->q_senders
);
230 static inline void ss_del(struct msg_sender
*mss
)
232 if (mss
->list
.next
!= NULL
)
233 list_del(&mss
->list
);
236 static void ss_wakeup(struct list_head
*h
, int kill
)
238 struct list_head
*tmp
;
242 struct msg_sender
*mss
;
244 mss
= list_entry(tmp
, struct msg_sender
, list
);
247 mss
->list
.next
= NULL
;
248 wake_up_process(mss
->tsk
);
252 static void expunge_all(struct msg_queue
*msq
, int res
)
254 struct list_head
*tmp
;
256 tmp
= msq
->q_receivers
.next
;
257 while (tmp
!= &msq
->q_receivers
) {
258 struct msg_receiver
*msr
;
260 msr
= list_entry(tmp
, struct msg_receiver
, r_list
);
263 wake_up_process(msr
->r_tsk
);
265 msr
->r_msg
= ERR_PTR(res
);
270 * freeque() wakes up waiters on the sender and receiver waiting queue,
271 * removes the message queue from message queue ID IDR, and cleans up all the
272 * messages associated with this queue.
274 * msg_ids.rw_mutex (writer) and the spinlock for this message queue are held
275 * before freeque() is called. msg_ids.rw_mutex remains locked on exit.
277 static void freeque(struct ipc_namespace
*ns
, struct msg_queue
*msq
)
279 struct list_head
*tmp
;
281 expunge_all(msq
, -EIDRM
);
282 ss_wakeup(&msq
->q_senders
, 1);
286 tmp
= msq
->q_messages
.next
;
287 while (tmp
!= &msq
->q_messages
) {
288 struct msg_msg
*msg
= list_entry(tmp
, struct msg_msg
, m_list
);
291 atomic_dec(&ns
->msg_hdrs
);
294 atomic_sub(msq
->q_cbytes
, &ns
->msg_bytes
);
295 security_msg_queue_free(msq
);
300 * Called with msg_ids.rw_mutex and ipcp locked.
302 static inline int msg_security(struct kern_ipc_perm
*ipcp
, int msgflg
)
304 struct msg_queue
*msq
= container_of(ipcp
, struct msg_queue
, q_perm
);
306 return security_msg_queue_associate(msq
, msgflg
);
309 asmlinkage
long sys_msgget(key_t key
, int msgflg
)
311 struct ipc_namespace
*ns
;
312 struct ipc_ops msg_ops
;
313 struct ipc_params msg_params
;
315 ns
= current
->nsproxy
->ipc_ns
;
317 msg_ops
.getnew
= newque
;
318 msg_ops
.associate
= msg_security
;
319 msg_ops
.more_checks
= NULL
;
321 msg_params
.key
= key
;
322 msg_params
.flg
= msgflg
;
324 return ipcget(ns
, &msg_ids(ns
), &msg_ops
, &msg_params
);
327 static inline unsigned long
328 copy_msqid_to_user(void __user
*buf
, struct msqid64_ds
*in
, int version
)
332 return copy_to_user(buf
, in
, sizeof(*in
));
337 memset(&out
, 0, sizeof(out
));
339 ipc64_perm_to_ipc_perm(&in
->msg_perm
, &out
.msg_perm
);
341 out
.msg_stime
= in
->msg_stime
;
342 out
.msg_rtime
= in
->msg_rtime
;
343 out
.msg_ctime
= in
->msg_ctime
;
345 if (in
->msg_cbytes
> USHRT_MAX
)
346 out
.msg_cbytes
= USHRT_MAX
;
348 out
.msg_cbytes
= in
->msg_cbytes
;
349 out
.msg_lcbytes
= in
->msg_cbytes
;
351 if (in
->msg_qnum
> USHRT_MAX
)
352 out
.msg_qnum
= USHRT_MAX
;
354 out
.msg_qnum
= in
->msg_qnum
;
356 if (in
->msg_qbytes
> USHRT_MAX
)
357 out
.msg_qbytes
= USHRT_MAX
;
359 out
.msg_qbytes
= in
->msg_qbytes
;
360 out
.msg_lqbytes
= in
->msg_qbytes
;
362 out
.msg_lspid
= in
->msg_lspid
;
363 out
.msg_lrpid
= in
->msg_lrpid
;
365 return copy_to_user(buf
, &out
, sizeof(out
));
373 unsigned long qbytes
;
379 static inline unsigned long
380 copy_msqid_from_user(struct msq_setbuf
*out
, void __user
*buf
, int version
)
385 struct msqid64_ds tbuf
;
387 if (copy_from_user(&tbuf
, buf
, sizeof(tbuf
)))
390 out
->qbytes
= tbuf
.msg_qbytes
;
391 out
->uid
= tbuf
.msg_perm
.uid
;
392 out
->gid
= tbuf
.msg_perm
.gid
;
393 out
->mode
= tbuf
.msg_perm
.mode
;
399 struct msqid_ds tbuf_old
;
401 if (copy_from_user(&tbuf_old
, buf
, sizeof(tbuf_old
)))
404 out
->uid
= tbuf_old
.msg_perm
.uid
;
405 out
->gid
= tbuf_old
.msg_perm
.gid
;
406 out
->mode
= tbuf_old
.msg_perm
.mode
;
408 if (tbuf_old
.msg_qbytes
== 0)
409 out
->qbytes
= tbuf_old
.msg_lqbytes
;
411 out
->qbytes
= tbuf_old
.msg_qbytes
;
420 asmlinkage
long sys_msgctl(int msqid
, int cmd
, struct msqid_ds __user
*buf
)
422 struct kern_ipc_perm
*ipcp
;
423 struct msq_setbuf
uninitialized_var(setbuf
);
424 struct msg_queue
*msq
;
426 struct ipc_namespace
*ns
;
428 if (msqid
< 0 || cmd
< 0)
431 version
= ipc_parse_version(&cmd
);
432 ns
= current
->nsproxy
->ipc_ns
;
438 struct msginfo msginfo
;
444 * We must not return kernel stack data.
445 * due to padding, it's not enough
446 * to set all member fields.
448 err
= security_msg_queue_msgctl(NULL
, cmd
);
452 memset(&msginfo
, 0, sizeof(msginfo
));
453 msginfo
.msgmni
= ns
->msg_ctlmni
;
454 msginfo
.msgmax
= ns
->msg_ctlmax
;
455 msginfo
.msgmnb
= ns
->msg_ctlmnb
;
456 msginfo
.msgssz
= MSGSSZ
;
457 msginfo
.msgseg
= MSGSEG
;
458 down_read(&msg_ids(ns
).rw_mutex
);
459 if (cmd
== MSG_INFO
) {
460 msginfo
.msgpool
= msg_ids(ns
).in_use
;
461 msginfo
.msgmap
= atomic_read(&ns
->msg_hdrs
);
462 msginfo
.msgtql
= atomic_read(&ns
->msg_bytes
);
464 msginfo
.msgmap
= MSGMAP
;
465 msginfo
.msgpool
= MSGPOOL
;
466 msginfo
.msgtql
= MSGTQL
;
468 max_id
= ipc_get_maxid(&msg_ids(ns
));
469 up_read(&msg_ids(ns
).rw_mutex
);
470 if (copy_to_user(buf
, &msginfo
, sizeof(struct msginfo
)))
472 return (max_id
< 0) ? 0 : max_id
;
474 case MSG_STAT
: /* msqid is an index rather than a msg queue id */
477 struct msqid64_ds tbuf
;
483 if (cmd
== MSG_STAT
) {
484 msq
= msg_lock(ns
, msqid
);
487 success_return
= msq
->q_perm
.id
;
489 msq
= msg_lock_check(ns
, msqid
);
495 if (ipcperms(&msq
->q_perm
, S_IRUGO
))
498 err
= security_msg_queue_msgctl(msq
, cmd
);
502 memset(&tbuf
, 0, sizeof(tbuf
));
504 kernel_to_ipc64_perm(&msq
->q_perm
, &tbuf
.msg_perm
);
505 tbuf
.msg_stime
= msq
->q_stime
;
506 tbuf
.msg_rtime
= msq
->q_rtime
;
507 tbuf
.msg_ctime
= msq
->q_ctime
;
508 tbuf
.msg_cbytes
= msq
->q_cbytes
;
509 tbuf
.msg_qnum
= msq
->q_qnum
;
510 tbuf
.msg_qbytes
= msq
->q_qbytes
;
511 tbuf
.msg_lspid
= msq
->q_lspid
;
512 tbuf
.msg_lrpid
= msq
->q_lrpid
;
514 if (copy_msqid_to_user(buf
, &tbuf
, version
))
516 return success_return
;
521 if (copy_msqid_from_user(&setbuf
, buf
, version
))
530 down_write(&msg_ids(ns
).rw_mutex
);
531 msq
= msg_lock_check_down(ns
, msqid
);
539 err
= audit_ipc_obj(ipcp
);
542 if (cmd
== IPC_SET
) {
543 err
= audit_ipc_set_perm(setbuf
.qbytes
, setbuf
.uid
, setbuf
.gid
,
550 if (current
->euid
!= ipcp
->cuid
&&
551 current
->euid
!= ipcp
->uid
&& !capable(CAP_SYS_ADMIN
))
552 /* We _could_ check for CAP_CHOWN above, but we don't */
555 err
= security_msg_queue_msgctl(msq
, cmd
);
563 if (setbuf
.qbytes
> ns
->msg_ctlmnb
&& !capable(CAP_SYS_RESOURCE
))
566 msq
->q_qbytes
= setbuf
.qbytes
;
568 ipcp
->uid
= setbuf
.uid
;
569 ipcp
->gid
= setbuf
.gid
;
570 ipcp
->mode
= (ipcp
->mode
& ~S_IRWXUGO
) |
571 (S_IRWXUGO
& setbuf
.mode
);
572 msq
->q_ctime
= get_seconds();
573 /* sleeping receivers might be excluded by
574 * stricter permissions.
576 expunge_all(msq
, -EAGAIN
);
577 /* sleeping senders might be able to send
578 * due to a larger queue size.
580 ss_wakeup(&msq
->q_senders
, 0);
590 up_write(&msg_ids(ns
).rw_mutex
);
600 static int testmsg(struct msg_msg
*msg
, long type
, int mode
)
606 case SEARCH_LESSEQUAL
:
607 if (msg
->m_type
<=type
)
611 if (msg
->m_type
== type
)
614 case SEARCH_NOTEQUAL
:
615 if (msg
->m_type
!= type
)
622 static inline int pipelined_send(struct msg_queue
*msq
, struct msg_msg
*msg
)
624 struct list_head
*tmp
;
626 tmp
= msq
->q_receivers
.next
;
627 while (tmp
!= &msq
->q_receivers
) {
628 struct msg_receiver
*msr
;
630 msr
= list_entry(tmp
, struct msg_receiver
, r_list
);
632 if (testmsg(msg
, msr
->r_msgtype
, msr
->r_mode
) &&
633 !security_msg_queue_msgrcv(msq
, msg
, msr
->r_tsk
,
634 msr
->r_msgtype
, msr
->r_mode
)) {
636 list_del(&msr
->r_list
);
637 if (msr
->r_maxsize
< msg
->m_ts
) {
639 wake_up_process(msr
->r_tsk
);
641 msr
->r_msg
= ERR_PTR(-E2BIG
);
644 msq
->q_lrpid
= task_pid_vnr(msr
->r_tsk
);
645 msq
->q_rtime
= get_seconds();
646 wake_up_process(msr
->r_tsk
);
657 long do_msgsnd(int msqid
, long mtype
, void __user
*mtext
,
658 size_t msgsz
, int msgflg
)
660 struct msg_queue
*msq
;
663 struct ipc_namespace
*ns
;
665 ns
= current
->nsproxy
->ipc_ns
;
667 if (msgsz
> ns
->msg_ctlmax
|| (long) msgsz
< 0 || msqid
< 0)
672 msg
= load_msg(mtext
, msgsz
);
679 msq
= msg_lock_check(ns
, msqid
);
689 if (ipcperms(&msq
->q_perm
, S_IWUGO
))
690 goto out_unlock_free
;
692 err
= security_msg_queue_msgsnd(msq
, msg
, msgflg
);
694 goto out_unlock_free
;
696 if (msgsz
+ msq
->q_cbytes
<= msq
->q_qbytes
&&
697 1 + msq
->q_qnum
<= msq
->q_qbytes
) {
701 /* queue full, wait: */
702 if (msgflg
& IPC_NOWAIT
) {
704 goto out_unlock_free
;
711 ipc_lock_by_ptr(&msq
->q_perm
);
713 if (msq
->q_perm
.deleted
) {
715 goto out_unlock_free
;
719 if (signal_pending(current
)) {
720 err
= -ERESTARTNOHAND
;
721 goto out_unlock_free
;
725 msq
->q_lspid
= task_tgid_vnr(current
);
726 msq
->q_stime
= get_seconds();
728 if (!pipelined_send(msq
, msg
)) {
729 /* noone is waiting for this message, enqueue it */
730 list_add_tail(&msg
->m_list
, &msq
->q_messages
);
731 msq
->q_cbytes
+= msgsz
;
733 atomic_add(msgsz
, &ns
->msg_bytes
);
734 atomic_inc(&ns
->msg_hdrs
);
749 sys_msgsnd(int msqid
, struct msgbuf __user
*msgp
, size_t msgsz
, int msgflg
)
753 if (get_user(mtype
, &msgp
->mtype
))
755 return do_msgsnd(msqid
, mtype
, msgp
->mtext
, msgsz
, msgflg
);
758 static inline int convert_mode(long *msgtyp
, int msgflg
)
761 * find message of correct type.
762 * msgtyp = 0 => get first.
763 * msgtyp > 0 => get first message of matching type.
764 * msgtyp < 0 => get message with least type must be < abs(msgtype).
770 return SEARCH_LESSEQUAL
;
772 if (msgflg
& MSG_EXCEPT
)
773 return SEARCH_NOTEQUAL
;
777 long do_msgrcv(int msqid
, long *pmtype
, void __user
*mtext
,
778 size_t msgsz
, long msgtyp
, int msgflg
)
780 struct msg_queue
*msq
;
783 struct ipc_namespace
*ns
;
785 if (msqid
< 0 || (long) msgsz
< 0)
787 mode
= convert_mode(&msgtyp
, msgflg
);
788 ns
= current
->nsproxy
->ipc_ns
;
790 msq
= msg_lock_check(ns
, msqid
);
795 struct msg_receiver msr_d
;
796 struct list_head
*tmp
;
798 msg
= ERR_PTR(-EACCES
);
799 if (ipcperms(&msq
->q_perm
, S_IRUGO
))
802 msg
= ERR_PTR(-EAGAIN
);
803 tmp
= msq
->q_messages
.next
;
804 while (tmp
!= &msq
->q_messages
) {
805 struct msg_msg
*walk_msg
;
807 walk_msg
= list_entry(tmp
, struct msg_msg
, m_list
);
808 if (testmsg(walk_msg
, msgtyp
, mode
) &&
809 !security_msg_queue_msgrcv(msq
, walk_msg
, current
,
813 if (mode
== SEARCH_LESSEQUAL
&&
814 walk_msg
->m_type
!= 1) {
816 msgtyp
= walk_msg
->m_type
- 1;
826 * Found a suitable message.
827 * Unlink it from the queue.
829 if ((msgsz
< msg
->m_ts
) && !(msgflg
& MSG_NOERROR
)) {
830 msg
= ERR_PTR(-E2BIG
);
833 list_del(&msg
->m_list
);
835 msq
->q_rtime
= get_seconds();
836 msq
->q_lrpid
= task_tgid_vnr(current
);
837 msq
->q_cbytes
-= msg
->m_ts
;
838 atomic_sub(msg
->m_ts
, &ns
->msg_bytes
);
839 atomic_dec(&ns
->msg_hdrs
);
840 ss_wakeup(&msq
->q_senders
, 0);
844 /* No message waiting. Wait for a message */
845 if (msgflg
& IPC_NOWAIT
) {
846 msg
= ERR_PTR(-ENOMSG
);
849 list_add_tail(&msr_d
.r_list
, &msq
->q_receivers
);
850 msr_d
.r_tsk
= current
;
851 msr_d
.r_msgtype
= msgtyp
;
853 if (msgflg
& MSG_NOERROR
)
854 msr_d
.r_maxsize
= INT_MAX
;
856 msr_d
.r_maxsize
= msgsz
;
857 msr_d
.r_msg
= ERR_PTR(-EAGAIN
);
858 current
->state
= TASK_INTERRUPTIBLE
;
863 /* Lockless receive, part 1:
864 * Disable preemption. We don't hold a reference to the queue
865 * and getting a reference would defeat the idea of a lockless
866 * operation, thus the code relies on rcu to guarantee the
868 * Prior to destruction, expunge_all(-EIRDM) changes r_msg.
869 * Thus if r_msg is -EAGAIN, then the queue not yet destroyed.
870 * rcu_read_lock() prevents preemption between reading r_msg
871 * and the spin_lock() inside ipc_lock_by_ptr().
875 /* Lockless receive, part 2:
876 * Wait until pipelined_send or expunge_all are outside of
877 * wake_up_process(). There is a race with exit(), see
878 * ipc/mqueue.c for the details.
880 msg
= (struct msg_msg
*)msr_d
.r_msg
;
881 while (msg
== NULL
) {
883 msg
= (struct msg_msg
*)msr_d
.r_msg
;
886 /* Lockless receive, part 3:
887 * If there is a message or an error then accept it without
890 if (msg
!= ERR_PTR(-EAGAIN
)) {
895 /* Lockless receive, part 3:
896 * Acquire the queue spinlock.
898 ipc_lock_by_ptr(&msq
->q_perm
);
901 /* Lockless receive, part 4:
902 * Repeat test after acquiring the spinlock.
904 msg
= (struct msg_msg
*)msr_d
.r_msg
;
905 if (msg
!= ERR_PTR(-EAGAIN
))
908 list_del(&msr_d
.r_list
);
909 if (signal_pending(current
)) {
910 msg
= ERR_PTR(-ERESTARTNOHAND
);
919 msgsz
= (msgsz
> msg
->m_ts
) ? msg
->m_ts
: msgsz
;
920 *pmtype
= msg
->m_type
;
921 if (store_msg(mtext
, msg
, msgsz
))
929 asmlinkage
long sys_msgrcv(int msqid
, struct msgbuf __user
*msgp
, size_t msgsz
,
930 long msgtyp
, int msgflg
)
934 err
= do_msgrcv(msqid
, &mtype
, msgp
->mtext
, msgsz
, msgtyp
, msgflg
);
938 if (put_user(mtype
, &msgp
->mtype
))
944 #ifdef CONFIG_PROC_FS
945 static int sysvipc_msg_proc_show(struct seq_file
*s
, void *it
)
947 struct msg_queue
*msq
= it
;
950 "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",
This page took 0.072635 seconds and 6 git commands to generate.