1 .\" Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Added correction due to Nick Duffek <nsd@bbc.com>, aeb, 960426
24 .\" Modified Wed Nov 6 04:00:31 1996 by Eric S. Raymond <esr@thyrsus.com>
25 .\" Modified, 8 Jan 2003, Michael Kerrisk, <mtk16@ext.canterbury.ac.nz>
26 .\" Removed EIDRM from errors - that can't happen...
27 .\" Modified, 27 May 2004, Michael Kerrisk <mtk16@ext.canterbury.ac.nz>
28 .\" Added notes on capability requirements
30 .TH MSGGET 2 2004-05-27 "Linux 2.6.6" "Linux Programmer's Manual"
32 msgget \- get a message queue identifier
36 #include <sys/types.h>
43 .BI "int msgget(key_t " key ,
46 The function returns the message queue identifier associated
50 A new message queue is created if
58 no message queue with the given key
65 .IB msgflg & IPC_CREAT
73 plays the same role, with respect to the existence
74 of the message queue, as the presence
79 in the mode argument of the
89 and a message queue already exists for
92 Upon creation, the lower 9 bits of the argument
94 define the access permissions of the message queue.
95 These permission bits have the same format and semantics
96 as the access permissions parameter in
100 system calls. (The execute permissions are not used.)
102 If a new message queue is created,
103 the system call initializes the system message queue data structure
110 are set to the effective user\-ID of the calling process.
115 are set to the effective group\-ID of the calling process.
117 The lowest order 9 bits of
119 are set to the lowest order 9 bit of
131 is set to the current time.
134 is set to the system limit
137 If the message queue already exists the access permissions are
138 verified, and a check is made to see if it is marked for
141 If successful, the return value will be the message queue identifier (a
142 nonnegative integer), otherwise
146 indicating the error.
150 is set to one of the following values:
153 A message queue exists for
155 but the calling process does not have permission to access the queue,
156 and does not have the
161 A message queue exists for
171 No message queue exists for
179 A message queue has to be created but the system has not enough memory for
180 the new data structure.
183 A message queue has to be created but the system limit for the maximum
184 number of message queues
189 isn't a flag field but a
192 If this special value is used for
194 the system call ignores everything but the lowest order 9 bits of
196 and creates a new message queue (on success).
198 The following is a system limit on message queue resources affecting a
203 System wide maximum number of message queues: policy
206 The name choice IPC_PRIVATE was perhaps unfortunate, IPC_NEW
207 would more clearly show its function.
210 Until version 2.3.20 Linux would return EIDRM for a
212 on a message queue scheduled for deletion.