1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2015-02-04 23:32+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
20 #: build/C/man3/mq_close.3:26
26 #: build/C/man3/mq_close.3:26 build/C/man3/mq_unlink.3:26
32 #: build/C/man3/mq_close.3:26 build/C/man3/mq_getattr.3:26 build/C/man2/mq_getsetattr.2:26 build/C/man3/mq_notify.3:26 build/C/man3/mq_open.3:26 build/C/man7/mq_overview.7:26 build/C/man3/mq_receive.3:26 build/C/man3/mq_send.3:26 build/C/man3/mq_unlink.3:26 build/C/man2/msgctl.2:37 build/C/man2/msgget.2:35 build/C/man2/msgop.2:41
38 #: build/C/man3/mq_close.3:26 build/C/man3/mq_getattr.3:26 build/C/man2/mq_getsetattr.2:26 build/C/man3/mq_notify.3:26 build/C/man3/mq_open.3:26 build/C/man7/mq_overview.7:26 build/C/man3/mq_receive.3:26 build/C/man3/mq_send.3:26 build/C/man3/mq_unlink.3:26 build/C/man2/msgctl.2:37 build/C/man2/msgget.2:35 build/C/man2/msgop.2:41
40 msgid "Linux Programmer's Manual"
44 #: build/C/man3/mq_close.3:27 build/C/man3/mq_getattr.3:27 build/C/man2/mq_getsetattr.2:27 build/C/man3/mq_notify.3:27 build/C/man3/mq_open.3:27 build/C/man7/mq_overview.7:27 build/C/man3/mq_receive.3:27 build/C/man3/mq_send.3:27 build/C/man3/mq_unlink.3:27 build/C/man2/msgctl.2:38 build/C/man2/msgget.2:36 build/C/man2/msgop.2:42
50 #: build/C/man3/mq_close.3:29
51 msgid "mq_close - close a message queue descriptor"
55 #: build/C/man3/mq_close.3:29 build/C/man3/mq_getattr.3:29 build/C/man2/mq_getsetattr.2:29 build/C/man3/mq_notify.3:29 build/C/man3/mq_open.3:29 build/C/man3/mq_receive.3:29 build/C/man3/mq_send.3:29 build/C/man3/mq_unlink.3:29 build/C/man2/msgctl.2:40 build/C/man2/msgget.2:38 build/C/man2/msgop.2:44
61 #: build/C/man3/mq_close.3:32 build/C/man3/mq_getattr.3:32 build/C/man3/mq_notify.3:32 build/C/man3/mq_receive.3:32 build/C/man3/mq_send.3:32 build/C/man3/mq_unlink.3:32
63 msgid "B<#include E<lt>mqueue.hE<gt>>\n"
67 #: build/C/man3/mq_close.3:34
69 msgid "B<int mq_close(mqd_t >I<mqdes>B<);>\n"
73 #: build/C/man3/mq_close.3:37 build/C/man3/mq_getattr.3:40 build/C/man3/mq_notify.3:37 build/C/man3/mq_open.3:41 build/C/man3/mq_receive.3:45 build/C/man3/mq_send.3:45 build/C/man3/mq_unlink.3:37
74 msgid "Link with I<-lrt>."
78 #: build/C/man3/mq_close.3:37 build/C/man3/mq_getattr.3:40 build/C/man2/mq_getsetattr.2:40 build/C/man3/mq_notify.3:37 build/C/man3/mq_open.3:41 build/C/man7/mq_overview.7:29 build/C/man3/mq_receive.3:57 build/C/man3/mq_send.3:57 build/C/man3/mq_unlink.3:37 build/C/man2/msgctl.2:48 build/C/man2/msgget.2:46 build/C/man2/msgop.2:57
84 #: build/C/man3/mq_close.3:41
85 msgid "B<mq_close>() closes the message queue descriptor I<mqdes>."
89 #: build/C/man3/mq_close.3:47
91 "If the calling process has attached a notification request to this message "
92 "queue via I<mqdes>, then this request is removed, and another process can "
93 "now attach a notification request."
97 #: build/C/man3/mq_close.3:47 build/C/man3/mq_getattr.3:118 build/C/man3/mq_notify.3:134 build/C/man3/mq_open.3:136 build/C/man3/mq_receive.3:113 build/C/man3/mq_send.3:119 build/C/man3/mq_unlink.3:44 build/C/man2/msgctl.2:229 build/C/man2/msgget.2:137 build/C/man2/msgop.2:339
103 #: build/C/man3/mq_close.3:53
105 "On success B<mq_close>() returns 0; on error, -1 is returned, with I<errno> "
106 "set to indicate the error."
110 #: build/C/man3/mq_close.3:53 build/C/man3/mq_getattr.3:126 build/C/man3/mq_notify.3:140 build/C/man3/mq_open.3:148 build/C/man3/mq_receive.3:122 build/C/man3/mq_send.3:127 build/C/man3/mq_unlink.3:50 build/C/man2/msgctl.2:254 build/C/man2/msgget.2:143 build/C/man2/msgop.2:352
116 #: build/C/man3/mq_close.3:54 build/C/man3/mq_getattr.3:127 build/C/man3/mq_notify.3:141 build/C/man3/mq_receive.3:129 build/C/man3/mq_send.3:134
122 #: build/C/man3/mq_close.3:59 build/C/man3/mq_getattr.3:132 build/C/man3/mq_notify.3:146
123 msgid "The descriptor specified in I<mqdes> is invalid."
127 #: build/C/man3/mq_close.3:59 build/C/man3/mq_getattr.3:137 build/C/man3/mq_open.3:237 build/C/man3/mq_receive.3:156 build/C/man3/mq_send.3:161 build/C/man3/mq_unlink.3:62
133 #: build/C/man3/mq_close.3:60 build/C/man3/mq_getattr.3:138 build/C/man3/mq_open.3:238 build/C/man3/mq_receive.3:157 build/C/man3/mq_send.3:162 build/C/man3/mq_unlink.3:63
135 msgid "Multithreading (see pthreads(7))"
139 #: build/C/man3/mq_close.3:64
140 msgid "The B<mq_close>() function is thread-safe."
144 #: build/C/man3/mq_close.3:64 build/C/man3/mq_getattr.3:144 build/C/man2/mq_getsetattr.2:50 build/C/man3/mq_notify.3:174 build/C/man3/mq_open.3:242 build/C/man7/mq_overview.7:351 build/C/man3/mq_receive.3:163 build/C/man3/mq_send.3:168 build/C/man3/mq_unlink.3:67 build/C/man2/msgctl.2:325 build/C/man2/msgget.2:182 build/C/man2/msgop.2:482
146 msgid "CONFORMING TO"
150 #: build/C/man3/mq_close.3:66 build/C/man3/mq_getattr.3:146 build/C/man3/mq_notify.3:176 build/C/man3/mq_open.3:244 build/C/man7/mq_overview.7:353 build/C/man3/mq_receive.3:165 build/C/man3/mq_send.3:170 build/C/man3/mq_unlink.3:69
151 msgid "POSIX.1-2001."
155 #: build/C/man3/mq_close.3:66 build/C/man3/mq_getattr.3:146 build/C/man2/mq_getsetattr.2:52 build/C/man7/mq_overview.7:353 build/C/man3/mq_receive.3:165 build/C/man3/mq_send.3:170 build/C/man2/msgctl.2:328 build/C/man2/msgget.2:184 build/C/man2/msgop.2:494
161 #: build/C/man3/mq_close.3:70
163 "All open message queues are automatically closed on process termination, or "
168 #: build/C/man3/mq_close.3:70 build/C/man3/mq_getattr.3:230 build/C/man2/mq_getsetattr.2:56 build/C/man3/mq_notify.3:243 build/C/man3/mq_open.3:248 build/C/man7/mq_overview.7:378 build/C/man3/mq_receive.3:171 build/C/man3/mq_send.3:176 build/C/man3/mq_unlink.3:69 build/C/man2/msgctl.2:367 build/C/man2/msgget.2:229 build/C/man2/msgop.2:579
174 #: build/C/man3/mq_close.3:78
176 "B<mq_getattr>(3), B<mq_notify>(3), B<mq_open>(3), B<mq_receive>(3), "
177 "B<mq_send>(3), B<mq_unlink>(3), B<mq_overview>(7)"
181 #: build/C/man3/mq_close.3:78 build/C/man3/mq_getattr.3:238 build/C/man2/mq_getsetattr.2:59 build/C/man3/mq_notify.3:252 build/C/man3/mq_open.3:256 build/C/man7/mq_overview.7:392 build/C/man3/mq_receive.3:180 build/C/man3/mq_send.3:185 build/C/man3/mq_unlink.3:77 build/C/man2/msgctl.2:374 build/C/man2/msgget.2:237 build/C/man2/msgop.2:585
187 #: build/C/man3/mq_close.3:86 build/C/man3/mq_getattr.3:246 build/C/man2/mq_getsetattr.2:67 build/C/man3/mq_notify.3:260 build/C/man3/mq_open.3:264 build/C/man7/mq_overview.7:400 build/C/man3/mq_receive.3:188 build/C/man3/mq_send.3:193 build/C/man3/mq_unlink.3:85 build/C/man2/msgctl.2:382 build/C/man2/msgget.2:245 build/C/man2/msgop.2:593
189 "This page is part of release 3.79 of the Linux I<man-pages> project. A "
190 "description of the project, information about reporting bugs, and the latest "
191 "version of this page, can be found at "
192 "\\%http://www.kernel.org/doc/man-pages/."
196 #: build/C/man3/mq_getattr.3:26
202 #: build/C/man3/mq_getattr.3:26
208 #: build/C/man3/mq_getattr.3:29
209 msgid "mq_getattr, mq_setattr - get/set message queue attributes"
213 #: build/C/man3/mq_getattr.3:34
215 msgid "B<int mq_getattr(mqd_t >I<mqdes>B<, struct mq_attr *>I<attr>B<);>\n"
219 #: build/C/man3/mq_getattr.3:37
222 "B<int mq_setattr(mqd_t >I<mqdes>B<, const struct mq_attr *>I<newattr>B<,>\n"
223 "B< struct mq_attr *>I<oldattr>B<);>\n"
227 #: build/C/man3/mq_getattr.3:47
229 "B<mq_getattr>() and B<mq_setattr>() respectively retrieve and modify "
230 "attributes of the message queue referred to by the descriptor I<mqdes>."
234 #: build/C/man3/mq_getattr.3:54
236 "B<mq_getattr>() returns an I<mq_attr> structure in the buffer pointed by "
237 "I<attr>. This structure is defined as:"
241 #: build/C/man3/mq_getattr.3:63
245 " long mq_flags; /* Flags: 0 or O_NONBLOCK */\n"
246 " long mq_maxmsg; /* Max. # of messages on queue */\n"
247 " long mq_msgsize; /* Max. message size (bytes) */\n"
248 " long mq_curmsgs; /* # of messages currently in queue */\n"
253 #: build/C/man3/mq_getattr.3:73
255 "The I<mq_flags> field contains flags associated with the open message queue "
256 "description. This field is initialized when the queue is created by "
257 "B<mq_open>(3). The only flag that can appear in this field is "
262 #: build/C/man3/mq_getattr.3:94
264 "The I<mq_maxmsg> and I<mq_msgsize> fields are set when the message queue is "
265 "created by B<mq_open>(3). The I<mq_maxmsg> field is an upper limit on the "
266 "number of messages that may be placed on the queue using B<mq_send>(3). The "
267 "I<mq_msgsize> field is an upper limit on the size of messages that may be "
268 "placed on the queue. Both of these fields must have a value greater than "
269 "zero. Two I</proc> files that place ceilings on the values for these fields "
270 "are described in B<mq_overview>(7)."
274 #: build/C/man3/mq_getattr.3:98
276 "The I<mq_curmsgs> field returns the number of messages currently held in the "
281 #: build/C/man3/mq_getattr.3:118
283 "B<mq_setattr>() sets message queue attributes using information supplied in "
284 "the I<mq_attr> structure pointed to by I<newattr>. The only attribute that "
285 "can be modified is the setting of the B<O_NONBLOCK> flag in I<mq_flags>. "
286 "The other fields in I<newattr> are ignored. If the I<oldattr> field is not "
287 "NULL, then the buffer that it points to is used to return an I<mq_attr> "
288 "structure that contains the same information that is returned by "
293 #: build/C/man3/mq_getattr.3:126
295 "On success B<mq_getattr>() and B<mq_setattr>() return 0; on error, -1 is "
296 "returned, with I<errno> set to indicate the error."
300 #: build/C/man3/mq_getattr.3:132 build/C/man3/mq_notify.3:150 build/C/man3/mq_open.3:169 build/C/man3/mq_receive.3:138 build/C/man3/mq_send.3:143 build/C/man2/msgctl.2:285 build/C/man2/msgop.2:383 build/C/man2/msgop.2:439
306 #: build/C/man3/mq_getattr.3:137
307 msgid "I<newattr-E<gt>mq_flags> contained set bits other than B<O_NONBLOCK>."
311 #: build/C/man3/mq_getattr.3:144
312 msgid "The B<mq_getattr>() and B<mq_setattr>() functions are thread-safe."
316 #: build/C/man3/mq_getattr.3:154
318 "On Linux, B<mq_getattr>() and B<mq_setattr>() are library functions "
319 "layered on top of the B<mq_getsetattr>(2) system call."
323 #: build/C/man3/mq_getattr.3:154 build/C/man3/mq_notify.3:176 build/C/man7/mq_overview.7:366
329 #: build/C/man3/mq_getattr.3:165
331 "The program below can be used to show the default I<mq_maxmsg> and "
332 "I<mq_msgsize> values that are assigned to a message queue that is created "
333 "with a call to B<mq_open>(3) in which the I<attr> argument is NULL. Here "
334 "is an example run of the program:"
338 #: build/C/man3/mq_getattr.3:171
341 "$ B<./a.out /testq>\n"
342 "Maximum # of messages on queue: 10\n"
343 "Maximum message size: 8192\n"
347 #: build/C/man3/mq_getattr.3:179
349 "Since Linux 3.5, the following I</proc> files (described in "
350 "B<mq_overview>(7)) can be used to control the defaults:"
354 #: build/C/man3/mq_getattr.3:188
359 "$ B<cat /proc/sys/fs/mqueue/msg_default>\n"
361 "$ B<cat /proc/sys/fs/mqueue/msgsize_default>\n"
366 #: build/C/man3/mq_getattr.3:190 build/C/man3/mq_notify.3:182
368 msgid "Program source"
372 #: build/C/man3/mq_getattr.3:199
375 "#include E<lt>mqueue.hE<gt>\n"
376 "#include E<lt>sys/stat.hE<gt>\n"
377 "#include E<lt>fcntl.hE<gt>\n"
378 "#include E<lt>stdio.hE<gt>\n"
379 "#include E<lt>stdlib.hE<gt>\n"
380 "#include E<lt>unistd.hE<gt>\n"
384 #: build/C/man3/mq_getattr.3:202
387 "#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\e\n"
392 #: build/C/man3/mq_getattr.3:208
396 "main(int argc, char *argv[])\n"
399 " struct mq_attr attr;\n"
403 #: build/C/man3/mq_getattr.3:213
406 " if (argc != 2) {\n"
407 " fprintf(stderr, \"Usage: %s mq-name\\en\", argv[0]);\n"
408 " exit(EXIT_FAILURE);\n"
413 #: build/C/man3/mq_getattr.3:217
416 " mqd = mq_open(argv[1], O_CREAT | O_EXCL, S_IRUSR | S_IWUSR, NULL);\n"
417 " if (mqd == (mqd_t) -1)\n"
418 " errExit(\"mq_open\");\n"
422 #: build/C/man3/mq_getattr.3:220
425 " if (mq_getattr(mqd, &attr) == -1)\n"
426 " errExit(\"mq_getattr\");\n"
430 #: build/C/man3/mq_getattr.3:223
433 " printf(\"Maximum # of messages on queue: %ld\\en\", attr.mq_maxmsg);\n"
434 " printf(\"Maximum message size: %ld\\en\", "
435 "attr.mq_msgsize);\n"
439 #: build/C/man3/mq_getattr.3:226
442 " if (mq_unlink(argv[1]) == -1)\n"
443 " errExit(\"mq_unlink\");\n"
447 #: build/C/man3/mq_getattr.3:229
450 " exit(EXIT_SUCCESS);\n"
455 #: build/C/man3/mq_getattr.3:238
457 "B<mq_close>(3), B<mq_notify>(3), B<mq_open>(3), B<mq_receive>(3), "
458 "B<mq_send>(3), B<mq_unlink>(3), B<mq_overview>(7)"
462 #: build/C/man2/mq_getsetattr.2:26
464 msgid "MQ_GETSETATTR"
468 #: build/C/man2/mq_getsetattr.2:26
474 #: build/C/man2/mq_getsetattr.2:29
475 msgid "mq_getsetattr - get/set message queue attributes"
479 #: build/C/man2/mq_getsetattr.2:33
482 "B<#include E<lt>sys/types.hE<gt>>\n"
483 "B<#include E<lt>mqueue.hE<gt>>\n"
487 #: build/C/man2/mq_getsetattr.2:36
490 "B<int mq_getsetattr(mqd_t >I<mqdes>B<, struct mq_attr *>I<newattr>B<,>\n"
491 "B< struct mq_attr *>I<oldattr>B<);>\n"
495 #: build/C/man2/mq_getsetattr.2:40
496 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
500 #: build/C/man2/mq_getsetattr.2:42
501 msgid "Do not use this system call."
505 #: build/C/man2/mq_getsetattr.2:50
507 "This is the low-level system call used to implement B<mq_getattr>(3) and "
508 "B<mq_setattr>(3). For an explanation of how this system call operates, see "
509 "the description of B<mq_setattr>(3)."
513 #: build/C/man2/mq_getsetattr.2:52
514 msgid "This interface is nonstandard; avoid its use."
518 #: build/C/man2/mq_getsetattr.2:56
520 "Glibc does not provide a wrapper for this system call; call it using "
521 "B<syscall>(2). (Actually, never call it unless you are writing a C "
526 #: build/C/man2/mq_getsetattr.2:59
527 msgid "B<mq_getattr>(3), B<mq_overview>(7)"
531 #: build/C/man3/mq_notify.3:26
537 #: build/C/man3/mq_notify.3:26
543 #: build/C/man3/mq_notify.3:29
544 msgid "mq_notify - register for notification when a message is available"
548 #: build/C/man3/mq_notify.3:34
550 msgid "B<int mq_notify(mqd_t >I<mqdes>B<, const struct sigevent *>I<sevp>B<);>\n"
554 #: build/C/man3/mq_notify.3:43
556 "B<mq_notify>() allows the calling process to register or unregister for "
557 "delivery of an asynchronous notification when a new message arrives on the "
558 "empty message queue referred to by the descriptor I<mqdes>."
562 #: build/C/man3/mq_notify.3:51
564 "The I<sevp> argument is a pointer to a I<sigevent> structure. For the "
565 "definition and general details of this structure, see B<sigevent>(7)."
569 #: build/C/man3/mq_notify.3:65
571 "If I<sevp> is a non-null pointer, then B<mq_notify>() registers the calling "
572 "process to receive message notification. The I<sigev_notify> field of the "
573 "I<sigevent> structure to which I<sevp> points specifies how notification is "
574 "to be performed. This field has one of the following values:"
578 #: build/C/man3/mq_notify.3:65
580 msgid "B<SIGEV_NONE>"
583 #. When is SIGEV_NONE useful?
585 #: build/C/man3/mq_notify.3:70
587 "A \"null\" notification: the calling process is registered as the target for "
588 "notification, but when a message arrives, no notification is sent."
592 #: build/C/man3/mq_notify.3:70
594 msgid "B<SIGEV_SIGNAL>"
597 #. I don't know of other implementations that set
598 #. si_pid and si_uid -- MTK
600 #: build/C/man3/mq_notify.3:90
602 "Notify the process by sending the signal specified in I<sigev_signo>. See "
603 "B<sigevent>(7) for general details. The I<si_code> field of the "
604 "I<siginfo_t> structure will be set to B<SI_MESGQ>. In addition, I<si_pid> "
605 "will be set to the PID of the process that sent the message, and I<si_uid> "
606 "will be set to the real user ID of the sending process."
610 #: build/C/man3/mq_notify.3:90
612 msgid "B<SIGEV_THREAD>"
616 #: build/C/man3/mq_notify.3:98
618 "Upon message delivery, invoke I<sigev_notify_function> as if it were the "
619 "start function of a new thread. See B<sigevent>(7) for details."
623 #: build/C/man3/mq_notify.3:101
625 "Only one process can be registered to receive notification from a message "
630 #: build/C/man3/mq_notify.3:108
632 "If I<sevp> is NULL, and the calling process is currently registered to "
633 "receive notifications for this message queue, then the registration is "
634 "removed; another process can then register to receive a message notification "
639 #: build/C/man3/mq_notify.3:115
641 "Message notification occurs only when a new message arrives and the queue "
642 "was previously empty. If the queue was not empty at the time B<mq_notify>() "
643 "was called, then a notification will occur only after the queue is emptied "
644 "and a new message arrives."
648 #: build/C/man3/mq_notify.3:123
650 "If another process or thread is waiting to read a message from an empty "
651 "queue using B<mq_receive>(3), then any message notification registration is "
652 "ignored: the message is delivered to the process or thread calling "
653 "B<mq_receive>(3), and the message notification registration remains in "
658 #: build/C/man3/mq_notify.3:134
660 "Notification occurs once: after a notification is delivered, the "
661 "notification registration is removed, and another process can register for "
662 "message notification. If the notified process wishes to receive the next "
663 "notification, it can use B<mq_notify>() to request a further notification. "
664 "This should be done before emptying all unread messages from the queue. "
665 "(Placing the queue in nonblocking mode is useful for emptying the queue of "
666 "messages without blocking once it is empty.)"
670 #: build/C/man3/mq_notify.3:140
672 "On success B<mq_notify>() returns 0; on error, -1 is returned, with "
673 "I<errno> set to indicate the error."
677 #: build/C/man3/mq_notify.3:146
683 #: build/C/man3/mq_notify.3:150
685 "Another process has already registered to receive notification for this "
690 #: build/C/man3/mq_notify.3:160
692 "I<sevp-E<gt>sigev_notify> is not one of the permitted values; or "
693 "I<sevp-E<gt>sigev_notify> is B<SIGEV_SIGNAL> and I<sevp-E<gt>sigev_signo> is "
694 "not a valid signal number."
698 #: build/C/man3/mq_notify.3:160 build/C/man3/mq_open.3:227 build/C/man2/msgget.2:172 build/C/man2/msgop.2:394
704 #: build/C/man3/mq_notify.3:163 build/C/man3/mq_open.3:230
705 msgid "Insufficient memory."
708 #. Linux does not do this
710 #: build/C/man3/mq_notify.3:174
712 "POSIX.1-2008 says that an implementation I<may> generate an B<EINVAL> error "
713 "if I<sevp> is NULL, and the caller is not currently registered to receive "
714 "notifications for the queue I<mqdes>."
718 #: build/C/man3/mq_notify.3:182
720 "The following program registers a notification request for the message queue "
721 "named in its command-line argument. Notification is performed by creating a "
722 "thread. The thread executes a function which reads one message from the "
723 "queue and then terminates the process."
727 #: build/C/man3/mq_notify.3:189
730 "#include E<lt>pthread.hE<gt>\n"
731 "#include E<lt>mqueue.hE<gt>\n"
732 "#include E<lt>stdio.hE<gt>\n"
733 "#include E<lt>stdlib.hE<gt>\n"
734 "#include E<lt>unistd.hE<gt>\n"
738 #: build/C/man3/mq_notify.3:192
741 "#define handle_error(msg) \\e\n"
742 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
746 #: build/C/man3/mq_notify.3:200
749 "static void /* Thread start function */\n"
750 "tfunc(union sigval sv)\n"
752 " struct mq_attr attr;\n"
755 " mqd_t mqdes = *((mqd_t *) sv.sival_ptr);\n"
759 #: build/C/man3/mq_notify.3:202
761 msgid " /* Determine max. msg size; allocate buffer to receive msg */\n"
765 #: build/C/man3/mq_notify.3:208
768 " if (mq_getattr(mqdes, &attr) == -1)\n"
769 " handle_error(\"mq_getattr\");\n"
770 " buf = malloc(attr.mq_msgsize);\n"
771 " if (buf == NULL)\n"
772 " handle_error(\"malloc\");\n"
776 #: build/C/man3/mq_notify.3:212
779 " nr = mq_receive(mqdes, buf, attr.mq_msgsize, NULL);\n"
781 " handle_error(\"mq_receive\");\n"
785 #: build/C/man3/mq_notify.3:217
788 " printf(\"Read %zd bytes from MQ\\en\", nr);\n"
790 " exit(EXIT_SUCCESS); /* Terminate the process */\n"
795 #: build/C/man3/mq_notify.3:223
799 "main(int argc, char *argv[])\n"
802 " struct sigevent sev;\n"
806 #: build/C/man3/mq_notify.3:228
809 " if (argc != 2) {\n"
810 " fprintf(stderr, \"Usage: %s E<lt>mq-nameE<gt>\\en\", argv[0]);\n"
811 " exit(EXIT_FAILURE);\n"
816 #: build/C/man3/mq_notify.3:232
819 " mqdes = mq_open(argv[1], O_RDONLY);\n"
820 " if (mqdes == (mqd_t) -1)\n"
821 " handle_error(\"mq_open\");\n"
825 #: build/C/man3/mq_notify.3:239
828 " sev.sigev_notify = SIGEV_THREAD;\n"
829 " sev.sigev_notify_function = tfunc;\n"
830 " sev.sigev_notify_attributes = NULL;\n"
831 " sev.sigev_value.sival_ptr = &mqdes; /* Arg. to thread func. */\n"
832 " if (mq_notify(mqdes, &sev) == -1)\n"
833 " handle_error(\"mq_notify\");\n"
837 #: build/C/man3/mq_notify.3:242
840 " pause(); /* Process will be terminated by thread function */\n"
845 #: build/C/man3/mq_notify.3:252
847 "B<mq_close>(3), B<mq_getattr>(3), B<mq_open>(3), B<mq_receive>(3), "
848 "B<mq_send>(3), B<mq_unlink>(3), B<mq_overview>(7), B<sigevent>(7)"
852 #: build/C/man3/mq_open.3:26
858 #: build/C/man3/mq_open.3:26
864 #: build/C/man3/mq_open.3:29
865 msgid "mq_open - open a message queue"
869 #: build/C/man3/mq_open.3:34
872 "B<#include E<lt>fcntl.hE<gt>> /* For O_* constants */\n"
873 "B<#include E<lt>sys/stat.hE<gt>> /* For mode constants */\n"
874 "B<#include E<lt>mqueue.hE<gt>>\n"
878 #: build/C/man3/mq_open.3:38
881 "B<mqd_t mq_open(const char *>I<name>B<, int >I<oflag>B<);>\n"
882 "B<mqd_t mq_open(const char *>I<name>B<, int >I<oflag>B<, mode_t "
884 "B< struct mq_attr *>I<attr>B<);>\n"
888 #: build/C/man3/mq_open.3:50
890 "B<mq_open>() creates a new POSIX message queue or opens an existing queue. "
891 "The queue is identified by I<name>. For details of the construction of "
892 "I<name>, see B<mq_overview>(7)."
896 #: build/C/man3/mq_open.3:58
898 "The I<oflag> argument specifies flags that control the operation of the "
899 "call. (Definitions of the flags values can be obtained by including "
900 "I<E<lt>fcntl.hE<gt>>.) Exactly one of the following must be specified in "
905 #: build/C/man3/mq_open.3:58
911 #: build/C/man3/mq_open.3:61
912 msgid "Open the queue to receive messages only."
916 #: build/C/man3/mq_open.3:61
922 #: build/C/man3/mq_open.3:64
923 msgid "Open the queue to send messages only."
927 #: build/C/man3/mq_open.3:64
933 #: build/C/man3/mq_open.3:67
934 msgid "Open the queue to both send and receive messages."
938 #: build/C/man3/mq_open.3:72
939 msgid "Zero or more of the following flags can additionally be I<OR>ed in I<oflag>:"
943 #: build/C/man3/mq_open.3:72
945 msgid "B<O_CLOEXEC> (since Linux 2.6.26)"
948 #. commit 269f21344b23e552c21c9e2d7ca258479dcd7a0a
950 #: build/C/man3/mq_open.3:79
952 "Set the close-on-exec flag for the message queue descriptor. See B<open>(2) "
953 "for a discussion of why this flag is useful."
957 #: build/C/man3/mq_open.3:79
962 #. In reality the filesystem IDs are used on Linux.
964 #: build/C/man3/mq_open.3:87
966 "Create the message queue if it does not exist. The owner (user ID) of the "
967 "message queue is set to the effective user ID of the calling process. The "
968 "group ownership (group ID) is set to the effective group ID of the calling "
973 #: build/C/man3/mq_open.3:87
979 #: build/C/man3/mq_open.3:97
981 "If B<O_CREAT> was specified in I<oflag>, and a queue with the given I<name> "
982 "already exists, then fail with the error B<EEXIST>."
986 #: build/C/man3/mq_open.3:97
988 msgid "B<O_NONBLOCK>"
992 #: build/C/man3/mq_open.3:106
994 "Open the queue in nonblocking mode. In circumstances where B<mq_receive>(3) "
995 "and B<mq_send>(3) would normally block, these functions instead fail with "
996 "the error B<EAGAIN>."
1000 #: build/C/man3/mq_open.3:120
1002 "If B<O_CREAT> is specified in I<oflag>, then two additional arguments must "
1003 "be supplied. The I<mode> argument specifies the permissions to be placed on "
1004 "the new queue, as for B<open>(2). (Symbolic definitions for the permissions "
1005 "bits can be obtained by including I<E<lt>sys/stat.hE<gt>>.) The permissions "
1006 "settings are masked against the process umask."
1010 #: build/C/man3/mq_open.3:136
1012 "The I<attr> argument specifies attributes for the queue. See "
1013 "B<mq_getattr>(3) for details. If I<attr> is NULL, then the queue is "
1014 "created with implementation-defined default attributes. Since Linux 3.5, "
1015 "two I</proc> files can be used to control these defaults; see "
1016 "B<mq_overview>(7) for details."
1020 #: build/C/man3/mq_open.3:148
1022 "On success, B<mq_open>() returns a message queue descriptor for use by "
1023 "other message queue functions. On error, B<mq_open>() returns I<(mqd_t)\\ "
1024 "-1>, with I<errno> set to indicate the error."
1028 #: build/C/man3/mq_open.3:149 build/C/man3/mq_open.3:153 build/C/man3/mq_unlink.3:51 build/C/man2/msgctl.2:258 build/C/man2/msgget.2:147 build/C/man2/msgop.2:358 build/C/man2/msgop.2:413
1034 #: build/C/man3/mq_open.3:153
1036 "The queue exists, but the caller does not have permission to open it in the "
1040 #. Note that this isn't consistent with the same case for sem_open()
1042 #: build/C/man3/mq_open.3:158
1043 msgid "I<name> contained more than one slash."
1047 #: build/C/man3/mq_open.3:158 build/C/man2/msgget.2:155
1053 #: build/C/man3/mq_open.3:169
1055 "Both B<O_CREAT> and B<O_EXCL> were specified in I<oflag>, but a queue with "
1056 "this I<name> already exists."
1060 #: build/C/man3/mq_open.3:201
1062 "B<O_CREAT> was specified in I<oflag>, and I<attr> was not NULL, but "
1063 "I<attr-E<gt>mq_maxmsg> or I<attr-E<gt>mq_msqsize> was invalid. Both of "
1064 "these fields must be greater than zero. In a process that is unprivileged "
1065 "(does not have the B<CAP_SYS_RESOURCE> capability), I<attr-E<gt>mq_maxmsg> "
1066 "must be less than or equal to the I<msg_max> limit, and "
1067 "I<attr-E<gt>mq_msgsize> must be less than or equal to the I<msgsize_max> "
1068 "limit. In addition, even in a privileged process, I<attr-E<gt>mq_maxmsg> "
1069 "cannot exceed the B<HARD_MAX> limit. (See B<mq_overview>(7) for details of "
1074 #: build/C/man3/mq_open.3:201
1080 #: build/C/man3/mq_open.3:205
1081 msgid "The process already has the maximum number of files and message queues open."
1085 #: build/C/man3/mq_open.3:205 build/C/man3/mq_unlink.3:54
1087 msgid "B<ENAMETOOLONG>"
1091 #: build/C/man3/mq_open.3:209 build/C/man3/mq_unlink.3:58
1092 msgid "I<name> was too long."
1096 #: build/C/man3/mq_open.3:209
1102 #: build/C/man3/mq_open.3:213
1104 "The system limit on the total number of open files and message queues has "
1109 #: build/C/man3/mq_open.3:213 build/C/man3/mq_open.3:222 build/C/man3/mq_unlink.3:58 build/C/man2/msgget.2:164
1115 #: build/C/man3/mq_open.3:222
1117 "The B<O_CREAT> flag was not specified in I<oflag>, and no queue with this "
1121 #. Note that this isn't consistent with the same case for sem_open()
1123 #: build/C/man3/mq_open.3:227
1124 msgid "I<name> was just \"/\" followed by no other characters."
1128 #: build/C/man3/mq_open.3:230 build/C/man2/msgget.2:176
1134 #: build/C/man3/mq_open.3:237
1136 "Insufficient space for the creation of a new message queue. This probably "
1137 "occurred because the I<queues_max> limit was encountered; see "
1138 "B<mq_overview>(7)."
1142 #: build/C/man3/mq_open.3:242
1143 msgid "The B<mq_open>() function is thread-safe."
1147 #: build/C/man3/mq_open.3:244 build/C/man7/mq_overview.7:369 build/C/man2/msgget.2:223 build/C/man2/msgop.2:543
1153 #: build/C/man3/mq_open.3:248
1155 "In kernels before 2.6.14, the process umask was not applied to the "
1156 "permissions specified in I<mode>."
1160 #: build/C/man3/mq_open.3:256
1162 "B<mq_close>(3), B<mq_getattr>(3), B<mq_notify>(3), B<mq_receive>(3), "
1163 "B<mq_send>(3), B<mq_unlink>(3), B<mq_overview>(7)"
1167 #: build/C/man7/mq_overview.7:26
1173 #: build/C/man7/mq_overview.7:26
1179 #: build/C/man7/mq_overview.7:29
1180 msgid "mq_overview - overview of POSIX message queues"
1184 #: build/C/man7/mq_overview.7:37
1186 "POSIX message queues allow processes to exchange data in the form of "
1187 "messages. This API is distinct from that provided by System V message "
1188 "queues (B<msgget>(2), B<msgsnd>(2), B<msgrcv>(2), etc.), but provides "
1189 "similar functionality."
1193 #: build/C/man7/mq_overview.7:52
1195 "Message queues are created and opened using B<mq_open>(3); this function "
1196 "returns a I<message queue descriptor> (I<mqd_t>), which is used to refer to "
1197 "the open message queue in later calls. Each message queue is identified by "
1198 "a name of the form I</somename>; that is, a null-terminated string of up to "
1199 "B<NAME_MAX> (i.e., 255) characters consisting of an initial slash, followed "
1200 "by one or more characters, none of which are slashes. Two processes can "
1201 "operate on the same queue by passing the same name to B<mq_open>(3)."
1205 #: build/C/man7/mq_overview.7:68
1207 "Messages are transferred to and from a queue using B<mq_send>(3) and "
1208 "B<mq_receive>(3). When a process has finished using the queue, it closes it "
1209 "using B<mq_close>(3), and when the queue is no longer required, it can be "
1210 "deleted using B<mq_unlink>(3). Queue attributes can be retrieved and (in "
1211 "some cases) modified using B<mq_getattr>(3) and B<mq_setattr>(3). A "
1212 "process can request asynchronous notification of the arrival of a message on "
1213 "a previously empty queue using B<mq_notify>(3)."
1217 #: build/C/man7/mq_overview.7:81
1219 "A message queue descriptor is a reference to an I<open message queue "
1220 "description> (cf. B<open>(2)). After a B<fork>(2), a child inherits copies "
1221 "of its parent's message queue descriptors, and these descriptors refer to "
1222 "the same open message queue descriptions as the corresponding descriptors in "
1223 "the parent. Corresponding descriptors in the two processes share the flags "
1224 "(I<mq_flags>) that are associated with the open message queue description."
1228 #: build/C/man7/mq_overview.7:94
1230 "Each message has an associated I<priority>, and messages are always "
1231 "delivered to the receiving process highest priority first. Message "
1232 "priorities range from 0 (low) to I<sysconf(_SC_MQ_PRIO_MAX)\\ -\\ 1> "
1233 "(high). On Linux, I<sysconf(_SC_MQ_PRIO_MAX)> returns 32768, but "
1234 "POSIX.1-2001 requires only that an implementation support at least "
1235 "priorities in the range 0 to 31; some implementations provide only this "
1240 #: build/C/man7/mq_overview.7:97
1242 "The remainder of this section describes some specific details of the Linux "
1243 "implementation of POSIX message queues."
1247 #: build/C/man7/mq_overview.7:97
1249 msgid "Library interfaces and system calls"
1253 #: build/C/man7/mq_overview.7:103
1255 "In most cases the B<mq_*>() library interfaces listed above are implemented "
1256 "on top of underlying system calls of the same name. Deviations from this "
1257 "scheme are indicated in the following table:"
1261 #: build/C/man7/mq_overview.7:107
1263 msgid "Library interface\tSystem call\n"
1267 #: build/C/man7/mq_overview.7:108
1269 msgid "mq_close(3)\tclose(2)\n"
1273 #: build/C/man7/mq_overview.7:109
1275 msgid "mq_getattr(3)\tmq_getsetattr(2)\n"
1279 #: build/C/man7/mq_overview.7:110
1281 msgid "mq_notify(3)\tmq_notify(2)\n"
1285 #: build/C/man7/mq_overview.7:111
1287 msgid "mq_open(3)\tmq_open(2)\n"
1291 #: build/C/man7/mq_overview.7:112
1293 msgid "mq_receive(3)\tmq_timedreceive(2)\n"
1297 #: build/C/man7/mq_overview.7:113
1299 msgid "mq_send(3)\tmq_timedsend(2)\n"
1303 #: build/C/man7/mq_overview.7:114
1305 msgid "mq_setattr(3)\tmq_getsetattr(2)\n"
1309 #: build/C/man7/mq_overview.7:115
1311 msgid "mq_timedreceive(3)\tmq_timedreceive(2)\n"
1315 #: build/C/man7/mq_overview.7:116
1317 msgid "mq_timedsend(3)\tmq_timedsend(2)\n"
1321 #: build/C/man7/mq_overview.7:117
1323 msgid "mq_unlink(3)\tmq_unlink(2)\n"
1327 #: build/C/man7/mq_overview.7:120
1333 #: build/C/man7/mq_overview.7:123
1335 "POSIX message queues have been supported on Linux since kernel 2.6.6. Glibc "
1336 "support has been provided since version 2.3.4."
1340 #: build/C/man7/mq_overview.7:123
1342 msgid "Kernel configuration"
1346 #: build/C/man7/mq_overview.7:128
1348 "Support for POSIX message queues is configurable via the "
1349 "B<CONFIG_POSIX_MQUEUE> kernel configuration option. This option is enabled "
1354 #: build/C/man7/mq_overview.7:128
1360 #: build/C/man7/mq_overview.7:133
1362 "POSIX message queues have kernel persistence: if not removed by "
1363 "B<mq_unlink>(3), a message queue will exist until the system is shut down."
1367 #: build/C/man7/mq_overview.7:133
1373 #: build/C/man7/mq_overview.7:138
1375 "Programs using the POSIX message queue API must be compiled with I<cc -lrt> "
1376 "to link against the real-time library, I<librt>."
1380 #: build/C/man7/mq_overview.7:138
1382 msgid "/proc interfaces"
1386 #: build/C/man7/mq_overview.7:142
1388 "The following interfaces can be used to limit the amount of kernel memory "
1389 "consumed by POSIX message queues and to set the default attributes for new "
1394 #: build/C/man7/mq_overview.7:142
1396 msgid "I</proc/sys/fs/mqueue/msg_default> (since Linux 3.5)"
1400 #: build/C/man7/mq_overview.7:166
1402 "This file defines the value used for a new queue's I<mq_maxmsg> setting when "
1403 "the queue is created with a call to B<mq_open>(3) where I<attr> is "
1404 "specified as NULL. The default value for this file is 10. The minimum and "
1405 "maximum are as for I</proc/sys/fs/mqueue/msg_max>. A new queue's default "
1406 "I<mq_maxmsg> value will be the smaller of I<msg_default> and I<msg_max>. Up "
1407 "until Linux 2.6.28, the default I<mq_maxmsg> was 10; from Linux 2.6.28 to "
1408 "Linux 3.4, the default was the value defined for the I<msg_max> limit."
1412 #: build/C/man7/mq_overview.7:166
1414 msgid "I</proc/sys/fs/mqueue/msg_max>"
1418 #: build/C/man7/mq_overview.7:187
1420 "This file can be used to view and change the ceiling value for the maximum "
1421 "number of messages in a queue. This value acts as a ceiling on the "
1422 "I<attr-E<gt>mq_maxmsg> argument given to B<mq_open>(3). The default value "
1423 "for I<msg_max> is 10. The minimum value is 1 (10 in kernels before "
1424 "2.6.28). The upper limit is B<HARD_MSGMAX>. The I<msg_max> limit is "
1425 "ignored for privileged processes (B<CAP_SYS_RESOURCE>), but the "
1426 "B<HARD_MSGMAX> ceiling is nevertheless imposed."
1430 #: build/C/man7/mq_overview.7:191
1431 msgid "The definition of B<HARD_MSGMAX> has changed across kernel versions:"
1435 #: build/C/man7/mq_overview.7:192 build/C/man7/mq_overview.7:195 build/C/man7/mq_overview.7:198 build/C/man7/mq_overview.7:246 build/C/man7/mq_overview.7:249 build/C/man7/mq_overview.7:251 build/C/man2/msgop.2:118 build/C/man2/msgop.2:123 build/C/man2/msgop.2:147 build/C/man2/msgop.2:154 build/C/man2/msgop.2:221 build/C/man2/msgop.2:226 build/C/man2/msgop.2:240 build/C/man2/msgop.2:308 build/C/man2/msgop.2:310 build/C/man2/msgop.2:316
1441 #: build/C/man7/mq_overview.7:195
1442 msgid "Up to Linux 2.6.32: I<131072\\ /\\ sizeof(void\\ *)>"
1446 #: build/C/man7/mq_overview.7:198
1447 msgid "Linux 2.6.33 to 3.4: I<(32768\\ *\\ sizeof(void\\ *) / 4)>"
1450 #. commit 5b5c4d1a1440e94994c73dddbad7be0676cd8b9a
1452 #: build/C/man7/mq_overview.7:202
1453 msgid "Since Linux 3.5: 65,536"
1457 #: build/C/man7/mq_overview.7:203
1459 msgid "I</proc/sys/fs/mqueue/msgsize_default> (since Linux 3.5)"
1463 #: build/C/man7/mq_overview.7:230
1465 "This file defines the value used for a new queue's I<mq_msgsize> setting "
1466 "when the queue is created with a call to B<mq_open>(3) where I<attr> is "
1467 "specified as NULL. The default value for this file is 8192 (bytes). The "
1468 "minimum and maximum are as for I</proc/sys/fs/mqueue/msgsize_max>. If "
1469 "I<msgsize_default> exceeds I<msgsize_max>, a new queue's default "
1470 "I<mq_msgsize> value is capped to the I<msgsize_max> limit. Up until Linux "
1471 "2.6.28, the default I<mq_msgsize> was 8192; from Linux 2.6.28 to Linux 3.4, "
1472 "the default was the value defined for the I<msgsize_max> limit."
1476 #: build/C/man7/mq_overview.7:230
1478 msgid "I</proc/sys/fs/mqueue/msgsize_max>"
1482 #: build/C/man7/mq_overview.7:245
1484 "This file can be used to view and change the ceiling on the maximum message "
1485 "size. This value acts as a ceiling on the I<attr-E<gt>mq_msgsize> argument "
1486 "given to B<mq_open>(3). The default value for I<msgsize_max> is 8192 "
1487 "bytes. The minimum value is 128 (8192 in kernels before 2.6.28). The upper "
1488 "limit for I<msgsize_max> has varied across kernel versions:"
1492 #: build/C/man7/mq_overview.7:249
1493 msgid "Before Linux 2.6.28, the upper limit is B<INT_MAX>."
1497 #: build/C/man7/mq_overview.7:251
1498 msgid "From Linux 2.6.28 to 3.4, the limit is 1,048,576."
1502 #: build/C/man7/mq_overview.7:254
1503 msgid "Since Linux 3.5, the limit is 16,777,216 (B<HARD_MSGSIZEMAX>)."
1507 #: build/C/man7/mq_overview.7:263
1509 "The I<msgsize_max> limit is ignored for privileged process "
1510 "(B<CAP_SYS_RESOURCE>), but, since Linux 3.5, the B<HARD_MSGSIZEMAX> ceiling "
1511 "is enforced for privileged processes."
1515 #: build/C/man7/mq_overview.7:263
1517 msgid "I</proc/sys/fs/mqueue/queues_max>"
1521 #: build/C/man7/mq_overview.7:275
1523 "This file can be used to view and change the system-wide limit on the number "
1524 "of message queues that can be created. The default value for I<queues_max> "
1525 "is 256. No ceiling is imposed on the I<queues_max> limit; privileged "
1526 "processes (B<CAP_SYS_RESOURCE>) can exceed the limit (but see BUGS)."
1530 #: build/C/man7/mq_overview.7:275
1532 msgid "Resource limit"
1536 #: build/C/man7/mq_overview.7:282
1538 "The B<RLIMIT_MSGQUEUE> resource limit, which places a limit on the amount of "
1539 "space that can be consumed by all of the message queues belonging to a "
1540 "process's real user ID, is described in B<getrlimit>(2)."
1544 #: build/C/man7/mq_overview.7:282
1546 msgid "Mounting the message queue filesystem"
1550 #: build/C/man7/mq_overview.7:288
1552 "On Linux, message queues are created in a virtual filesystem. (Other "
1553 "implementations may also provide such a feature, but the details are likely "
1554 "to differ.) This filesystem can be mounted (by the superuser) using the "
1555 "following commands:"
1559 #: build/C/man7/mq_overview.7:293
1562 "#B< mkdir /dev/mqueue>\n"
1563 "#B< mount -t mqueue none /dev/mqueue>\n"
1567 #: build/C/man7/mq_overview.7:297
1568 msgid "The sticky bit is automatically enabled on the mount directory."
1572 #: build/C/man7/mq_overview.7:304
1574 "After the filesystem has been mounted, the message queues on the system can "
1575 "be viewed and manipulated using the commands usually used for files (e.g., "
1576 "B<ls>(1) and B<rm>(1))."
1580 #: build/C/man7/mq_overview.7:307
1582 "The contents of each file in the directory consist of a single line "
1583 "containing information about the queue:"
1587 #: build/C/man7/mq_overview.7:312
1590 "$B< cat /dev/mqueue/mymq>\n"
1591 "QSIZE:129 NOTIFY:2 SIGNO:0 NOTIFY_PID:8260\n"
1595 #: build/C/man7/mq_overview.7:316
1596 msgid "These fields are as follows:"
1600 #: build/C/man7/mq_overview.7:316
1606 #: build/C/man7/mq_overview.7:319
1607 msgid "Number of bytes of data in all messages in the queue."
1611 #: build/C/man7/mq_overview.7:319
1613 msgid "B<NOTIFY_PID>"
1617 #: build/C/man7/mq_overview.7:325
1619 "If this is nonzero, then the process with this PID has used B<mq_notify>(3) "
1620 "to register for asynchronous message notification, and the remaining fields "
1621 "describe how notification occurs."
1625 #: build/C/man7/mq_overview.7:325
1631 #: build/C/man7/mq_overview.7:335
1633 "Notification method: 0 is B<SIGEV_SIGNAL>; 1 is B<SIGEV_NONE>; and 2 is "
1638 #: build/C/man7/mq_overview.7:335
1644 #: build/C/man7/mq_overview.7:339
1645 msgid "Signal number to be used for B<SIGEV_SIGNAL>."
1649 #: build/C/man7/mq_overview.7:339
1651 msgid "Polling message queue descriptors"
1655 #: build/C/man7/mq_overview.7:347
1657 "On Linux, a message queue descriptor is actually a file descriptor, and can "
1658 "be monitored using B<select>(2), B<poll>(2), or B<epoll>(7). This is not "
1663 #: build/C/man7/mq_overview.7:347
1665 msgid "IPC namespaces"
1669 #: build/C/man7/mq_overview.7:351
1671 "For a discussion of the interaction of System V IPC objects and IPC "
1672 "namespaces, see B<namespaces>(7)."
1676 #: build/C/man7/mq_overview.7:363
1678 "System V message queues (B<msgget>(2), B<msgsnd>(2), B<msgrcv>(2), etc.) are "
1679 "an older API for exchanging messages between processes. POSIX message "
1680 "queues provide a better designed interface than System V message queues; on "
1681 "the other hand POSIX message queues are less widely available (especially on "
1682 "older systems) than System V message queues."
1686 #: build/C/man7/mq_overview.7:366
1688 "Linux does not currently (2.6.26) support the use of access control lists "
1689 "(ACLs) for POSIX message queues."
1693 #: build/C/man7/mq_overview.7:369
1695 "An example of the use of various message queue functions is shown in "
1700 #: build/C/man7/mq_overview.7:378
1702 "In Linux versions 3.5 to 3.14, the kernel imposed a ceiling of 1024 "
1703 "(B<HARD_QUEUESMAX>) on the value to which the I<queues_max> limit could be "
1704 "raised, and the ceiling was enforced even for privileged processes. This "
1705 "ceiling value was removed in Linux 3.14, and patches to stable kernels 3.5.x "
1706 "to 3.13.x also removed the ceiling."
1710 #: build/C/man7/mq_overview.7:392
1712 "B<getrlimit>(2), B<mq_getsetattr>(2), B<poll>(2), B<select>(2), "
1713 "B<mq_close>(3), B<mq_getattr>(3), B<mq_notify>(3), B<mq_open>(3), "
1714 "B<mq_receive>(3), B<mq_send>(3), B<mq_unlink>(3), B<epoll>(7), "
1719 #: build/C/man3/mq_receive.3:26
1725 #: build/C/man3/mq_receive.3:26 build/C/man3/mq_send.3:26
1731 #: build/C/man3/mq_receive.3:29
1732 msgid "mq_receive, mq_timedreceive - receive a message from a message queue"
1736 #: build/C/man3/mq_receive.3:35
1739 "B<ssize_t mq_receive(mqd_t >I<mqdes>B<, char *>I<msg_ptr>B<,>\n"
1740 "B< size_t >I<msg_len>B<, unsigned int *>I<msg_prio>B<);>\n"
1744 #: build/C/man3/mq_receive.3:38 build/C/man3/mq_send.3:38
1747 "B<#include E<lt>time.hE<gt>>\n"
1748 "B<#include E<lt>mqueue.hE<gt>>\n"
1752 #: build/C/man3/mq_receive.3:42
1755 "B<ssize_t mq_timedreceive(mqd_t >I<mqdes>B<, char *>I<msg_ptr>B<,>\n"
1756 "B< size_t >I<msg_len>B<, unsigned int *>I<msg_prio>B<,>\n"
1757 "B< const struct timespec *>I<abs_timeout>B<);>\n"
1761 #: build/C/man3/mq_receive.3:50 build/C/man3/mq_send.3:50
1762 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
1766 #: build/C/man3/mq_receive.3:53
1767 msgid "B<mq_timedreceive>():"
1771 #: build/C/man3/mq_receive.3:55 build/C/man3/mq_send.3:55
1772 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 600 || _POSIX_C_SOURCE\\ E<gt>=\\ 200112L"
1776 #: build/C/man3/mq_receive.3:76
1778 "B<mq_receive>() removes the oldest message with the highest priority from "
1779 "the message queue referred to by the descriptor I<mqdes>, and places it in "
1780 "the buffer pointed to by I<msg_ptr>. The I<msg_len> argument specifies the "
1781 "size of the buffer pointed to by I<msg_ptr>; this must be greater than or "
1782 "equal to the I<mq_msgsize> attribute of the queue (see B<mq_getattr>(3)). "
1783 "If I<msg_prio> is not NULL, then the buffer to which it points is used to "
1784 "return the priority associated with the received message."
1788 #: build/C/man3/mq_receive.3:86
1790 "If the queue is empty, then, by default, B<mq_receive>() blocks until a "
1791 "message becomes available, or the call is interrupted by a signal handler. "
1792 "If the B<O_NONBLOCK> flag is enabled for the message queue description, then "
1793 "the call instead fails immediately with the error B<EAGAIN>."
1797 #: build/C/man3/mq_receive.3:99
1799 "B<mq_timedreceive>() behaves just like B<mq_receive>(), except that if the "
1800 "queue is empty and the B<O_NONBLOCK> flag is not enabled for the message "
1801 "queue description, then I<abs_timeout> points to a structure which specifies "
1802 "a ceiling on the time for which the call will block. This ceiling is an "
1803 "absolute timeout in seconds and nanoseconds since the Epoch, 1970-01-01 "
1804 "00:00:00 +0000 (UTC), and it is specified in the following structure:"
1808 #: build/C/man3/mq_receive.3:106 build/C/man3/mq_send.3:112
1811 "struct timespec {\n"
1812 " time_t tv_sec; /* seconds */\n"
1813 " long tv_nsec; /* nanoseconds */\n"
1818 #: build/C/man3/mq_receive.3:113
1820 "If no message is available, and the timeout has already expired by the time "
1821 "of the call, B<mq_timedreceive>() returns immediately."
1825 #: build/C/man3/mq_receive.3:122
1827 "On success, B<mq_receive>() and B<mq_timedreceive>() return the number of "
1828 "bytes in the received message; on error, -1 is returned, with I<errno> set "
1829 "to indicate the error."
1833 #: build/C/man3/mq_receive.3:123 build/C/man3/mq_send.3:128 build/C/man2/msgop.2:364 build/C/man2/msgop.2:419
1839 #: build/C/man3/mq_receive.3:129
1841 "The queue was empty, and the B<O_NONBLOCK> flag was set for the message "
1842 "queue description referred to by I<mqdes>."
1846 #: build/C/man3/mq_receive.3:134 build/C/man3/mq_send.3:139
1847 msgid "The descriptor specified in I<mqdes> was invalid."
1851 #: build/C/man3/mq_receive.3:134 build/C/man3/mq_send.3:139 build/C/man2/msgop.2:380 build/C/man2/msgop.2:434
1857 #: build/C/man3/mq_receive.3:138 build/C/man3/mq_send.3:143
1858 msgid "The call was interrupted by a signal handler; see B<signal>(7)."
1862 #: build/C/man3/mq_receive.3:147 build/C/man3/mq_send.3:152
1864 "The call would have blocked, and I<abs_timeout> was invalid, either because "
1865 "I<tv_sec> was less than zero, or because I<tv_nsec> was less than zero or "
1866 "greater than 1000 million."
1870 #: build/C/man3/mq_receive.3:147 build/C/man3/mq_send.3:152
1876 #: build/C/man3/mq_receive.3:153
1877 msgid "I<msg_len> was less than the I<mq_msgsize> attribute of the message queue."
1881 #: build/C/man3/mq_receive.3:153 build/C/man3/mq_send.3:158
1883 msgid "B<ETIMEDOUT>"
1887 #: build/C/man3/mq_receive.3:156 build/C/man3/mq_send.3:161
1888 msgid "The call timed out before a message could be transferred."
1892 #: build/C/man3/mq_receive.3:163
1893 msgid "The B<mq_receive>() and B<mq_timedreceive>() functions are thread-safe."
1897 #: build/C/man3/mq_receive.3:171
1899 "On Linux, B<mq_timedreceive>() is a system call, and B<mq_receive>() is a "
1900 "library function layered on top of that system call."
1904 #: build/C/man3/mq_receive.3:180
1906 "B<mq_close>(3), B<mq_getattr>(3), B<mq_notify>(3), B<mq_open>(3), "
1907 "B<mq_send>(3), B<mq_unlink>(3), B<mq_overview>(7), B<time>(7)"
1911 #: build/C/man3/mq_send.3:26
1917 #: build/C/man3/mq_send.3:29
1918 msgid "mq_send, mq_timedsend - send a message to a message queue"
1922 #: build/C/man3/mq_send.3:35
1925 "B<int mq_send(mqd_t >I<mqdes>B<, const char *>I<msg_ptr>B<,>\n"
1926 "B< size_t >I<msg_len>B<, unsigned int >I<msg_prio>B<);>\n"
1930 #: build/C/man3/mq_send.3:42
1933 "B<int mq_timedsend(mqd_t >I<mqdes>B<, const char *>I<msg_ptr>B<,>\n"
1934 "B< size_t >I<msg_len>B<, unsigned int >I<msg_prio>B<,>\n"
1935 "B< const struct timespec *>I<abs_timeout>B<);>\n"
1939 #: build/C/man3/mq_send.3:53
1940 msgid "B<mq_timedsend>():"
1944 #: build/C/man3/mq_send.3:71
1946 "B<mq_send>() adds the message pointed to by I<msg_ptr> to the message queue "
1947 "referred to by the descriptor I<mqdes>. The I<msg_len> argument specifies "
1948 "the length of the message pointed to by I<msg_ptr>; this length must be less "
1949 "than or equal to the queue's I<mq_msgsize> attribute. Zero-length messages "
1954 #: build/C/man3/mq_send.3:79
1956 "The I<msg_prio> argument is a nonnegative integer that specifies the "
1957 "priority of this message. Messages are placed on the queue in decreasing "
1958 "order of priority, with newer messages of the same priority being placed "
1959 "after older messages with the same priority."
1963 #: build/C/man3/mq_send.3:92
1965 "If the message queue is already full (i.e., the number of messages on the "
1966 "queue equals the queue's I<mq_maxmsg> attribute), then, by default, "
1967 "B<mq_send>() blocks until sufficient space becomes available to allow the "
1968 "message to be queued, or until the call is interrupted by a signal handler. "
1969 "If the B<O_NONBLOCK> flag is enabled for the message queue description, then "
1970 "the call instead fails immediately with the error B<EAGAIN>."
1974 #: build/C/man3/mq_send.3:105
1976 "B<mq_timedsend>() behaves just like B<mq_send>(), except that if the queue "
1977 "is full and the B<O_NONBLOCK> flag is not enabled for the message queue "
1978 "description, then I<abs_timeout> points to a structure which specifies a "
1979 "ceiling on the time for which the call will block. This ceiling is an "
1980 "absolute timeout in seconds and nanoseconds since the Epoch, 1970-01-01 "
1981 "00:00:00 +0000 (UTC), and it is specified in the following structure:"
1985 #: build/C/man3/mq_send.3:119
1987 "If the message queue is full, and the timeout has already expired by the "
1988 "time of the call, B<mq_timedsend>() returns immediately."
1992 #: build/C/man3/mq_send.3:127
1994 "On success, B<mq_send>() and B<mq_timedsend>() return zero; on error, -1 "
1995 "is returned, with I<errno> set to indicate the error."
1999 #: build/C/man3/mq_send.3:134
2001 "The queue was full, and the B<O_NONBLOCK> flag was set for the message queue "
2002 "description referred to by I<mqdes>."
2006 #: build/C/man3/mq_send.3:158
2008 "I<msg_len> was greater than the I<mq_msgsize> attribute of the message "
2013 #: build/C/man3/mq_send.3:168
2014 msgid "The B<mq_send>() and B<mq_timedsend>() functions are thread-safe."
2018 #: build/C/man3/mq_send.3:176
2020 "On Linux, B<mq_timedsend>() is a system call, and B<mq_send>() is a "
2021 "library function layered on top of that system call."
2025 #: build/C/man3/mq_send.3:185
2027 "B<mq_close>(3), B<mq_getattr>(3), B<mq_notify>(3), B<mq_open>(3), "
2028 "B<mq_receive>(3), B<mq_unlink>(3), B<mq_overview>(7), B<time>(7)"
2032 #: build/C/man3/mq_unlink.3:26
2038 #: build/C/man3/mq_unlink.3:29
2039 msgid "mq_unlink - remove a message queue"
2043 #: build/C/man3/mq_unlink.3:34
2045 msgid "B<int mq_unlink(const char *>I<name>B<);>\n"
2049 #: build/C/man3/mq_unlink.3:44
2051 "B<mq_unlink>() removes the specified message queue I<name>. The message "
2052 "queue name is removed immediately. The queue itself is destroyed once any "
2053 "other processes that have the queue open close their descriptors referring "
2058 #: build/C/man3/mq_unlink.3:50
2060 "On success B<mq_unlink>() returns 0; on error, -1 is returned, with "
2061 "I<errno> set to indicate the error."
2065 #: build/C/man3/mq_unlink.3:54
2066 msgid "The caller does not have permission to unlink this message queue."
2070 #: build/C/man3/mq_unlink.3:62
2071 msgid "There is no message queue with the given I<name>."
2075 #: build/C/man3/mq_unlink.3:67
2076 msgid "The B<mq_unlink>() function is thread-safe."
2080 #: build/C/man3/mq_unlink.3:77
2082 "B<mq_close>(3), B<mq_getattr>(3), B<mq_notify>(3), B<mq_open>(3), "
2083 "B<mq_receive>(3), B<mq_send>(3), B<mq_overview>(7)"
2087 #: build/C/man2/msgctl.2:37
2093 #: build/C/man2/msgctl.2:37
2099 #: build/C/man2/msgctl.2:40
2100 msgid "msgctl - System V message control operations"
2104 #: build/C/man2/msgctl.2:45 build/C/man2/msgget.2:43 build/C/man2/msgop.2:49
2107 "B<#include E<lt>sys/types.hE<gt>>\n"
2108 "B<#include E<lt>sys/ipc.hE<gt>>\n"
2109 "B<#include E<lt>sys/msg.hE<gt>>\n"
2113 #: build/C/man2/msgctl.2:47
2115 msgid "B<int msgctl(int >I<msqid>B<, int >I<cmd>B<, struct msqid_ds *>I<buf>B<);>\n"
2119 #: build/C/man2/msgctl.2:54
2121 "B<msgctl>() performs the control operation specified by I<cmd> on the "
2122 "System\\ V message queue with identifier I<msqid>."
2126 #: build/C/man2/msgctl.2:58
2128 "The I<msqid_ds> data structure is defined in I<E<lt>sys/msg.hE<gt>> as "
2133 #: build/C/man2/msgctl.2:75
2136 "struct msqid_ds {\n"
2137 " struct ipc_perm msg_perm; /* Ownership and permissions */\n"
2138 " time_t msg_stime; /* Time of last msgsnd(2) */\n"
2139 " time_t msg_rtime; /* Time of last msgrcv(2) */\n"
2140 " time_t msg_ctime; /* Time of last change */\n"
2141 " unsigned long __msg_cbytes; /* Current number of bytes in\n"
2142 " queue (nonstandard) */\n"
2143 " msgqnum_t msg_qnum; /* Current number of messages\n"
2145 " msglen_t msg_qbytes; /* Maximum number of bytes\n"
2146 " allowed in queue */\n"
2147 " pid_t msg_lspid; /* PID of last msgsnd(2) */\n"
2148 " pid_t msg_lrpid; /* PID of last msgrcv(2) */\n"
2153 #: build/C/man2/msgctl.2:83
2155 "The I<ipc_perm> structure is defined as follows (the highlighted fields are "
2156 "settable using B<IPC_SET>):"
2160 #: build/C/man2/msgctl.2:95
2163 "struct ipc_perm {\n"
2164 " key_t __key; /* Key supplied to msgget(2) */\n"
2165 " uid_t B<uid>; /* Effective UID of owner */\n"
2166 " gid_t B<gid>; /* Effective GID of owner */\n"
2167 " uid_t cuid; /* Effective UID of creator */\n"
2168 " gid_t cgid; /* Effective GID of creator */\n"
2169 " unsigned short B<mode>; /* Permissions */\n"
2170 " unsigned short __seq; /* Sequence number */\n"
2175 #: build/C/man2/msgctl.2:101
2176 msgid "Valid values for I<cmd> are:"
2180 #: build/C/man2/msgctl.2:101
2186 #: build/C/man2/msgctl.2:110
2188 "Copy information from the kernel data structure associated with I<msqid> "
2189 "into the I<msqid_ds> structure pointed to by I<buf>. The caller must have "
2190 "read permission on the message queue."
2194 #: build/C/man2/msgctl.2:110
2200 #: build/C/man2/msgctl.2:137
2202 "Write the values of some members of the I<msqid_ds> structure pointed to by "
2203 "I<buf> to the kernel data structure associated with this message queue, "
2204 "updating also its I<msg_ctime> member. The following members of the "
2205 "structure are updated: I<msg_qbytes>, I<msg_perm.uid>, I<msg_perm.gid>, and "
2206 "(the least significant 9 bits of) I<msg_perm.mode>. The effective UID of "
2207 "the calling process must match the owner (I<msg_perm.uid>) or creator "
2208 "(I<msg_perm.cuid>) of the message queue, or the caller must be privileged. "
2209 "Appropriate privilege (Linux: the B<CAP_SYS_RESOURCE> capability) is "
2210 "required to raise the I<msg_qbytes> value beyond the system parameter "
2215 #: build/C/man2/msgctl.2:137
2221 #: build/C/man2/msgctl.2:151
2223 "Immediately remove the message queue, awakening all waiting reader and "
2224 "writer processes (with an error return and I<errno> set to B<EIDRM>). The "
2225 "calling process must have appropriate privileges or its effective user ID "
2226 "must be either that of the creator or owner of the message queue. The third "
2227 "argument to B<msgctl>() is ignored in this case."
2231 #: build/C/man2/msgctl.2:151
2233 msgid "B<IPC_INFO> (Linux-specific)"
2237 #: build/C/man2/msgctl.2:164
2239 "Return information about system-wide message queue limits and parameters in "
2240 "the structure pointed to by I<buf>. This structure is of type I<msginfo> "
2241 "(thus, a cast is required), defined in I<E<lt>sys/msg.hE<gt>> if the "
2242 "B<_GNU_SOURCE> feature test macro is defined:"
2246 #: build/C/man2/msgctl.2:188
2249 "struct msginfo {\n"
2250 " int msgpool; /* Size in kibibytes of buffer pool\n"
2251 " used to hold message data;\n"
2252 " unused within kernel */\n"
2253 " int msgmap; /* Maximum number of entries in message\n"
2254 " map; unused within kernel */\n"
2255 " int msgmax; /* Maximum number of bytes that can be\n"
2256 " written in a single message */\n"
2257 " int msgmnb; /* Maximum number of bytes that can be\n"
2258 " written to queue; used to initialize\n"
2259 " msg_qbytes during queue creation\n"
2261 " int msgmni; /* Maximum number of message queues */\n"
2262 " int msgssz; /* Message segment size;\n"
2263 " unused within kernel */\n"
2264 " int msgtql; /* Maximum number of messages on all queues\n"
2265 " in system; unused within kernel */\n"
2266 " unsigned short int msgseg;\n"
2267 " /* Maximum number of segments;\n"
2268 " unused within kernel */\n"
2273 #: build/C/man2/msgctl.2:201
2275 "The I<msgmni>, I<msgmax>, and I<msgmnb> settings can be changed via I</proc> "
2276 "files of the same name; see B<proc>(5) for details."
2280 #: build/C/man2/msgctl.2:201
2282 msgid "B<MSG_INFO> (Linux-specific)"
2286 #: build/C/man2/msgctl.2:218
2288 "Return a I<msginfo> structure containing the same information as for "
2289 "B<IPC_INFO>, except that the following fields are returned with information "
2290 "about system resources consumed by message queues: the I<msgpool> field "
2291 "returns the number of message queues that currently exist on the system; the "
2292 "I<msgmap> field returns the total number of messages in all queues on the "
2293 "system; and the I<msgtql> field returns the total number of bytes in all "
2294 "messages in all queues on the system."
2298 #: build/C/man2/msgctl.2:218
2300 msgid "B<MSG_STAT> (Linux-specific)"
2304 #: build/C/man2/msgctl.2:229
2306 "Return a I<msqid_ds> structure as for B<IPC_STAT>. However, the I<msqid> "
2307 "argument is not a queue identifier, but instead an index into the kernel's "
2308 "internal array that maintains information about all message queues on the "
2313 #: build/C/man2/msgctl.2:250
2315 "On success, B<IPC_STAT>, B<IPC_SET>, and B<IPC_RMID> return 0. A successful "
2316 "B<IPC_INFO> or B<MSG_INFO> operation returns the index of the highest used "
2317 "entry in the kernel's internal array recording information about all message "
2318 "queues. (This information can be used with repeated B<MSG_STAT> operations "
2319 "to obtain information about all queues on the system.) A successful "
2320 "B<MSG_STAT> operation returns the identifier of the queue whose index was "
2321 "given in I<msqid>."
2325 #: build/C/man2/msgctl.2:254
2326 msgid "On error, -1 is returned with I<errno> indicating the error."
2330 #: build/C/man2/msgctl.2:258
2331 msgid "On failure, I<errno> is set to one of the following:"
2335 #: build/C/man2/msgctl.2:271
2337 "The argument I<cmd> is equal to B<IPC_STAT> or B<MSG_STAT>, but the calling "
2338 "process does not have read permission on the message queue I<msqid>, and "
2339 "does not have the B<CAP_IPC_OWNER> capability."
2343 #: build/C/man2/msgctl.2:271 build/C/man2/msgop.2:372 build/C/man2/msgop.2:425
2349 #: build/C/man2/msgctl.2:282
2351 "The argument I<cmd> has the value B<IPC_SET> or B<IPC_STAT>, but the address "
2352 "pointed to by I<buf> isn't accessible."
2356 #: build/C/man2/msgctl.2:282 build/C/man2/msgop.2:377 build/C/man2/msgop.2:430
2362 #: build/C/man2/msgctl.2:285 build/C/man2/msgop.2:380
2363 msgid "The message queue was removed."
2367 #: build/C/man2/msgctl.2:296
2369 "Invalid value for I<cmd> or I<msqid>. Or: for a B<MSG_STAT> operation, the "
2370 "index value specified in I<msqid> referred to an array slot that is "
2375 #: build/C/man2/msgctl.2:296 build/C/man2/msgctl.2:314
2381 #: build/C/man2/msgctl.2:314
2383 "The argument I<cmd> has the value B<IPC_SET> or B<IPC_RMID>, but the "
2384 "effective user ID of the calling process is not the creator (as found in "
2385 "I<msg_perm.cuid>) or the owner (as found in I<msg_perm.uid>) of the "
2386 "message queue, and the caller is not privileged (Linux: does not have the "
2387 "B<CAP_SYS_ADMIN> capability)."
2391 #: build/C/man2/msgctl.2:325
2393 "An attempt (B<IPC_SET>) was made to increase I<msg_qbytes> beyond the "
2394 "system parameter B<MSGMNB>, but the caller is not privileged (Linux: does "
2395 "not have the B<CAP_SYS_RESOURCE> capability)."
2399 #: build/C/man2/msgctl.2:328 build/C/man2/msgget.2:184 build/C/man2/msgop.2:484
2400 msgid "SVr4, POSIX.1-2001."
2403 #. Like Linux, the FreeBSD man pages still document
2404 #. the inclusion of these header files.
2406 #: build/C/man2/msgctl.2:341 build/C/man2/msgget.2:197 build/C/man2/msgop.2:507
2408 "The inclusion of I<E<lt>sys/types.hE<gt>> and I<E<lt>sys/ipc.hE<gt>> isn't "
2409 "required on Linux or by any version of POSIX. However, some old "
2410 "implementations required the inclusion of these header files, and the SVID "
2411 "also documented their inclusion. Applications intended to be portable to "
2412 "such old systems may need to include these header files."
2416 #: build/C/man2/msgctl.2:353
2418 "The B<IPC_INFO>, B<MSG_STAT> and B<MSG_INFO> operations are used by the "
2419 "B<ipcs>(1) program to provide information on allocated resources. In the "
2420 "future these may modified or moved to a I</proc> filesystem interface."
2424 #: build/C/man2/msgctl.2:367
2426 "Various fields in the I<struct msqid_ds> were typed as I<short> under Linux "
2427 "2.2 and have become I<long> under Linux 2.4. To take advantage of this, a "
2428 "recompilation under glibc-2.1.91 or later should suffice. (The kernel "
2429 "distinguishes old and new calls by an B<IPC_64> flag in I<cmd>.)"
2433 #: build/C/man2/msgctl.2:374
2435 "B<msgget>(2), B<msgrcv>(2), B<msgsnd>(2), B<capabilities>(7), "
2436 "B<mq_overview>(7), B<svipc>(7)"
2440 #: build/C/man2/msgget.2:35
2446 #: build/C/man2/msgget.2:35
2452 #: build/C/man2/msgget.2:38
2453 msgid "msgget - get a System V message queue identifier"
2457 #: build/C/man2/msgget.2:45
2459 msgid "B<int msgget(key_t >I<key>B<, int >I<msgflg>B<);>\n"
2463 #: build/C/man2/msgget.2:67
2465 "The B<msgget>() system call returns the System\\ V message queue identifier "
2466 "associated with the value of the I<key> argument. A new message queue is "
2467 "created if I<key> has the value B<IPC_PRIVATE> or I<key> isn't "
2468 "B<IPC_PRIVATE>, no message queue with the given key I<key> exists, and "
2469 "B<IPC_CREAT> is specified in I<msgflg>."
2473 #: build/C/man2/msgget.2:86
2475 "If I<msgflg> specifies both B<IPC_CREAT> and B<IPC_EXCL> and a message queue "
2476 "already exists for I<key>, then B<msgget>() fails with I<errno> set to "
2477 "B<EEXIST>. (This is analogous to the effect of the combination B<O_CREAT | "
2478 "O_EXCL> for B<open>(2).)"
2482 #: build/C/man2/msgget.2:96
2484 "Upon creation, the least significant bits of the argument I<msgflg> define "
2485 "the permissions of the message queue. These permission bits have the same "
2486 "format and semantics as the permissions specified for the I<mode> argument "
2487 "of B<open>(2). (The execute permissions are not used.)"
2491 #: build/C/man2/msgget.2:103
2493 "If a new message queue is created, then its associated data structure "
2494 "I<msqid_ds> (see B<msgctl>(2)) is initialized as follows:"
2498 #: build/C/man2/msgget.2:108
2500 "I<msg_perm.cuid> and I<msg_perm.uid> are set to the effective user ID of the "
2505 #: build/C/man2/msgget.2:113
2507 "I<msg_perm.cgid> and I<msg_perm.gid> are set to the effective group ID of "
2508 "the calling process."
2512 #: build/C/man2/msgget.2:118
2514 "The least significant 9 bits of I<msg_perm.mode> are set to the least "
2515 "significant 9 bits of I<msgflg>."
2519 #: build/C/man2/msgget.2:126
2521 "I<msg_qnum>, I<msg_lspid>, I<msg_lrpid>, I<msg_stime>, and I<msg_rtime> are "
2526 #: build/C/man2/msgget.2:129
2527 msgid "I<msg_ctime> is set to the current time."
2531 #: build/C/man2/msgget.2:133
2532 msgid "I<msg_qbytes> is set to the system limit B<MSGMNB>."
2536 #: build/C/man2/msgget.2:137
2538 "If the message queue already exists the permissions are verified, and a "
2539 "check is made to see if it is marked for destruction."
2543 #: build/C/man2/msgget.2:143
2545 "If successful, the return value will be the message queue identifier (a "
2546 "nonnegative integer), otherwise -1 with I<errno> indicating the error."
2550 #: build/C/man2/msgget.2:147
2551 msgid "On failure, I<errno> is set to one of the following values:"
2555 #: build/C/man2/msgget.2:155
2557 "A message queue exists for I<key>, but the calling process does not have "
2558 "permission to access the queue, and does not have the B<CAP_IPC_OWNER> "
2563 #: build/C/man2/msgget.2:164
2565 "B<IPC_CREAT> and B<IPC_EXCL> were specified in I<msgflg>, but a message "
2566 "queue already exists for I<key>."
2570 #: build/C/man2/msgget.2:172
2572 "No message queue exists for I<key> and I<msgflg> did not specify "
2577 #: build/C/man2/msgget.2:176
2579 "A message queue has to be created but the system does not have enough memory "
2580 "for the new data structure."
2584 #: build/C/man2/msgget.2:182
2586 "A message queue has to be created but the system limit for the maximum "
2587 "number of message queues (B<MSGMNI>) would be exceeded."
2591 #: build/C/man2/msgget.2:207
2593 "B<IPC_PRIVATE> isn't a flag field but a I<key_t> type. If this special "
2594 "value is used for I<key>, the system call ignores everything but the least "
2595 "significant 9 bits of I<msgflg> and creates a new message queue (on "
2600 #: build/C/man2/msgget.2:211
2602 "The following is a system limit on message queue resources affecting a "
2607 #: build/C/man2/msgget.2:211
2613 #: build/C/man2/msgget.2:217
2615 "System-wide limit on the number of message queues: policy dependent (on "
2616 "Linux, this limit can be read and modified via I</proc/sys/kernel/msgmni>)."
2620 #: build/C/man2/msgget.2:217
2626 #: build/C/man2/msgget.2:223
2628 "Until version 2.3.20, Linux would return B<EIDRM> for a B<msgget>() on a "
2629 "message queue scheduled for deletion."
2633 #: build/C/man2/msgget.2:229
2635 "The name choice B<IPC_PRIVATE> was perhaps unfortunate, B<IPC_NEW> would "
2636 "more clearly show its function."
2640 #: build/C/man2/msgget.2:237
2642 "B<msgctl>(2), B<msgrcv>(2), B<msgsnd>(2), B<ftok>(3), B<capabilities>(7), "
2643 "B<mq_overview>(7), B<svipc>(7)"
2647 #: build/C/man2/msgop.2:41
2653 #: build/C/man2/msgop.2:41
2659 #: build/C/man2/msgop.2:44
2660 msgid "msgrcv, msgsnd - System V message queue operations"
2664 #: build/C/man2/msgop.2:52
2667 "B<int msgsnd(int >I<msqid>B<, const void *>I<msgp>B<, size_t >I<msgsz>B<, "
2668 "int >I<msgflg>B<);>\n"
2672 #: build/C/man2/msgop.2:56
2675 "B<ssize_t msgrcv(int >I<msqid>B<, void *>I<msgp>B<, size_t >I<msgsz>B<, long "
2677 "B< int >I<msgflg>B<);>\n"
2681 #: build/C/man2/msgop.2:66
2683 "The B<msgsnd>() and B<msgrcv>() system calls are used, respectively, to "
2684 "send messages to, and receive messages from, a System\\ V message queue. "
2685 "The calling process must have write permission on the message queue in order "
2686 "to send a message, and read permission to receive a message."
2690 #: build/C/man2/msgop.2:71
2692 "The I<msgp> argument is a pointer to a caller-defined structure of the "
2693 "following general form:"
2697 #: build/C/man2/msgop.2:78
2701 " long mtype; /* message type, must be E<gt> 0 */\n"
2702 " char mtext[1]; /* message data */\n"
2707 #: build/C/man2/msgop.2:97
2709 "The I<mtext> field is an array (or other structure) whose size is specified "
2710 "by I<msgsz>, a nonnegative integer value. Messages of zero length (i.e., no "
2711 "I<mtext> field) are permitted. The I<mtype> field must have a strictly "
2712 "positive integer value. This value can be used by the receiving process for "
2713 "message selection (see the description of B<msgrcv>() below)."
2717 #: build/C/man2/msgop.2:97
2723 #: build/C/man2/msgop.2:105
2725 "The B<msgsnd>() system call appends a copy of the message pointed to by "
2726 "I<msgp> to the message queue whose identifier is specified by I<msqid>."
2730 #: build/C/man2/msgop.2:118
2732 "If sufficient space is available in the queue, B<msgsnd>() succeeds "
2733 "immediately. The queue capacity is governed by the I<msg_qbytes> field in "
2734 "the associated data structure for the message queue. During queue creation "
2735 "this field is initialized to B<MSGMNB> bytes, but this limit can be modified "
2736 "using B<msgctl>(2). A message queue is considered to be full if either of "
2737 "the following conditions is true:"
2741 #: build/C/man2/msgop.2:123
2743 "Adding a new message to the queue would cause the total number of bytes in "
2744 "the queue to exceed the queue's maximum size (the I<msg_qbytes> field)."
2748 #: build/C/man2/msgop.2:132
2750 "Adding another message to the queue would cause the total number of messages "
2751 "in the queue to exceed the queue's maximum size (the I<msg_qbytes> field). "
2752 "This check is necessary to prevent an unlimited number of zero-length "
2753 "messages being placed on the queue. Although such messages contain no data, "
2754 "they nevertheless consume (locked) kernel memory."
2758 #: build/C/man2/msgop.2:143
2760 "If insufficient space is available in the queue, then the default behavior "
2761 "of B<msgsnd>() is to block until space becomes available. If B<IPC_NOWAIT> "
2762 "is specified in I<msgflg>, then the call instead fails with the error "
2767 #: build/C/man2/msgop.2:147
2768 msgid "A blocked B<msgsnd>() call may also fail if:"
2772 #: build/C/man2/msgop.2:154
2774 "the queue is removed, in which case the system call fails with I<errno> set "
2779 #: build/C/man2/msgop.2:166
2781 "a signal is caught, in which case the system call fails with I<errno> set to "
2782 "B<EINTR>;B<see> B<signal>(7). (B<msgsnd>() is never automatically "
2783 "restarted after being interrupted by a signal handler, regardless of the "
2784 "setting of the B<SA_RESTART> flag when establishing a signal handler.)"
2788 #: build/C/man2/msgop.2:169 build/C/man2/msgop.2:330
2790 "Upon successful completion the message queue data structure is updated as "
2795 #: build/C/man2/msgop.2:172
2796 msgid "I<msg_lspid> is set to the process ID of the calling process."
2800 #: build/C/man2/msgop.2:175
2801 msgid "I<msg_qnum> is incremented by 1."
2805 #: build/C/man2/msgop.2:178
2806 msgid "I<msg_stime> is set to the current time."
2810 #: build/C/man2/msgop.2:178
2816 #: build/C/man2/msgop.2:186
2818 "The B<msgrcv>() system call removes a message from the queue specified by "
2819 "I<msqid> and places it in the buffer pointed to by I<msgp>."
2823 #: build/C/man2/msgop.2:212
2825 "The argument I<msgsz> specifies the maximum size in bytes for the member "
2826 "I<mtext> of the structure pointed to by the I<msgp> argument. If the "
2827 "message text has length greater than I<msgsz>, then the behavior depends on "
2828 "whether B<MSG_NOERROR> is specified in I<msgflg>. If B<MSG_NOERROR> is "
2829 "specified, then the message text will be truncated (and the truncated part "
2830 "will be lost); if B<MSG_NOERROR> is not specified, then the message isn't "
2831 "removed from the queue and the system call fails returning -1 with I<errno> "
2836 #: build/C/man2/msgop.2:221
2838 "Unless B<MSG_COPY> is specified in I<msgflg> (see below), the I<msgtyp> "
2839 "argument specifies the type of message requested, as follows:"
2843 #: build/C/man2/msgop.2:226
2844 msgid "If I<msgtyp> is 0, then the first message in the queue is read."
2848 #: build/C/man2/msgop.2:240
2850 "If I<msgtyp> is greater than 0, then the first message in the queue of type "
2851 "I<msgtyp> is read, unless B<MSG_EXCEPT> was specified in I<msgflg>, in which "
2852 "case the first message in the queue of type not equal to I<msgtyp> will be "
2857 #: build/C/man2/msgop.2:248
2859 "If I<msgtyp> is less than 0, then the first message in the queue with the "
2860 "lowest type less than or equal to the absolute value of I<msgtyp> will be "
2865 #: build/C/man2/msgop.2:253
2867 "The I<msgflg> argument is a bit mask constructed by ORing together zero or "
2868 "more of the following flags:"
2872 #: build/C/man2/msgop.2:253
2874 msgid "B<IPC_NOWAIT>"
2878 #: build/C/man2/msgop.2:260
2880 "Return immediately if no message of the requested type is in the queue. The "
2881 "system call fails with I<errno> set to B<ENOMSG>."
2885 #: build/C/man2/msgop.2:260
2887 msgid "B<MSG_COPY> (since Linux 3.8)"
2890 #. commit 4a674f34ba04a002244edaf891b5da7fc1473ae8
2892 #: build/C/man2/msgop.2:267
2894 "Nondestructively fetch a copy of the message at the ordinal position in the "
2895 "queue specified by I<msgtyp> (messages are considered to be numbered "
2900 #: build/C/man2/msgop.2:281
2902 "This flag must be specified in conjunction with B<IPC_NOWAIT>, with the "
2903 "result that, if there is no message available at the given position, the "
2904 "call fails immediately with the error B<ENOMSG>. Because they alter the "
2905 "meaning of I<msgtyp> in orthogonal ways, B<MSG_COPY> and B<MSG_EXCEPT> may "
2906 "not both be specified in I<msgflg>."
2910 #: build/C/man2/msgop.2:289
2912 "The B<MSG_COPY> flag was added for the implementation of the kernel "
2913 "checkpoint-restore facility and is available only if the kernel was built "
2914 "with the B<CONFIG_CHECKPOINT_RESTORE> option."
2918 #: build/C/man2/msgop.2:289
2920 msgid "B<MSG_EXCEPT>"
2924 #: build/C/man2/msgop.2:297
2926 "Used with I<msgtyp> greater than 0 to read the first message in the queue "
2927 "with message type that differs from I<msgtyp>."
2931 #: build/C/man2/msgop.2:297
2933 msgid "B<MSG_NOERROR>"
2937 #: build/C/man2/msgop.2:302
2938 msgid "To truncate the message text if longer than I<msgsz> bytes."
2942 #: build/C/man2/msgop.2:308
2944 "If no message of the requested type is available and B<IPC_NOWAIT> isn't "
2945 "specified in I<msgflg>, the calling process is blocked until one of the "
2946 "following conditions occurs:"
2950 #: build/C/man2/msgop.2:310
2951 msgid "A message of the desired type is placed in the queue."
2955 #: build/C/man2/msgop.2:316
2957 "The message queue is removed from the system. In this case, the system call "
2958 "fails with I<errno> set to B<EIDRM>."
2962 #: build/C/man2/msgop.2:327
2964 "The calling process catches a signal. In this case, the system call fails "
2965 "with I<errno> set to B<EINTR>. (B<msgrcv>() is never automatically "
2966 "restarted after being interrupted by a signal handler, regardless of the "
2967 "setting of the B<SA_RESTART> flag when establishing a signal handler.)"
2971 #: build/C/man2/msgop.2:333
2972 msgid "I<msg_lrpid> is set to the process ID of the calling process."
2976 #: build/C/man2/msgop.2:336
2977 msgid "I<msg_qnum> is decremented by 1."
2981 #: build/C/man2/msgop.2:339
2982 msgid "I<msg_rtime> is set to the current time."
2986 #: build/C/man2/msgop.2:352
2988 "On failure both functions return -1 with I<errno> indicating the error, "
2989 "otherwise B<msgsnd>() returns 0 and B<msgrcv>() returns the number of "
2990 "bytes actually copied into the I<mtext> array."
2994 #: build/C/man2/msgop.2:358
2996 "When B<msgsnd>() fails, I<errno> will be set to one among the following "
3001 #: build/C/man2/msgop.2:364
3003 "The calling process does not have write permission on the message queue, and "
3004 "does not have the B<CAP_IPC_OWNER> capability."
3008 #: build/C/man2/msgop.2:372
3010 "The message can't be sent due to the I<msg_qbytes> limit for the queue and "
3011 "B<IPC_NOWAIT> was specified in I<msgflg>."
3015 #: build/C/man2/msgop.2:377 build/C/man2/msgop.2:430
3016 msgid "The address pointed to by I<msgp> isn't accessible."
3020 #: build/C/man2/msgop.2:383
3021 msgid "Sleeping on a full message queue condition, the process caught a signal."
3025 #: build/C/man2/msgop.2:394
3027 "Invalid I<msqid> value, or nonpositive I<mtype> value, or invalid I<msgsz> "
3028 "value (less than 0 or greater than the system value B<MSGMAX>)."
3032 #: build/C/man2/msgop.2:399
3034 "The system does not have enough memory to make a copy of the message pointed "
3039 #: build/C/man2/msgop.2:405
3041 "When B<msgrcv>() fails, I<errno> will be set to one among the following "
3046 #: build/C/man2/msgop.2:405
3052 #: build/C/man2/msgop.2:413
3054 "The message text length is greater than I<msgsz> and B<MSG_NOERROR> isn't "
3055 "specified in I<msgflg>."
3059 #: build/C/man2/msgop.2:419
3061 "The calling process does not have read permission on the message queue, and "
3062 "does not have the B<CAP_IPC_OWNER> capability."
3066 #: build/C/man2/msgop.2:425
3068 "No message was available in the queue and B<IPC_NOWAIT> was specified in "
3073 #: build/C/man2/msgop.2:434
3075 "While the process was sleeping to receive a message, the message queue was "
3080 #: build/C/man2/msgop.2:439
3082 "While the process was sleeping to receive a message, the process caught a "
3083 "signal; see B<signal>(7)."
3087 #: build/C/man2/msgop.2:445
3088 msgid "I<msgqid> was invalid, or I<msgsz> was less than 0."
3092 #: build/C/man2/msgop.2:445 build/C/man2/msgop.2:452
3094 msgid "B<EINVAL> (since Linux 3.14)"
3098 #: build/C/man2/msgop.2:452
3099 msgid "I<msgflg> specified B<MSG_COPY>, but not B<IPC_NOWAIT>."
3103 #: build/C/man2/msgop.2:459
3104 msgid "I<msgflg> specified both B<MSG_COPY> and B<MSG_EXCEPT>."
3108 #: build/C/man2/msgop.2:459 build/C/man2/msgop.2:465
3114 #: build/C/man2/msgop.2:465
3116 "B<IPC_NOWAIT> was specified in I<msgflg> and no message of the requested "
3117 "type existed on the message queue."
3121 #: build/C/man2/msgop.2:475
3123 "B<IPC_NOWAIT> and B<MSG_COPY> were specified in I<msgflg> and the queue "
3124 "contains less than I<msgtyp> messages."
3128 #: build/C/man2/msgop.2:475
3130 msgid "B<ENOSYS> (since Linux 3.8)"
3134 #: build/C/man2/msgop.2:482
3136 "I<MSG_COPY> was specified in I<msgflg>, and this kernel was configured "
3137 "without B<CONFIG_CHECKPOINT_RESTORE>."
3140 #. MSG_COPY since glibc 2.18
3142 #: build/C/man2/msgop.2:494
3144 "The B<MSG_EXCEPT> and B<MSG_COPY> flags are Linux-specific; their "
3145 "definitions can be obtained by defining the B<_GNU_SOURCE> feature test "
3150 #: build/C/man2/msgop.2:514
3152 "The I<msgp> argument is declared as I<struct msgbuf\\ *> in glibc 2.0 and "
3153 "2.1. It is declared as I<void\\ *> in glibc 2.2 and later, as required by "
3158 #: build/C/man2/msgop.2:518
3160 "The following limits on message queue resources affect the B<msgsnd>() "
3165 #: build/C/man2/msgop.2:518
3171 #: build/C/man2/msgop.2:523
3173 "Maximum size for a message text: 8192 bytes (on Linux, this limit can be "
3174 "read and modified via I</proc/sys/kernel/msgmax>)."
3178 #: build/C/man2/msgop.2:523
3184 #: build/C/man2/msgop.2:537
3186 "Default maximum size in bytes of a message queue: 16384 bytes (on Linux, "
3187 "this limit can be read and modified via I</proc/sys/kernel/msgmnb>). A "
3188 "privileged process (Linux: a process with the B<CAP_SYS_RESOURCE> "
3189 "capability) can increase the size of a message queue beyond B<MSGMNB> by a "
3190 "B<msgctl>(2) system call."
3194 #: build/C/man2/msgop.2:543
3196 "The implementation has no intrinsic system-wide limits on the number of "
3197 "message headers (B<MSGTQL>) and the number of bytes in the message pool "
3201 #. http://marc.info/?l=linux-kernel&m=139048542803605&w=2
3202 #. commit 4f87dac386cc43d5525da7a939d4b4e7edbea22c
3204 #: build/C/man2/msgop.2:563
3206 "In Linux 3.13 and earlier, if B<msgrcv>() was called with the B<MSG_COPY> "
3207 "flag, but without B<IPC_NOWAIT>, and the message queue contained less than "
3208 "I<msgtyp> messages, then the call would block until the next message is "
3209 "written to the queue. At that point, the call would return a copy of the "
3210 "message, I<regardless> of whether that message was at the ordinal position "
3211 "I<msgtyp>. This bug is fixed in Linux 3.14."
3214 #. http://marc.info/?l=linux-kernel&m=139048542803605&w=2
3215 #. commit 4f87dac386cc43d5525da7a939d4b4e7edbea22c
3217 #: build/C/man2/msgop.2:579
3219 "Specifying both B<MSG_COPY> and B<MSC_EXCEPT> in I<msgflg> is a logical "
3220 "error (since these flags impose different interpretations on I<msgtyp>). In "
3221 "Linux 3.13 and earlier, this error was not diagnosed by B<msgrcv>(). This "
3222 "bug is fixed in Linux 3.14."
3226 #: build/C/man2/msgop.2:585
3228 "B<msgctl>(2), B<msgget>(2), B<capabilities>(7), B<mq_overview>(7), "