OSDN Git Service

(split) LDP man-pages の original/ を v3.32 に更新。
[linuxjm/LDP_man-pages.git] / draft / man7 / mq_overview.7
1 '\" t
2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\"
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
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.
9 .\"
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.
14 .\"
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
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
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
31 .\"
32 .\"WORD:        message queue descriptor        ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼µ­½Ò»Ò
33 .\"WORD:        message queue description       ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼µ­½Ò
34 .\"
35 .TH MQ_OVERVIEW 7 2009-09-27 "Linux" "Linux Programmer's Manual"
36 .\"O .SH NAME
37 .SH Ì¾Á°
38 .\"O mq_overview \- Overview of POSIX message queues
39 mq_overview \- POSIX ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Î³µÍ×
40 .\"O .SH DESCRIPTION
41 .SH ÀâÌÀ
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),
46 .\"O .BR msgsnd (2),
47 .\"O .BR msgrcv (2),
48 .\"O etc.), but provides similar functionality.
49 POSIX ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤ò»ÈÍѤ¹¤ë¤È¡¢¥×¥í¥»¥¹´Ö¤Ç
50 ¥á¥Ã¥»¡¼¥¸¤Î·Á¤Ç¤Î¥Ç¡¼¥¿¤Î¤ä¤ê¼è¤ê¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤ë¡£
51 ¤³¤Î API ¤Ï System V ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Î API
52 .RB ( msgget (2),
53 .BR msgsnd (2),
54 .BR msgrcv (2)
55 ¤Ê¤É) ¤È¤Ï°Û¤Ê¤ë¤â¤Î¤À¤¬¡¢Æ±Íͤε¡Ç½¤òÄ󶡤¹¤ë¡£
56
57 .\"O Message queues are created and opened using
58 .\"O .BR mq_open (3);
59 .\"O this function returns a
60 .\"O .I message queue descriptor
61 .\"O .RI ( mqd_t ),
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
64 .\"O .IR /somename ;
65 .\"O that is, a null-terminated string of up to
66 .\"O .BI NAME_MAX
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 ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤ÎºîÀ®¤È¥ª¡¼¥×¥ó¤Ï
70 .BR mq_open (3)
71 ¤ò»È¤Ã¤Æ¹Ô¤¦¡£¤³¤Î´Ø¿ô¤Ï
72 .I ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼µ­½Ò»Ò (message queue descriptor)
73 .RI ( mqd_t )
74 ¤òÊÖ¤¹¡£¤³¤ì°Ê¹ß¤Î¥³¡¼¥ë¤Ç¤Ï¡¢¥ª¡¼¥×¥ó¤µ¤ì¤¿¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Ï
75 .I ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼µ­½Ò»Ò
76 ¤ò»È¤Ã¤Æ»²¾È¤µ¤ì¤ë¡£
77 ³Æ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Ï
78 .I /somename
79 ¤Î·Á¤Î̾Á°¤Ç¶èÊ̤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
80 ¤½¤Î̾Á°¤Ï¡¢ºÇÂç¤Ç
81 .B NAME_MAX
82 (¤¹¤Ê¤ï¤Á 255) Ê¸»ú¤Î NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤Ç¡¢
83 ¥¹¥é¥Ã¥·¥å¤Ç»Ï¤Þ¤ê¡¢¥¹¥é¥Ã¥·¥å°Ê³°¤Îʸ»ú¤¬ 1 Ê¸»ú°Ê¾å³¤¯·Á¼°¤Ç¤¢¤ë¡£
84 .\"O Two processes can operate on the same queue by passing the same name to
85 .\"O .BR mq_open (3).
86 .BR mq_open (3)
87 ¤ËƱ¤¸Ì¾Á°¤òÅϤ¹¤³¤È¤Ç¡¢2¤Ä¤Î¥×¥í¥»¥¹¤ÇƱ°ì¤Î¥­¥å¡¼¤ò
88 Áàºî¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
89
90 .\"O Messages are transferred to and from a queue using
91 .\"O .BR mq_send (3)
92 .\"O and
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)
100 .\"O and
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 ¥á¥Ã¥»¡¼¥¸¤Î¥­¥å¡¼¤Ø¤ÎÁ÷¼õ¿®¤Ï
106 .BR mq_send (3)
107 ¤È
108 .BR mq_receive (3)
109 ¤ò»È¤Ã¤Æ¹Ô¤¦¡£¥×¥í¥»¥¹¤¬¥­¥å¡¼¤Î»ÈÍѤò½ª¤¨¤ë¤È¤­¤Ë¤Ï¡¢
110 .BR mq_close (3)
111 ¤ò»È¤Ã¤Æ¥­¥å¡¼¤ò¥¯¥í¡¼¥º¤¹¤ë¡£¥­¥å¡¼¤¬¤â¤Ï¤äÉÔÍפȤʤ俾ì¹ç¤Ë¤Ï¡¢
112 .BR mq_unlink (3)
113 ¤ò»È¤Ã¤Æ¥­¥å¡¼¤òºï½ü¤Ç¤­¤ë¡£¥­¥å¡¼¤Î°À­¤Ï
114 .BR mq_getattr (3)
115 ¤Ç¼èÆÀ¤Ç¤­¡¢ (À©¸Â¤Ï¤¢¤ë¤¬)
116 .BR mq_setattr (3)
117 ¤ÇÊѹ¹¤Ç¤­¤ë¡£
118 .BR mq_notify (3)
119 ¤ò»È¤¦¤³¤È¤Ç¡¢¶õ¤Î¥­¥å¡¼¤Ø¤Î¥á¥Ã¥»¡¼¥¸ÅþÃå¤òÈóƱ´ü¤Ç
120 ÄÌÃΤ¹¤ë¤è¤¦¤ËÍ׵᤹¤ë¤³¤È¤â¤Ç¤­¤ë¡£
121
122 .\"O A message queue descriptor is a reference to an
123 .\"O .I "open message queue description"
124 .\"O (cf.
125 .\"O .BR open (2)).
126 .\"O After a
127 .\"O .BR fork (2),
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)"
136 ¤Ø¤Î»²¾È¤Ç¤¢¤ë
137 .RB ( open (2)
138 ¤â»²¾È)¡£
139 .BR fork (2)
140 ¼Â¹Ô¸å¤Ï¡¢»Ò¥×¥í¥»¥¹¤Ï¿Æ¥×¥í¥»¥¹¤Î¥á¥Ã¥»¡¼¥¸¥­¥å¡¼µ­½Ò»Ò¤Î¥³¥Ô¡¼¤ò·Ñ¾µ¤¹¤ë¡£
141 ¤³¤ì¤é¤Îµ­½Ò»Ò¤Ï¡¢¿Æ¥×¥í¥»¥¹¤ÎÂбþ¤¹¤ëµ­½Ò»Ò¤ÈƱ¤¸¥ª¡¼¥×¥ó¥á¥Ã¥»¡¼¥¸¥­¥å¡¼
142 µ­½Ò¤ò»²¾È¤·¤Æ¤¤¤ë¡£¿Æ¥×¥í¥»¥¹¤È»Ò¥×¥í¥»¥¹¤ÎÂбþ¤¹¤ëµ­½Ò»Ò¤Ï¡¢¥Õ¥é¥°
143 .RI ( mq_flags )
144 ¤ò¶¦Í­¤¹¤ë¡£¤Ê¤¼¤Ê¤é¡¢¥Õ¥é¥°¤Ï¥ª¡¼¥×¥ó¥á¥Ã¥»¡¼¥¸¥­¥å¡¼µ­½Ò¤Ë
145 ´ØÏ¢ÉÕ¤±¤é¤ì¤Æ¤¤¤ë¤«¤é¤Ç¤¢¤ë¡£
146
147 .\"O Each message has an associated
148 .\"O .IR priority ,
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
153 .\"O (high).
154 .\"O On Linux,
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 ³Æ¥á¥Ã¥»¡¼¥¸¤Ë¤Ï¤½¤ì¤¾¤ì
160 .I Í¥ÀèÅÙ (priority)
161 ¤¬¤¢¤ê¡¢¥á¥Ã¥»¡¼¥¸¤Î¼õ¿®¥×¥í¥»¥¹¤Ø¤ÎÇÛÁ÷¤Ï¾ï¤Ë
162 Í¥ÀèÅ٤ι⤤¥á¥Ã¥»¡¼¥¸¤«¤é½ç¤Ë¹Ô¤ï¤ì¤ë¡£
163 ¥á¥Ã¥»¡¼¥¸¤ÎÍ¥ÀèÅ٤Ϡ0 (ÄãÍ¥Àè) ¤«¤é
164 .I sysconf(_SC_MQ_PRIO_MAX)\ -\ 1
165 (¹âÍ¥Àè) ¤ÎÃͤò»ý¤Ä¡£
166 Linux ¤Ç¤Ï¡¢
167 .I sysconf(_SC_MQ_PRIO_MAX)
168 ¤Ï 32768 ¤òÊÖ¤¹¤¬¡¢
169 POSIX.1-2001 ¤ÇÍ׵ᤵ¤ì¤Æ¤¤¤ë¤Î¤Ï 0 ¤«¤é 31 ¤Þ¤Ç¤ÎÍ¥ÀèÅÙ¤ò
170 ¼ÂÁõ¤¹¤ë¤³¤È¤À¤±¤Ç¤¢¤ê¡¢¼ÂÁõ¤Ë¤è¤Ã¤Æ¤Ï¤³¤ÎÈϰϤÎÍ¥ÀèÅÙ¤·¤«
171 Âбþ¤·¤Æ¤¤¤Ê¤¤¡£
172 .PP
173 .\"O The remainder of this section describes some specific details
174 .\"O of the Linux implementation of POSIX message queues.
175 ¤³¤ÎÀá¤Î»Ä¤ê¤Ç¤Ï¡¢POSIX ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Î Linux ¤Î¼ÂÁõ¤Î¾ÜºÙ
176 ¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£
177 .\"O .SS Library interfaces and system calls
178 .SS ¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤È¥·¥¹¥Æ¥à¥³¡¼¥ë
179 .\"O In most cases the
180 .\"O .B mq_*()
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 ¤Û¤È¤ó¤É¤Î¾ì¹ç¡¢¾åµ­¤Î
185 .B mq_*()
186 ¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ï¡¢Æ±¤¸Ì¾Á°¤Î²¼°ÌÁؤΥ·¥¹¥Æ¥à¥³¡¼¥ë¤ò
187 »È¤Ã¤Æ¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¡£¤³¤ÎÏÈÁȤߤˤ¢¤Æ¤Ï¤Þ¤é¤Ê¤¤¤â¤Î¤ò
188 °Ê²¼¤Îɽ¤Ë¼¨¤¹¡£
189 .in +4n
190 .TS
191 lB lB
192 l l.
193 Library interface       System call
194 mq_close(3)     close(2)
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)
204 .TE
205 .in
206 .\"O .SS Versions
207 .SS ¥Ð¡¼¥¸¥ç¥ó
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
213 .SS ¥«¡¼¥Í¥ë¤ÎÀßÄê
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)
219 ¥ª¥×¥·¥ç¥ó
220 .B CONFIG_POSIX_MQUEUE
221 ¤ÇÀßÄê²Äǽ¤Ç¤¢¤ë¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤ÏÍ­¸ú¤Ç¤¢¤ë¡£
222 .\"O .SS Persistence
223 .SS »ý³À­
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 ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Ï¥«¡¼¥Í¥ëÆâ¤ÇÊÝ»ý¤µ¤ì¤ë¡£
229 .BR mq_unlink (3)
230 ¤Çºï½ü¤µ¤ì¤Ê¤±¤ì¤Ð¡¢¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Ï
231 ¥·¥¹¥Æ¥à¤¬¥·¥ã¥Ã¥È¥À¥¦¥ó¤µ¤ì¤ë¤Þ¤Ç¸ºß¤·Â³¤±¤ë¡£
232 .\"O .SS Linking
233 .SS ¥ê¥ó¥¯
234 .\"O Programs using the POSIX message queue API must be compiled with
235 .\"O .I cc \-lrt
236 .\"O to link against the real-time library,
237 .\"O .IR librt .
238 POSIX ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼ API ¤ò»ÈÍѤ·¤¿¥×¥í¥°¥é¥à¤Ï
239 .I cc \-lrt
240 ¤Ç¥³¥ó¥Ñ¥¤¥ë¤·¡¢¥ê¥¢¥ë¥¿¥¤¥à¥é¥¤¥Ö¥é¥ê
241 .I librt
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 ¥á¥â¥ê¤ÎÎ̤òÀ©¸Â¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
249 .TP
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
258 .\"O .I msg_max
259 .\"O is 10.
260 .\"O The minimum value is 1 (10 in kernels before 2.6.28).
261 .\"O The upper limit is
262 .\"O .BR HARD_MAX :
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 ),
267 .\"O but the
268 .\"O .B HARD_MAX
269 .\"O ceiling is nevertheless imposed.
270 ¤³¤Î¥Õ¥¡¥¤¥ë¤ò»È¤Ã¤Æ¡¢°ì¤Ä¤Î¥­¥å¡¼¤ËÆþ¤ì¤é¤ì¤ë¥á¥Ã¥»¡¼¥¸¤ÎºÇÂç¿ô¤Î
271 ¾å¸ÂÃͤò»²¾È¤·¤¿¤êÊѹ¹¤·¤¿¤ê¤Ç¤­¤ë¡£¤³¤ÎÃͤϡ¢
272 .BR mq_open (3)
273 ¤ËÅϤ¹
274 .I attr\->mq_maxmsg
275 °ú¤­¿ô¤ËÂФ¹¤ë¾å¸ÂÃͤȤ·¤Æµ¡Ç½¤¹¤ë¡£
276 .I msg_max
277 ¤Î¥Ç¥Õ¥©¥ë¥ÈÃͤϠ10 ¤Ç¡¢
278 ºÇ¾®ÃͤϠ1 (2.6.28 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï 10) ¤Ç¤¢¤ë¡£
279 ¾å¸Â¤Ï¡ÖËä¤á¹þ¤ß¤Î¸ÇÄêÃÍ¡×
280 .RB ( HARD_MAX )
281 ¤Ç
282 .IR "(131072\ /\ sizeof(void\ *))"
283 (Linux/86 ¤Ç¤Ï 32768) ¤Ç¤¢¤ë¡£
284 ¤³¤Î¾å¸Â¤ÏÆø¢¥×¥í¥»¥¹
285 .RB ( CAP_SYS_RESOURCE )
286 ¤Ç¤Ï̵»ë¤µ¤ì¤ë¤¬¡¢Ëä¤á¹þ¤ß¤Î¸ÇÄêÃͤˤè¤ë¾å¸Â¤Ï
287 ¤É¤ó¤Ê¾ì¹ç¤Ë¤Ç¤âŬÍѤµ¤ì¤ë¡£
288 .TP
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
297 .\"O .I msgsize_max
298 .\"O is 8192 bytes.
299 .\"O The minimum value is 128 (8192 in kernels before 2.6.28).
300 .\"O The upper limit for
301 .\"O .I msgsize_max
302 .\"O is 1,048,576 (in kernels before 2.6.28, the upper limit was
303 .\"O .BR INT_MAX ;
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 »²¾È¤·¤¿¤êÊѹ¹¤·¤¿¤ê¤Ç¤­¤ë¡£    
309 ¤³¤ÎÃͤϡ¢      
310 .BR mq_open (3) 
311 ¤ËÅϤ¹  
312 .I attr\->mq_msgsize
313 °ú¤­¿ô¤ËÂФ¹¤ë¾å¸ÂÃͤȤ·¤Æµ¡Ç½¤¹¤ë¡£    
314 .I msgsize_max  
315 ¤Î¥Ç¥Õ¥©¥ë¥ÈÃͤϠ8192 ¥Ð¥¤¥È¤Ç¡¢
316 ºÇ¾®ÃͤϠ128 (2.6.28 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï 8192) ¤Ç¤¢¤ë¡£
317 .I msgsize_max
318 ¤Î¾å¸Â¤Ï 1,048,576 ¤Ç¤¢¤ë
319 (2.6.28 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï¡¢¾å¸Â¤Ï
320 .B INT_MAX
321 (Linux/86 ¤Ç¤Ï 2,147,483,647) ¤Ç¤¢¤Ã¤¿)¡£
322 ¤³¤Î¾å¸Â¤ÏÆø¢¥×¥í¥»¥¹  
323 .RB ( CAP_SYS_RESOURCE )        
324 ¤Ç¤Ï̵»ë¤µ¤ì¤ë¡£
325 .TP
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
333 .\"O .I queues_max
334 .\"O is 256; it can be changed to any value in the range 0 to INT_MAX.
335 ¤³¤Î¥Õ¥¡¥¤¥ë¤ò»È¤Ã¤Æ¡¢ºîÀ®¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Î¿ô¤Ë        
336 ÂФ¹¤ë¥·¥¹¥Æ¥àÁ´ÂΤǤÎÀ©¸Â¤ò»²¾È¤·¤¿¤êÊѹ¹¤·¤¿¤ê¤Ç¤­¤ë¡£        
337 °ìÅÙ¤³¤Î¾å¸Â¤Ë㤹¤ë¤È¡¢¿·¤·¤¤¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤òºîÀ®¤Ç¤­¤ë¤Î¤Ï  
338 Æø¢¥×¥í¥»¥¹    
339 .RB ( CAP_SYS_RESOURCE )        
340 ¤À¤±¤È¤Ê¤ë¡£    
341 .I queues_max   
342 ¤Î¥Ç¥Õ¥©¥ë¥ÈÃͤϠ256 ¤Ç¤¢¤ê¡¢   
343 0 ¤«¤é INT_MAX ¤ÎÈϰϤÎǤ°Õ¤ÎÃͤËÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
344 .\"O .SS Resource limit
345 .SS ¥ê¥½¡¼¥¹À©¸Â
346 .\"O The
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).
352 ¥ê¥½¡¼¥¹¾å¸Â
353 .B RLIMIT_MSGQUEUE
354 ¤Ï¡¢¥×¥í¥»¥¹¤Î¼Â UID ¤ËÂбþ¤¹¤ëÁ´¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤¬¾ÃÈñ¤¹¤ë
355 ¥á¥â¥ê¶õ´Ö¤ÎÎ̤ËÂФ·¤Æ¾å¸Â¤òÀßÄꤹ¤ë¡£
356 .BR getrlimit (2)
357 ¤ò»²¾È¡£
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
364 .\"O commands:
365 Linux ¤Ç¤Ï¡¢¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Ï²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥àÆâ¤ËºîÀ®¤µ¤ì¤ë
366 (¾¤Î¼ÂÁõ¤Ç¤âƱÍͤε¡Ç½¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¤â¤Î¤â¤¢¤ë¤¬¡¢
367 ¾ÜºÙ¤Ï°ã¤Ã¤Æ¤¤¤ë¤À¤í¤¦)¡£
368 °Ê²¼¤Î¥³¥Þ¥ó¥É¤ò»È¤¦¤³¤È¤Ç (¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¤Ï)
369 ¤³¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ò¥Þ¥¦¥ó¥È¤Ç¤­¤ë:
370 .in +4n
371 .nf
372
373 .RB "#" " mkdir /dev/mqueue"
374 .RB "#" " mount \-t mqueue none /dev/mqueue"
375
376 .fi
377 .in
378 .\"O The sticky bit is automatically enabled on the mount directory.
379 ¥Þ¥¦¥ó¥È¤·¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Î¥¹¥Æ¥£¥Ã¥­¡¼¥Ó¥Ã¥È (sticky bit) ¤Ï
380 ¼«Æ°Åª¤Ë¥ª¥ó¤È¤Ê¤ë¡£
381
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
384 .\"O (e.g.,
385 .\"O .BR ls (1)
386 .\"O and
387 .\"O .BR rm (1)).
388 ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¡¦¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥Þ¥¦¥ó¥È¸å¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ
389 Ä̾ï»È¤¦¥³¥Þ¥ó¥É (Î㤨¤Ð
390 .BR ls (1)
391 ¤ä
392 .BR rm (1))
393 ¤ò»È¤Ã¤Æ¡¢¥·¥¹¥Æ¥à¾å¤Î¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤òɽ¼¨¤·¤¿¤ê
394 Áàºî¤·¤¿¤ê¤Ç¤­¤ë¡£
395
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 ¥­¥å¡¼¤Ë´Ø¤¹¤ë¾ðÊó¤¬É½¼¨¤µ¤ì¤ë¡£
400 .in +4n
401 .nf
402
403 .RB "$" " cat /dev/mqueue/mymq"
404 QSIZE:129     NOTIFY:2    SIGNO:0    NOTIFY_PID:8260
405
406 .fi
407 .in
408 .\"O These fields are as follows:
409 ³Æ¥Õ¥£¡¼¥ë¥É¤Î¾ÜºÙ¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë:
410 .TP
411 .B QSIZE
412 .\"O Number of bytes of data in all messages in the queue.
413 ¥­¥å¡¼¤ËÆþ¤Ã¤Æ¤¤¤ëÁ´¥á¥Ã¥»¡¼¥¸¤Î¹ç·×¥Ð¥¤¥È¿ô¡£
414 .TP
415 .B NOTIFY_PID
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 ¤ò»ý¤Ä¥×¥í¥»¥¹¤¬
421 .BR mq_notify (3)
422 ¤ò»È¤Ã¤Æ¡¢ÈóƱ´ü¤Î¥á¥Ã¥»¡¼¥¸ÄÌÃΤò¹Ô¤¦¤è¤¦¤ËÀßÄꤷ¤¿¤³¤È¤ò¼¨¤¹¡£
423 ¤É¤Î¤è¤¦¤ËÄÌÃΤ¬¹Ô¤ï¤ì¤ë¤«¤Ï¡¢°Ê²¼¤Î¥Õ¥£¡¼¥ë¥É¤Ë¤è¤ê·èÄꤵ¤ì¤ë¡£
424 .TP
425 .B NOTIFY
426 .\"O Notification method:
427 .\"O 0 is
428 .\"O .BR SIGEV_SIGNAL ;
429 .\"O 1 is
430 .\"O .BR SIGEV_NONE ;
431 .\"O and
432 .\"O 2 is
433 .\"O .BR SIGEV_THREAD .
434 ÄÌÃÎÊýË¡:
435 0 ¤Ï
436 .BR SIGEV_SIGNAL ;
437 1 ¤Ï
438 .BR SIGEV_NONE ;
439 2 ¤Ï
440 .B SIGEV_THREAD
441 .TP
442 .B SIGNO
443 .\"O Signal number to be used for
444 .\"O .BR SIGEV_SIGNAL .
445 .B 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
451 .\"O .BR select (2),
452 .\"O .BR poll (2),
453 .\"O or
454 .\"O .BR epoll (7).
455 .\"O This is not portable.
456 Linux ¤Ç¤Ï¡¢¥á¥Ã¥»¡¼¥¸¥­¥å¡¼µ­½Ò»Ò¤Ï¼ÂºÝ¤Ï¥Õ¥¡¥¤¥ëµ­½Ò»Ò (file descriptor)
457 ¤Ç¤¢¤ê¡¢
458 .BR select (2),
459 .BR poll (2),
460 .BR epoll (7)
461 ¤ò»È¤Ã¤Æ´Æ»ë¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
462 ¤³¤Îµ¡Ç½¤Î°Ü¿¢À­¤Ï¤Ê¤¤¡£
463 .\"O .SH "CONFORMING TO"
464 .SH ½àµò
465 POSIX.1-2001.
466 .\"O .SH NOTES
467 .SH Ãí°Õ
468 .\"O System V message queues
469 .\"O .RB ( msgget (2),
470 .\"O .BR msgsnd (2),
471 .\"O .BR msgrcv (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 ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼
478 .RB ( msgget (2),
479 .BR msgsnd (2),
480 .BR msgrcv (2)
481 ¤Ê¤É) ¤Ï¥×¥í¥»¥¹´Ö¤Ç¥á¥Ã¥»¡¼¥¸¤ò¤ä¤ê¼è¤ê¤¹¤ë¤¿¤á¤Î¸Å¤¤ API ¤Ç¤¢¤ë¡£
482 POSIX ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Ï System V ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤è¤ê¤â¤¦¤Þ¤¯
483 À߷פµ¤ì¤¿¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤òÄ󶡤·¤Æ¤¤¤ë¡£
484 °ìÊý¤Ç¡¢POSIX ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Ï System V ¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤ÈÈæ¤Ù¤ë¤È
485 ÍøÍѤǤ­¤ë¥·¥¹¥Æ¥à¤¬¾¯¤Ê¤¤ (Æäˡ¢¸Å¤¤¥·¥¹¥Æ¥à¤Ç¤Ï¾¯¤Ê¤¤)¡£
486
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) ¤Ë
491 Âбþ¤·¤Æ¤¤¤Ê¤¤¡£
492 .\"O .SH EXAMPLE
493 .SH Îã
494 .\"O An example of the use of various message queue functions is shown in
495 .\"O .BR mq_notify (3).
496 ³Æ¼ï¤Î¥á¥Ã¥»¡¼¥¸¥­¥å¡¼´Ø¿ô¤ò»ÈÍѤ·¤¿Î㤬
497 .BR mq_notify (3)
498 ¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ë¡£
499 .\"O .SH "SEE ALSO"
500 .SH ´ØÏ¢¹àÌÜ
501 .BR getrlimit (2),
502 .BR mq_getsetattr (2),
503 .BR poll (2),
504 .BR select (2),
505 .BR mq_close (3),
506 .BR mq_getattr (3),
507 .BR mq_notify (3),
508 .BR mq_open (3),
509 .BR mq_receive (3),
510 .BR mq_send (3),
511 .BR mq_unlink (3),
512 .BR epoll (7)