1 .\" $NetBSD: msgctl.2,v 1.1 1995/10/16 23:49:15 jtc Exp $
3 .\" Copyright (c) 1995 Frank van der Linden
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\" must display the following acknowledgement:
16 .\" This product includes software developed for the NetBSD Project
17 .\" by Frank van der Linden
18 .\" 4. The name of the author may not be used to endorse or promote products
19 .\" derived from this software without specific prior written permission
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 .\" $FreeBSD: src/lib/libc/gen/msgctl.3,v 1.16 2001/10/01 16:08:51 ru Exp $
39 .Nd message control operations
47 .Fn msgctl "int msqid" "int cmd" "struct msqid_ds *buf"
51 system call performs some control operations on the message queue specified
55 Each message queue has a data structure associated with it, parts of which
58 and parts of which determine the actions of
60 The data structure is defined in
62 and contains (amongst others) the following members:
65 struct ipc_perm msg_perm; /* msg queue permission bits */
66 struct msg *msg_first; /* first message in the queue */
67 struct msg *msg_last; /* last message in the queue */
68 u_long msg_cbytes; /* number of bytes in use on the queue */
69 u_long msg_qnum; /* number of msgs in the queue */
70 u_long msg_qbytes; /* max # of bytes on the queue */
71 pid_t msg_lspid; /* pid of last msgsnd() */
72 pid_t msg_lrpid; /* pid of last msgrcv() */
73 time_t msg_stime; /* time of last msgsnd() */
75 time_t msg_rtime; /* time of last msgrcv() */
77 time_t msg_ctime; /* time of last msgctl() */
85 structure used inside the
87 structure is defined in
92 ushort cuid; /* creator user id */
93 ushort cgid; /* creator group id */
94 ushort uid; /* user id */
95 ushort gid; /* group id */
96 ushort mode; /* r/w permission */
97 ushort seq; /* sequence # (to generate unique msg/sem/shm id) */
98 key_t key; /* user specified msg/sem/shm key */
102 The operation to be performed by
107 .Bl -tag -width IPC_RMIDX
109 Gather information about the message queue and place it in the
110 structure pointed to by
119 fields in the structure associated with
121 The values are taken from the corresponding fields in the structure
124 This operation can only be executed by the super-user, or a process that
125 has an effective user id equal to either
129 in the data structure associated with the message queue.
132 can only be increased by the super-user.
135 that exceed the system limit (MSGMNB from
137 are silently truncated to that limit.
139 Remove the message queue specified by
141 and destroy the data associated with it.
142 Only the super-user or a process
143 with an effective uid equal to the
147 values in the data structure associated with the queue can do this.
150 The permission to read from or write to a message queue (see
156 field in the same way as is
159 but the effective uid can match either the
164 effective gid can match either
176 is equal to IPC_SET or IPC_RMID and the caller is not the super-user, nor does
177 the effective uid match either the
181 fields of the data structure associated with the message queue.
183 An attempt is made to increase the value of
186 but the caller is not the super-user.
188 The command is IPC_STAT
189 and the caller has no read permission for this message queue.
192 is not a valid message queue identifier.
195 is not a valid command.
198 specifies an invalid address.
205 Message queues appeared in the first release of