1 .\" $NetBSD: msgctl.2,v 1.15 2010/03/22 19:30:55 joerg 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.
37 .Nd message control operations
43 .Fn msgctl "int msqid" "int cmd" "struct msqid_ds *buf"
47 system call performs control operations on the message queue specified
51 Each message queue has a
53 structure associated with it which contains the following members:
55 struct ipc_perm msg_perm; /* msg queue permission bits */
56 msgqnum_t msg_qnum; /* # of msgs in the queue */
57 msglen_t msg_qbytes; /* max # of bytes on the queue */
58 pid_t msg_lspid; /* pid of last msgsnd() */
59 pid_t msg_lrpid; /* pid of last msgrcv() */
60 time_t msg_stime; /* time of last msgsnd() */
61 time_t msg_rtime; /* time of last msgrcv() */
62 time_t msg_ctime; /* time of last msgctl() */
67 structure used inside the
69 structure is defined in
71 and contains the following members:
73 uid_t cuid; /* creator user id */
74 gid_t cgid; /* creator group id */
75 uid_t uid; /* user id */
76 gid_t gid; /* group id */
77 mode_t mode; /* permission (lower 9 bits) */
80 The operation to be performed by
85 .Bl -tag -width IPC_RMIDX
87 Gather information about the message queue and place it in the
88 structure pointed to by
97 fields in the structure associated with
99 The values are taken from the corresponding fields in the structure
102 This operation can only be executed by the super-user, or a process that
103 has an effective user id equal to either
107 in the data structure associated with the message queue.
110 can only be increased by the super-user.
113 that exceed the system limit
117 are silently truncated to that limit.
119 Remove the message queue specified by
121 and destroy the data associated with it.
122 Only the super-user or a process with an effective uid equal to the
126 values in the data structure associated with the queue can do this.
129 The permission to read from or write to a message queue (see
135 field in the same way as is done with files (see
137 but the effective uid can match either the
142 effective gid can match either
147 Upon successful completion, a value of 0 is returned.
148 Otherwise, \-1 is returned and the global variable
150 is set to indicate the error.
161 and the caller is not the super-user, nor does
162 the effective uid match either the
166 fields of the data structure associated with the message queue.
168 An attempt was made to increase the value of
172 but the caller is not the super-user.
177 and the caller has no read permission for this message queue.
180 is not a valid message queue identifier.
183 is not a valid command.
186 specifies an invalid address.
195 system call conforms to
198 Message queues appeared in the first release of