2 .\" Hey Emacs! This file is -*- nroff -*- source.
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
27 .\" Translated 2006-03-13, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
28 .\" Updated 2006-07-20, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
29 .\" Updated 2009-02-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.19
30 .\" Updated 2010-04-11, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.24
32 .\"WORD: message queue descriptor ¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò»Ò
33 .\"WORD: message queue description ¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò
35 .TH MQ_OVERVIEW 7 2009-09-27 "Linux" "Linux Programmer's Manual"
38 .\"O mq_overview \- Overview of POSIX message queues
39 mq_overview \- POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Î³µÍ×
42 .\"O POSIX message queues allow processes to exchange data in
43 .\"O the form of messages.
44 .\"O This API is distinct from that provided by System V message queues
45 .\"O .RB ( msgget (2),
48 .\"O etc.), but provides similar functionality.
49 POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤ò»ÈÍѤ¹¤ë¤È¡¢¥×¥í¥»¥¹´Ö¤Ç
50 ¥á¥Ã¥»¡¼¥¸¤Î·Á¤Ç¤Î¥Ç¡¼¥¿¤Î¤ä¤ê¼è¤ê¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤¤ë¡£
51 ¤³¤Î API ¤Ï System V ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Î API
55 ¤Ê¤É) ¤È¤Ï°Û¤Ê¤ë¤â¤Î¤À¤¬¡¢Æ±Íͤε¡Ç½¤òÄ󶡤¹¤ë¡£
57 .\"O Message queues are created and opened using
59 .\"O this function returns a
60 .\"O .I message queue descriptor
62 .\"O which is used to refer to the open message queue in later calls.
63 .\"O Each message queue is identified by a name of the form
65 .\"O that is, a null-terminated string of up to
67 .\"O (i.e., 255) characters consisting of an initial slash,
68 .\"O followed by one or more characters, none of which are slashes.
69 ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤ÎºîÀ®¤È¥ª¡¼¥×¥ó¤Ï
71 ¤ò»È¤Ã¤Æ¹Ô¤¦¡£¤³¤Î´Ø¿ô¤Ï
72 .I ¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò»Ò (message queue descriptor)
74 ¤òÊÖ¤¹¡£¤³¤ì°Ê¹ß¤Î¥³¡¼¥ë¤Ç¤Ï¡¢¥ª¡¼¥×¥ó¤µ¤ì¤¿¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ï
75 .I ¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò»Ò
79 ¤Î·Á¤Î̾Á°¤Ç¶èÊ̤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
82 (¤¹¤Ê¤ï¤Á 255) ʸ»ú¤Î NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤Ç¡¢
83 ¥¹¥é¥Ã¥·¥å¤Ç»Ï¤Þ¤ê¡¢¥¹¥é¥Ã¥·¥å°Ê³°¤Îʸ»ú¤¬ 1 ʸ»ú°Ê¾å³¤¯·Á¼°¤Ç¤¢¤ë¡£
84 .\"O Two processes can operate on the same queue by passing the same name to
87 ¤ËƱ¤¸Ì¾Á°¤òÅϤ¹¤³¤È¤Ç¡¢2¤Ä¤Î¥×¥í¥»¥¹¤ÇƱ°ì¤Î¥¥å¡¼¤ò
88 Áàºî¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
90 .\"O Messages are transferred to and from a queue using
93 .\"O .BR mq_receive (3).
94 .\"O When a process has finished using the queue, it closes it using
95 .\"O .BR mq_close (3),
96 .\"O and when the queue is no longer required, it can be deleted using
97 .\"O .BR mq_unlink (3).
98 .\"O Queue attributes can be retrieved and (in some cases) modified using
99 .\"O .BR mq_getattr (3)
101 .\"O .BR mq_setattr (3).
102 .\"O A process can request asynchronous notification
103 .\"O of the arrival of a message on a previously empty queue using
104 .\"O .BR mq_notify (3).
105 ¥á¥Ã¥»¡¼¥¸¤Î¥¥å¡¼¤Ø¤ÎÁ÷¼õ¿®¤Ï
109 ¤ò»È¤Ã¤Æ¹Ô¤¦¡£¥×¥í¥»¥¹¤¬¥¥å¡¼¤Î»ÈÍѤò½ª¤¨¤ë¤È¤¤Ë¤Ï¡¢
111 ¤ò»È¤Ã¤Æ¥¥å¡¼¤ò¥¯¥í¡¼¥º¤¹¤ë¡£¥¥å¡¼¤¬¤â¤Ï¤äÉÔÍפȤʤ俾ì¹ç¤Ë¤Ï¡¢
113 ¤ò»È¤Ã¤Æ¥¥å¡¼¤òºï½ü¤Ç¤¤ë¡£¥¥å¡¼¤Î°À¤Ï
115 ¤Ç¼èÆÀ¤Ç¤¡¢ (À©¸Â¤Ï¤¢¤ë¤¬)
119 ¤ò»È¤¦¤³¤È¤Ç¡¢¶õ¤Î¥¥å¡¼¤Ø¤Î¥á¥Ã¥»¡¼¥¸ÅþÃå¤òÈóƱ´ü¤Ç
120 ÄÌÃΤ¹¤ë¤è¤¦¤ËÍ׵᤹¤ë¤³¤È¤â¤Ç¤¤ë¡£
122 .\"O A message queue descriptor is a reference to an
123 .\"O .I "open message queue description"
128 .\"O a child inherits copies of its parent's message queue descriptors,
129 .\"O and these descriptors refer to the same open message queue descriptions
130 .\"O as the corresponding descriptors in the parent.
131 .\"O Corresponding descriptors in the two processes share the flags
132 .\"O .RI ( mq_flags )
133 .\"O that are associated with the open message queue description.
134 ¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò»Ò¤Ï
135 .I "¥ª¡¼¥×¥ó¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò (open message queue description)"
140 ¼Â¹Ô¸å¤Ï¡¢»Ò¥×¥í¥»¥¹¤Ï¿Æ¥×¥í¥»¥¹¤Î¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò»Ò¤Î¥³¥Ô¡¼¤ò·Ñ¾µ¤¹¤ë¡£
141 ¤³¤ì¤é¤Îµ½Ò»Ò¤Ï¡¢¿Æ¥×¥í¥»¥¹¤ÎÂбþ¤¹¤ëµ½Ò»Ò¤ÈƱ¤¸¥ª¡¼¥×¥ó¥á¥Ã¥»¡¼¥¸¥¥å¡¼
142 µ½Ò¤ò»²¾È¤·¤Æ¤¤¤ë¡£¿Æ¥×¥í¥»¥¹¤È»Ò¥×¥í¥»¥¹¤ÎÂбþ¤¹¤ëµ½Ò»Ò¤Ï¡¢¥Õ¥é¥°
144 ¤ò¶¦Í¤¹¤ë¡£¤Ê¤¼¤Ê¤é¡¢¥Õ¥é¥°¤Ï¥ª¡¼¥×¥ó¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò¤Ë
145 ´ØÏ¢ÉÕ¤±¤é¤ì¤Æ¤¤¤ë¤«¤é¤Ç¤¢¤ë¡£
147 .\"O Each message has an associated
149 .\"O and messages are always delivered to the receiving process
150 .\"O highest priority first.
151 .\"O Message priorities range from 0 (low) to
152 .\"O .I sysconf(_SC_MQ_PRIO_MAX)\ -\ 1
155 .\"O .I sysconf(_SC_MQ_PRIO_MAX)
156 .\"O returns 32768, but POSIX.1-2001 only requires
157 .\"O an implementation to support priorities in the range 0 to 31;
158 .\"O some implementations only provide this range.
159 ³Æ¥á¥Ã¥»¡¼¥¸¤Ë¤Ï¤½¤ì¤¾¤ì
161 ¤¬¤¢¤ê¡¢¥á¥Ã¥»¡¼¥¸¤Î¼õ¿®¥×¥í¥»¥¹¤Ø¤ÎÇÛÁ÷¤Ï¾ï¤Ë
162 Í¥ÀèÅ٤ι⤤¥á¥Ã¥»¡¼¥¸¤«¤é½ç¤Ë¹Ô¤ï¤ì¤ë¡£
163 ¥á¥Ã¥»¡¼¥¸¤ÎÍ¥ÀèÅÙ¤Ï 0 (ÄãÍ¥Àè) ¤«¤é
164 .I sysconf(_SC_MQ_PRIO_MAX)\ -\ 1
165 (¹âÍ¥Àè) ¤ÎÃͤò»ý¤Ä¡£
167 .I sysconf(_SC_MQ_PRIO_MAX)
169 POSIX.1-2001 ¤ÇÍ׵ᤵ¤ì¤Æ¤¤¤ë¤Î¤Ï 0 ¤«¤é 31 ¤Þ¤Ç¤ÎÍ¥ÀèÅÙ¤ò
170 ¼ÂÁõ¤¹¤ë¤³¤È¤À¤±¤Ç¤¢¤ê¡¢¼ÂÁõ¤Ë¤è¤Ã¤Æ¤Ï¤³¤ÎÈϰϤÎÍ¥ÀèÅÙ¤·¤«
173 .\"O The remainder of this section describes some specific details
174 .\"O of the Linux implementation of POSIX message queues.
175 ¤³¤ÎÀá¤Î»Ä¤ê¤Ç¤Ï¡¢POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Î Linux ¤Î¼ÂÁõ¤Î¾ÜºÙ
177 .\"O .SS Library interfaces and system calls
178 .SS ¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤È¥·¥¹¥Æ¥à¥³¡¼¥ë
179 .\"O In most cases the
181 .\"O library interfaces listed above are implemented
182 .\"O on top of underlying system calls of the same name.
183 .\"O Deviations from this scheme are indicated in the following table:
184 ¤Û¤È¤ó¤É¤Î¾ì¹ç¡¢¾åµ¤Î
186 ¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ï¡¢Æ±¤¸Ì¾Á°¤Î²¼°ÌÁؤΥ·¥¹¥Æ¥à¥³¡¼¥ë¤ò
187 »È¤Ã¤Æ¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¡£¤³¤ÎÏÈÁȤߤˤ¢¤Æ¤Ï¤Þ¤é¤Ê¤¤¤â¤Î¤ò
193 Library interface System call
195 mq_getattr(3) mq_getsetattr(2)
196 mq_notify(3) mq_notify(2)
197 mq_open(3) mq_open(2)
198 mq_receive(3) mq_timedreceive(2)
199 mq_send(3) mq_timedsend(2)
200 mq_setattr(3) mq_getsetattr(2)
201 mq_timedreceive(3) mq_timedreceive(2)
202 mq_timedsend(3) mq_timedsend(2)
203 mq_unlink(3) mq_unlink(2)
208 .\"O POSIX message queues have been supported on Linux since kernel 2.6.6.
209 .\"O Glibc support has been provided since version 2.3.4.
210 Linux ¤Ç¤Ï POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ï¥«¡¼¥Í¥ë 2.6.6 °Ê¹ß¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
211 glibc ¤Ç¤Ï¥Ð¡¼¥¸¥ç¥ó 2.3.4 °Ê¹ß¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
212 .\"O .SS Kernel configuration
214 .\"O Support for POSIX message queues is configurable via the
215 .\"O .B CONFIG_POSIX_MQUEUE
216 .\"O kernel configuration option.
217 .\"O This option is enabled by default.
218 POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Î¥µ¥Ý¡¼¥È¤Ï¡¢¥«¡¼¥Í¥ë¤ÎÀßÄê (configuration)
220 .B CONFIG_POSIX_MQUEUE
221 ¤ÇÀßÄê²Äǽ¤Ç¤¢¤ë¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï͸ú¤Ç¤¢¤ë¡£
224 .\"O POSIX message queues have kernel persistence:
225 .\"O if not removed by
226 .\"O .BR mq_unlink (3),
227 .\"O a message queue will exist until the system is shut down.
228 POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ï¥«¡¼¥Í¥ëÆâ¤ÇÊÝ»ý¤µ¤ì¤ë¡£
230 ¤Çºï½ü¤µ¤ì¤Ê¤±¤ì¤Ð¡¢¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ï
231 ¥·¥¹¥Æ¥à¤¬¥·¥ã¥Ã¥È¥À¥¦¥ó¤µ¤ì¤ë¤Þ¤Ç¸ºß¤·Â³¤±¤ë¡£
234 .\"O Programs using the POSIX message queue API must be compiled with
236 .\"O to link against the real-time library,
238 POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼ API ¤ò»ÈÍѤ·¤¿¥×¥í¥°¥é¥à¤Ï
240 ¤Ç¥³¥ó¥Ñ¥¤¥ë¤·¡¢¥ê¥¢¥ë¥¿¥¤¥à¥é¥¤¥Ö¥é¥ê
242 ¤È¥ê¥ó¥¯¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
243 .\"O .SS /proc interfaces
244 .SS /proc ¥¤¥ó¥¿¥Õ¥§¡¼¥¹
245 .\"O The following interfaces can be used to limit the amount of
246 .\"O kernel memory consumed by POSIX message queues:
247 °Ê²¼¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æ¡¢POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤¬¾ÃÈñ¤¹¤ë¥«¡¼¥Í¥ë
248 ¥á¥â¥ê¤ÎÎ̤òÀ©¸Â¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
250 .I /proc/sys/fs/mqueue/msg_max
251 .\"O This file can be used to view and change the ceiling value for the
252 .\"O maximum number of messages in a queue.
253 .\"O This value acts as a ceiling on the
254 .\"O .I attr\->mq_maxmsg
255 .\"O argument given to
256 .\"O .BR mq_open (3).
257 .\"O The default value for
260 .\"O The minimum value is 1 (10 in kernels before 2.6.28).
261 .\"O The upper limit is
263 .\"O .IR "(131072\ /\ sizeof(void\ *))"
264 .\"O (32768 on Linux/86).
265 .\"O This limit is ignored for privileged processes
266 .\"O .RB ( CAP_SYS_RESOURCE ),
269 .\"O ceiling is nevertheless imposed.
270 ¤³¤Î¥Õ¥¡¥¤¥ë¤ò»È¤Ã¤Æ¡¢°ì¤Ä¤Î¥¥å¡¼¤ËÆþ¤ì¤é¤ì¤ë¥á¥Ã¥»¡¼¥¸¤ÎºÇÂç¿ô¤Î
271 ¾å¸ÂÃͤò»²¾È¤·¤¿¤êÊѹ¹¤·¤¿¤ê¤Ç¤¤ë¡£¤³¤ÎÃͤϡ¢
275 °ú¤¿ô¤ËÂФ¹¤ë¾å¸ÂÃͤȤ·¤Æµ¡Ç½¤¹¤ë¡£
277 ¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï 10 ¤Ç¡¢
278 ºÇ¾®ÃÍ¤Ï 1 (2.6.28 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï 10) ¤Ç¤¢¤ë¡£
279 ¾å¸Â¤Ï¡ÖËä¤á¹þ¤ß¤Î¸ÇÄêÃÍ¡×
282 .IR "(131072\ /\ sizeof(void\ *))"
283 (Linux/86 ¤Ç¤Ï 32768) ¤Ç¤¢¤ë¡£
284 ¤³¤Î¾å¸Â¤ÏÆø¢¥×¥í¥»¥¹
285 .RB ( CAP_SYS_RESOURCE )
286 ¤Ç¤Ï̵»ë¤µ¤ì¤ë¤¬¡¢Ëä¤á¹þ¤ß¤Î¸ÇÄêÃͤˤè¤ë¾å¸Â¤Ï
287 ¤É¤ó¤Ê¾ì¹ç¤Ë¤Ç¤âŬÍѤµ¤ì¤ë¡£
289 .I /proc/sys/fs/mqueue/msgsize_max
290 .\"O This file can be used to view and change the ceiling on the
291 .\"O maximum message size.
292 .\"O This value acts as a ceiling on the
293 .\"O .I attr\->mq_msgsize
294 .\"O argument given to
295 .\"O .BR mq_open (3).
296 .\"O The default value for
299 .\"O The minimum value is 128 (8192 in kernels before 2.6.28).
300 .\"O The upper limit for
302 .\"O is 1,048,576 (in kernels before 2.6.28, the upper limit was
304 .\"O that is, 2,147,483,647 on Linux/86).
305 .\"O This limit is ignored for privileged processes
306 .\"O .RB ( CAP_SYS_RESOURCE ).
307 ¤³¤Î¥Õ¥¡¥¤¥ë¤ò»È¤Ã¤Æ¡¢¥á¥Ã¥»¡¼¥¸¤ÎºÇÂ祵¥¤¥º¤Î¾å¸ÂÃͤò
308 »²¾È¤·¤¿¤êÊѹ¹¤·¤¿¤ê¤Ç¤¤ë¡£
313 °ú¤¿ô¤ËÂФ¹¤ë¾å¸ÂÃͤȤ·¤Æµ¡Ç½¤¹¤ë¡£
315 ¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï 8192 ¥Ð¥¤¥È¤Ç¡¢
316 ºÇ¾®ÃÍ¤Ï 128 (2.6.28 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï 8192) ¤Ç¤¢¤ë¡£
318 ¤Î¾å¸Â¤Ï 1,048,576 ¤Ç¤¢¤ë
319 (2.6.28 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï¡¢¾å¸Â¤Ï
321 (Linux/86 ¤Ç¤Ï 2,147,483,647) ¤Ç¤¢¤Ã¤¿)¡£
322 ¤³¤Î¾å¸Â¤ÏÆø¢¥×¥í¥»¥¹
323 .RB ( CAP_SYS_RESOURCE )
326 .I /proc/sys/fs/mqueue/queues_max
327 .\"O This file can be used to view and change the system-wide limit on the
328 .\"O number of message queues that can be created.
329 .\"O Only privileged processes
330 .\"O .RB ( CAP_SYS_RESOURCE )
331 .\"O can create new message queues once this limit has been reached.
332 .\"O The default value for
334 .\"O is 256; it can be changed to any value in the range 0 to INT_MAX.
335 ¤³¤Î¥Õ¥¡¥¤¥ë¤ò»È¤Ã¤Æ¡¢ºîÀ®¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Î¿ô¤Ë
336 ÂФ¹¤ë¥·¥¹¥Æ¥àÁ´ÂΤǤÎÀ©¸Â¤ò»²¾È¤·¤¿¤êÊѹ¹¤·¤¿¤ê¤Ç¤¤ë¡£
337 °ìÅÙ¤³¤Î¾å¸Â¤Ë㤹¤ë¤È¡¢¿·¤·¤¤¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤òºîÀ®¤Ç¤¤ë¤Î¤Ï
339 .RB ( CAP_SYS_RESOURCE )
342 ¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï 256 ¤Ç¤¢¤ê¡¢
343 0 ¤«¤é INT_MAX ¤ÎÈϰϤÎǤ°Õ¤ÎÃͤËÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
344 .\"O .SS Resource limit
347 .\"O .B RLIMIT_MSGQUEUE
348 .\"O resource limit, which places a limit on the amount of space
349 .\"O that can be consumed by all of the message queues
350 .\"O belonging to a process's real user ID, is described in
351 .\"O .BR getrlimit (2).
354 ¤Ï¡¢¥×¥í¥»¥¹¤Î¼Â UID ¤ËÂбþ¤¹¤ëÁ´¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤¬¾ÃÈñ¤¹¤ë
355 ¥á¥â¥ê¶õ´Ö¤ÎÎ̤ËÂФ·¤Æ¾å¸Â¤òÀßÄꤹ¤ë¡£
358 .\"O .SS Mounting the message queue file system
359 .SS ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¡¦¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥Þ¥¦¥ó¥È
360 .\"O On Linux, message queues are created in a virtual file system.
361 .\"O (Other implementations may also provide such a feature,
362 .\"O but the details are likely to differ.)
363 .\"O This file system can be mounted (by the superuser) using the following
365 Linux ¤Ç¤Ï¡¢¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ï²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥àÆâ¤ËºîÀ®¤µ¤ì¤ë
366 (¾¤Î¼ÂÁõ¤Ç¤âƱÍͤε¡Ç½¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¤â¤Î¤â¤¢¤ë¤¬¡¢
367 ¾ÜºÙ¤Ï°ã¤Ã¤Æ¤¤¤ë¤À¤í¤¦)¡£
368 °Ê²¼¤Î¥³¥Þ¥ó¥É¤ò»È¤¦¤³¤È¤Ç (¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¤Ï)
369 ¤³¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ò¥Þ¥¦¥ó¥È¤Ç¤¤ë:
373 .RB "#" " mkdir /dev/mqueue"
374 .RB "#" " mount \-t mqueue none /dev/mqueue"
378 .\"O The sticky bit is automatically enabled on the mount directory.
379 ¥Þ¥¦¥ó¥È¤·¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Î¥¹¥Æ¥£¥Ã¥¡¼¥Ó¥Ã¥È (sticky bit) ¤Ï
382 .\"O After the file system has been mounted, the message queues on the system
383 .\"O can be viewed and manipulated using the commands usually used for files
388 ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¡¦¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥Þ¥¦¥ó¥È¸å¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ
389 Ä̾ï»È¤¦¥³¥Þ¥ó¥É (Î㤨¤Ð
393 ¤ò»È¤Ã¤Æ¡¢¥·¥¹¥Æ¥à¾å¤Î¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤òɽ¼¨¤·¤¿¤ê
396 .\"O The contents of each file in the directory consist of a single line
397 .\"O containing information about the queue:
398 ¥Ç¥£¥ì¥¯¥È¥êÆâ¤Î³Æ¥Õ¥¡¥¤¥ë¤ÎÆâÍÆ¤Ï 1¹Ô¤Ç¤¢¤ê¡¢
399 ¥¥å¡¼¤Ë´Ø¤¹¤ë¾ðÊó¤¬É½¼¨¤µ¤ì¤ë¡£
403 .RB "$" " cat /dev/mqueue/mymq"
404 QSIZE:129 NOTIFY:2 SIGNO:0 NOTIFY_PID:8260
408 .\"O These fields are as follows:
409 ³Æ¥Õ¥£¡¼¥ë¥É¤Î¾ÜºÙ¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë:
412 .\"O Number of bytes of data in all messages in the queue.
413 ¥¥å¡¼¤ËÆþ¤Ã¤Æ¤¤¤ëÁ´¥á¥Ã¥»¡¼¥¸¤Î¹ç·×¥Ð¥¤¥È¿ô¡£
416 .\"O If this is nonzero, then the process with this PID has used
417 .\"O .BR mq_notify (3)
418 .\"O to register for asynchronous message notification,
419 .\"O and the remaining fields describe how notification occurs.
420 ¤³¤ÎÃͤ¬ 0 °Ê³°¤Î¾ì¹ç¡¢¤³¤ÎÃͤΠPID ¤ò»ý¤Ä¥×¥í¥»¥¹¤¬
422 ¤ò»È¤Ã¤Æ¡¢ÈóƱ´ü¤Î¥á¥Ã¥»¡¼¥¸ÄÌÃΤò¹Ô¤¦¤è¤¦¤ËÀßÄꤷ¤¿¤³¤È¤ò¼¨¤¹¡£
423 ¤É¤Î¤è¤¦¤ËÄÌÃΤ¬¹Ô¤ï¤ì¤ë¤«¤Ï¡¢°Ê²¼¤Î¥Õ¥£¡¼¥ë¥É¤Ë¤è¤ê·èÄꤵ¤ì¤ë¡£
426 .\"O Notification method:
428 .\"O .BR SIGEV_SIGNAL ;
430 .\"O .BR SIGEV_NONE ;
433 .\"O .BR SIGEV_THREAD .
443 .\"O Signal number to be used for
444 .\"O .BR SIGEV_SIGNAL .
446 ¤Ë»ÈÍѤµ¤ì¤ë¥·¥°¥Ê¥ëÈֹ档
447 .\"O .SS Polling message queue descriptors
448 .SS ¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò»Ò¤Î¥Ý¡¼¥ê¥ó¥°
449 .\"O On Linux, a message queue descriptor is actually a file descriptor,
450 .\"O and can be monitored using
455 .\"O This is not portable.
456 Linux ¤Ç¤Ï¡¢¥á¥Ã¥»¡¼¥¸¥¥å¡¼µ½Ò»Ò¤Ï¼ÂºÝ¤Ï¥Õ¥¡¥¤¥ëµ½Ò»Ò (file descriptor)
461 ¤ò»È¤Ã¤Æ´Æ»ë¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
462 ¤³¤Îµ¡Ç½¤Î°Ü¿¢À¤Ï¤Ê¤¤¡£
463 .\"O .SH "CONFORMING TO"
468 .\"O System V message queues
469 .\"O .RB ( msgget (2),
472 .\"O etc.) are an older API for exchanging messages between processes.
473 .\"O POSIX message queues provide a better designed interface than
474 .\"O System V message queues;
475 .\"O on the other hand POSIX message queues are less widely available
476 .\"O (especially on older systems) than System V message queues.
477 System V ¥á¥Ã¥»¡¼¥¸¥¥å¡¼
481 ¤Ê¤É) ¤Ï¥×¥í¥»¥¹´Ö¤Ç¥á¥Ã¥»¡¼¥¸¤ò¤ä¤ê¼è¤ê¤¹¤ë¤¿¤á¤Î¸Å¤¤ API ¤Ç¤¢¤ë¡£
482 POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ï System V ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤è¤ê¤â¤¦¤Þ¤¯
483 À߷פµ¤ì¤¿¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤òÄ󶡤·¤Æ¤¤¤ë¡£
484 °ìÊý¤Ç¡¢POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤Ï System V ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤ÈÈæ¤Ù¤ë¤È
485 ÍøÍѤǤ¤ë¥·¥¹¥Æ¥à¤¬¾¯¤Ê¤¤ (Æäˡ¢¸Å¤¤¥·¥¹¥Æ¥à¤Ç¤Ï¾¯¤Ê¤¤)¡£
487 .\"O Linux does not currently (2.6.26) support the use of access control
488 .\"O lists (ACLs) for POSIX message queues.
489 ¸½ºß¤Î¤³¤È¤í (¥Ð¡¼¥¸¥ç¥ó 2.6.26 »þÅÀ)¡¢
490 Linux ¤Ï POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¤ËÂФ¹¤ë¥¢¥¯¥»¥¹À©¸æ¥ê¥¹¥È (ACL) ¤Ë
494 .\"O An example of the use of various message queue functions is shown in
495 .\"O .BR mq_notify (3).
496 ³Æ¼ï¤Î¥á¥Ã¥»¡¼¥¸¥¥å¡¼´Ø¿ô¤ò»ÈÍѤ·¤¿Î㤬
502 .BR mq_getsetattr (2),