OSDN Git Service

064fb31460a5f55aa2023f91c02f6bb286b05dca
[linuxjm/LDP_man-pages.git] / draft / man2 / msgctl.2
1 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
2 .\" and Copyright 2004, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"
24 .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
25 .\" Modified Sun Feb 18 01:59:29 2001 by Andries E. Brouwer <aeb@cwi.nl>
26 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
27 .\"     Added notes on CAP_IPC_OWNER requirement
28 .\" Modified, 17 Jun 2004, Michael Kerrisk <mtk.manpages@gmail.com>
29 .\"     Added notes on CAP_SYS_ADMIN requirement for IPC_SET and IPC_RMID
30 .\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
31 .\"     Language and formatting clean-ups
32 .\"     Added msqid_ds and ipc_perm structure definitions
33 .\" 2005-08-02, mtk: Added IPC_INFO, MSG_INFO, MSG_STAT descriptions
34 .\"
35 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
36 .\"         all rights reserved.
37 .\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
38 .\" Updated & Modified 2001-06-04, Yuichi SATO <ysato@h4.dion.ne.jp>
39 .\" Updated & Modified 2002-07-06, Yuichi SATO
40 .\" Updated & Modified 2004-12-31, Yuichi SATO <ysato444@yahoo.co.jp>
41 .\" Updated & Modified 2005-10-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
42 .\"
43 .\"WORD:        message                 ¥á¥Ã¥»¡¼¥¸
44 .\"WORD:        queue                   ¥­¥å¡¼
45 .\"WORD:        member                  ¥á¥ó¥Ð¡¼
46 .\"WORD:        structure               ¹½Â¤ÂÎ
47 .\"WORD:        effective user ID       ¼Â¸ú¥æ¡¼¥¶ ID
48 .\"WORD:        creator                 ºîÀ®¼Ô
49 .\"WORD:        owner                   ½êÍ­¼Ô
50 .\"WORD:        feature test macro      µ¡Ç½¸¡ºº¥Þ¥¯¥í
51 .\"
52 .TH MSGCTL 2 2008-08-06 "Linux" "Linux Programmer's Manual"
53 .\"O .SH NAME
54 .SH Ì¾Á°
55 .\"O msgctl \- message control operations
56 msgctl \- ¥á¥Ã¥»¡¼¥¸À©¸æÁàºî
57 .\"O .SH SYNOPSIS
58 .SH ½ñ¼°
59 .nf
60 .B #include <sys/types.h>
61 .B #include <sys/ipc.h>
62 .B #include <sys/msg.h>
63
64 .BI "int msgctl(int " msqid ", int " cmd ", struct msqid_ds *" buf );
65 .fi
66 .\"O .SH DESCRIPTION
67 .SH ÀâÌÀ
68 .\"O .BR msgctl ()
69 .\"O performs the control operation specified by
70 .\"O .I cmd
71 .\"O on the message queue with identifier
72 .\"O .IR msqid .
73 .BR msgctl ()
74 ¤Ï¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¼±ÊÌ»Ò
75 .I msqid
76 ¤Ç»ØÄꤵ¤ì¤¿¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼ (message queue) ¤ËÂФ·¤Æ
77 .I cmd
78 ¤Ç»ØÄꤵ¤ì¤¿À©¸æÁàºî¤ò¹Ô¤Ê¤¦¡£
79 .PP
80 .\"O The
81 .\"O .I msqid_ds
82 .\"O data structure is defined in \fI<sys/msg.h>\fP as follows:
83 .I msqid_ds
84 ¥Ç¡¼¥¿¹½Â¤ÂΤϠ\fI<sys/msg.h>\fP ¤Ç°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë:
85 .nf
86 .in +4n
87
88 struct msqid_ds {
89 .\"O     struct ipc_perm msg_perm;     /* Ownership and permissions */
90 .\"O     time_t          msg_stime;    /* Time of last msgsnd(2) */
91 .\"O     time_t          msg_rtime;    /* Time of last msgrcv(2) */
92 .\"O     time_t          msg_ctime;    /* Time of last change */
93 .\"O     unsigned long   __msg_cbytes; /* Current number of bytes in
94 .\"O                                      queue (nonstandard) */
95 .\"O     msgqnum_t       msg_qnum;     /* Current number of messages
96 .\"O                                      in queue */
97 .\"O     msglen_t        msg_qbytes;   /* Maximum number of bytes
98 .\"O                                      allowed in queue */
99 .\"O     pid_t           msg_lspid;    /* PID of last msgsnd(2) */
100 .\"O     pid_t           msg_lrpid;    /* PID of last msgrcv(2) */
101     struct ipc_perm msg_perm;     /* ½êÍ­¸¢¤Èµö²Ä */
102     time_t          msg_stime;    /* ºÇ¸å¤Î msgsnd(2) ¤Î»þ¹ï */
103     time_t          msg_rtime;    /* ºÇ¸å¤Î msgrcv(2) ¤Î»þ¹ï */
104     time_t          msg_ctime;    /* ºÇ¸å¤ËÊѹ¹¤¬¹Ô¤ï¤ì¤¿»þ¹ï */
105     unsigned long   __msg_cbytes; /* ¥­¥å¡¼¤Ë¤¢¤ë¸½ºß¤Î¥Ð¥¤¥È¿ô
106                                      (Èóɸ½à) */
107     msgqnum_t       msg_qnum;     /* ¥­¥å¡¼¤Ë¤¢¤ë¸½ºßÆþ¤Ã¤Æ¤¤¤ë
108                                      ¥á¥Ã¥»¡¼¥¸¤Î¿ô */
109     msglen_t        msg_qbytes;   /* ¥­¥å¡¼¤Ëµö²Ä¤µ¤ì¤Æ¤¤¤ë
110                                      ºÇÂç¥Ð¥¤¥È¿ô */
111     pid_t           msg_lspid;    /* ºÇ¸å¤Î msgsnd(2) ¤Î PID */
112     pid_t           msg_lrpid;    /* ºÇ¸å¤Î msgrcv(2) ¤Î PID */
113 };
114 .in
115 .fi
116 .PP
117 .\"O The
118 .\"O .I ipc_perm
119 .\"O structure is defined in \fI<sys/ipc.h>\fP as follows
120 .\"O (the highlighted fields are settable using
121 .\"O .BR IPC_SET ):
122 .I ipc_perm
123 ¹½Â¤ÂΤϠ\fI<sys/ipc.h>\fP ¤Ç°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë
124 (¶¯Ä´¤µ¤ì¤¿¥Õ¥£¡¼¥ë¥É¤Ï
125 .B IPC_SET
126 ¤ò»È¤Ã¤ÆÀßÄê²Äǽ¤Ç¤¢¤ë):
127 .PP
128 .nf
129 .in +4n
130 struct ipc_perm {
131 .\"O     key_t          __key;       /* Key supplied to msgget(2) */
132 .\"O     uid_t          \fBuid\fP;         /* Effective UID of owner */
133 .\"O     gid_t          \fBgid\fP;         /* Effective GID of owner */
134 .\"O     uid_t          cuid;        /* Effective UID of creator */
135 .\"O     gid_t          cgid;        /* Effective GID of creator */
136 .\"O     unsigned short \fBmode\fP;        /* Permissions */
137 .\"O     unsigned short __seq;       /* Sequence number */
138     key_t          __key;       /* msgget(2) ¤ËÍ¿¤¨¤ë¥­¡¼ */
139     uid_t          \fBuid\fP;         /* ½êÍ­¼Ô¤Î¼Â¸ú UID */
140     gid_t          \fBgid\fP;         /* ½êÍ­¼Ô¤Î¼Â¸ú GID */
141     uid_t          cuid;        /* ºîÀ®¼Ô¤Î¼Â¸ú UID */
142     gid_t          cgid;        /* ºîÀ®¼Ô¤Î¼Â¸ú GID */
143     unsigned short \fBmode\fP;        /* µö²Ä */
144     unsigned short __seq;       /* ¥·¡¼¥±¥ó¥¹ÈÖ¹æ */
145 };
146 .in
147 .fi
148 .PP
149 .\"O Valid values for
150 .\"O .I cmd
151 .\"O are:
152 .I cmd
153 ¤È¤·¤ÆÍ­¸ú¤ÊÃͤÏ:
154 .TP
155 .B IPC_STAT
156 .\"O Copy information from the kernel data structure associated with
157 .\"O .I msqid
158 .\"O into the
159 .\"O .I msqid_ds
160 .\"O structure pointed to by
161 .\"O .IR buf .
162 .\"O The caller must have read permission on the message queue.
163 .I msqid
164 ¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¡¦¥Ç¡¼¥¿¹½Â¤ÂΤ«¤é¡¢¥Ý¥¤¥ó¥¿
165 .I buf
166 ¤¬»Ø¤·¼¨¤¹
167 .I msqid_ds
168 ¹½Â¤ÂΤ˾ðÊó¤ò¥³¥Ô¡¼¤¹¤ë¡£
169 ¸Æ¤Ó½Ð¤·Â¦¤Ï¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤ËÂФ¹¤ëÆɤ߹þ¤ßµö²Ä¤ò»ý¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
170 .TP
171 .B IPC_SET
172 .\"O Write the values of some members of the
173 .\"O .I msqid_ds
174 .\"O structure pointed to by
175 .\"O .I buf
176 .\"O to the kernel data structure associated with this message queue,
177 .\"O updating also its
178 .\"O .I msg_ctime
179 .\"O member.
180 ¥Ý¥¤¥ó¥¿
181 .I buf
182 ¤¬»Ø¤·¼¨¤¹
183 .I msqid_ds
184 ¹½Â¤ÂΤΥá¥ó¥Ð¡¼¤ÎÃͤò¡¢¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿
185 ¥«¡¼¥Í¥ë¡¦¥Ç¡¼¥¿¹½Â¤ÂΤ˽ñ¤­¹þ¤ß¡¢
186 .I msg_ctime
187 ¥á¥ó¥Ð¡¼¤â¹¹¿·¤¹¤ë¡£
188 .\"O The following members of the structure are updated:
189 ¹½Â¤ÂΤΥá¥ó¥Ð¡¼¤Î¤¦¤Á¡¢¹¹¿·¤µ¤ì¤ë¤â¤Î¤ò°Ê²¼¤Ë¼¨¤¹:
190 .\"O .IR msg_qbytes ,
191 .\"O .IR msg_perm.uid ,
192 .\"O .IR msg_perm.gid ,
193 .\"O and (the least significant 9 bits of)
194 .\"O .IR msg_perm.mode .
195 .IR msg_qbytes ,
196 .IR msg_perm.uid ,
197 .IR msg_perm.gid ,
198 .I msg_perm.mode
199 (¤Î²¼°Ì 9 ¥Ó¥Ã¥È)¡£
200 .\"O The effective UID of the calling process must match the owner
201 .\"O .RI ( msg_perm.uid )
202 .\"O or creator
203 .\"O .RI ( msg_perm.cuid )
204 .\"O of the message queue, or the caller must be privileged.
205 ¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤¬¡¢¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤Î½êÍ­¼Ô
206 .RI ( msg_perm.uid )
207 ¤Þ¤¿¤ÏºîÀ®¼Ô
208 .RI ( msg_perm.cuid )
209 ¤È°ìÃפ¹¤ë¤«¡¢¸Æ¤Ó½Ð¤·¸µ¤¬Æø¢¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
210 .\"O Appropriate privilege (Linux: the
211 .\"O .B CAP_IPC_RESOURCE
212 .\"O capability) is required to raise the
213 .\"O .I msg_qbytes
214 .\"O value beyond the system parameter
215 .\"O .BR MSGMNB .
216 .I msg_qbytes
217 ¤ò¥·¥¹¥Æ¥à¡¦¥Ñ¥é¥á¡¼¥¿¤Î
218 .B MSGMNB
219 ¤òĶ¤¨¤ÆÀßÄꤹ¤ë¤Ë¤Ï¡¢Å¬ÀÚ¤ÊÆø¢ (Linux ¤Ç¤Ï
220 .B CAP_IPC_RESOURCE
221 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (capability)) ¤¬É¬ÍפǤ¢¤ë¡£
222 .TP
223 .B IPC_RMID
224 .\"O Immediately remove the message queue,
225 .\"O awakening all waiting reader and writer processes (with an error
226 .\"O return and
227 .\"O .I errno
228 .\"O set to
229 .\"O .BR EIDRM ).
230 ¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤ò¤¿¤À¤Á¤Ëºï½ü¤¹¤ë¡£
231 Ʊ»þ¤Ë¤½¤Î¹½Â¤ÂΤÎÆɤ߽ñ¤­¤ÎÂÔ¤Á¾õÂ֤ˤ¢¤Ã¤¿¥×¥í¥»¥¹¤ËÄÌÃΤ¹¤ë
232 (¥¨¥é¡¼¤¬Ê֤ꡢ
233 .I errno
234 ¤¬
235 .B EIDRM
236 ¤ËÀßÄꤵ¤ì¤ë)¡£
237 .\"O The calling process must have appropriate privileges
238 .\"O or its effective user ID must be either that of the creator or owner
239 .\"O of the message queue.
240 ¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤¬Å¬ÀÚ¤ÊÆø¢¤ò»ý¤Ã¤Æ¤¤¤ë¤«¡¢
241 ¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤¬¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤ÎºîÀ®¼Ô¤«
242 ½êÍ­¼Ô¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
243 .TP
244 .\"O .BR IPC_INFO " (Linux-specific)"
245 .BR IPC_INFO " (Linux ¸ÇÍ­)"
246 .\"O Returns information about system-wide message queue limits and
247 .\"O parameters in the structure pointed to by
248 .\"O .IR buf .
249 ¥·¥¹¥Æ¥àÁ´ÂΤǤΥá¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤ÎÀ©¸Â¤È¥Ñ¥é¥á¡¼¥¿¤Ë´Ø¤¹¤ë¾ðÊó¤ò¡¢
250 .I buf
251 ¤¬»Ø¤¹¹½Â¤ÂΤËÆþ¤ì¤ÆÊÖ¤¹¡£
252 .\"O This structure is of type
253 .\"O .I msginfo
254 .\"O (thus, a cast is required),
255 .\"O defined in
256 .\"O .I <sys/msg.h>
257 .\"O if the
258 .\"O .B _GNU_SOURCE
259 .\"O feature test macro is defined:
260 ¤³¤Î¹½Â¤ÂΤÏ
261 .I msginfo
262 ·¿¤Ç¤¢¤ë (¤½¤Î¤¿¤á¥­¥ã¥¹¥È¤¬É¬ÍפǤ¢¤ë)¡£
263 .I msginfo
264 ¤Ï
265 .B _GNU_SOURCE
266 µ¡Ç½¸¡ºº¥Þ¥¯¥í¤¬ÄêµÁ¤µ¤ì¤¿¾ì¹ç¤Ë
267 .I <sys/msg.h>
268 ¤Ç°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤ë:
269 .nf
270 .in +4n
271
272 struct msginfo {
273 .\"O     int msgpool; /* Size in kibibytes of buffer pool
274 .\"O                     used to hold message data;
275 .\"O                     unused within kernel */
276 .\"O     int msgmap;  /* Maximum number of entries in message
277 .\"O                     map; unused within kernel */
278 .\"O     int msgmax;  /* Maximum number of bytes that can be
279 .\"O                     written in a single message */
280 .\"O     int msgmnb;  /* Maximum number of bytes that can be
281 .\"O                     written to queue; used to initialize
282 .\"O                     msg_qbytes during queue creation
283 .\"O                     (msgget(2)) */
284 .\"O     int msgmni;  /* Maximum number of message queues */
285 .\"O     int msgssz;  /* Message segment size;
286 .\"O                     unused within kernel */
287 .\"O     int msgtql;  /* Maximum number of messages on all queues
288 .\"O                     in system; unused within kernel */
289 .\"O     unsigned short int msgseg;
290 .\"O                  /* Maximum number of segments;
291 .\"O                     unused within kernel */
292     int msgpool; /* ¥á¥Ã¥»¡¼¥¸¡¦¥Ç¡¼¥¿¤ÎÊÝ»ý¤Ë»ÈÍѤµ¤ì¤ë
293                     ¥Ð¥Ã¥Õ¥¡¡¦¥×¡¼¥ë¤ÎÂ礭¤µ (1024 ¥Ð¥¤¥Èñ°Ì);
294                     ¥«¡¼¥Í¥ëÆâ¤Ç¤Ï̤»ÈÍÑ */
295     int msgmap;  /* ¥á¥Ã¥»¡¼¥¸¡¦¥Þ¥Ã¥×¤ÎºÇÂ票¥ó¥È¥ê¿ô;
296                     ¥«¡¼¥Í¥ëÆâ¤Ç¤Ï̤»ÈÍÑ */
297     int msgmax;  /* °ì¤Ä¤Î¥á¥Ã¥»¡¼¥¸¤Ë½ñ¤­¹þ¤ß²Äǽ¤Ê
298                     ºÇÂç¥Ð¥¤¥È¿ô */
299     int msgmnb;  /* °ì¤Ä¤Î¥­¥å¡¼¤Ë½ñ¤­¹þ¤ß²Äǽ¤ÊºÇÂç¥Ð¥¤¥È¿ô;
300                     (msgget(2) ¤Ç¤Î) ¥­¥å¡¼ºîÀ®Ãæ¤Î msg_qbytes
301                     ¤Î½é´ü²½¤Ë»ÈÍѤµ¤ì¤ë */
302     int msgmni;  /* ¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤Î¿ô¤ÎºÇÂçÃÍ */
303     int msgssz;  /* ¥á¥Ã¥»¡¼¥¸¡¦¥»¥°¥á¥ó¥È¤Î¥µ¥¤¥º;
304                     ¥«¡¼¥Í¥ëÆâ¤Ç¤Ï̤»ÈÍÑ */
305     int msgtql;  /* ¥·¥¹¥Æ¥à¾å¤ÎÁ´¥­¥å¡¼¤ÎºÇÂç¥á¥Ã¥»¡¼¥¸¿ô;
306                     ¥«¡¼¥Í¥ëÆâ¤Ç¤Ï̤»ÈÍÑ */
307     unsigned short int msgseg;
308                  /* ºÇÂ祻¥°¥á¥ó¥È¿ô; ¥«¡¼¥Í¥ëÆâ¤Ç¤Ï̤»ÈÍÑ */
309 };
310
311 .in
312 .fi
313 .\"O The
314 .\"O .IR msgmni ,
315 .\"O .IR msgmax ,
316 .\"O and
317 .\"O .I msgmnb
318 .\"O settings can be changed via
319 .\"O .I /proc
320 .\"O files of the same name; see
321 .\"O .BR proc (5)
322 .\"O for details.
323 ÀßÄê
324 .I msgmni ,
325 .I msgmax ,
326 .I msgmnb
327 ¤Ï
328 .I /proc
329 ¤Ë¤¢¤ëƱ¤¸Ì¾Á°¤Î¥Õ¥¡¥¤¥ë·Ðͳ¤ÇÊѹ¹²Äǽ¤Ç¤¢¤ë¡£
330 ¾Ü¤·¤¯¤Ï
331 .BR proc (5)
332 ¤ò»²¾È¡£
333 .TP
334 .\"O .BR MSG_INFO " (Linux-specific)"
335 .BR MSG_INFO " (Linux ¸ÇÍ­)"
336 .\"O Returns a
337 .\"O .I msginfo
338 .\"O structure containing the same information as for
339 .\"O .BR IPC_INFO ,
340 .\"O except that the following fields are returned with information
341 .\"O about system resources consumed by message queues: the
342 .\"O .I msgpool
343 .\"O field returns the number of message queues that currently exist
344 .\"O on the system; the
345 .\"O .I msgmap
346 .\"O field returns the total number of messages in all queues
347 .\"O on the system; and the
348 .\"O .I msgtql
349 .\"O field returns the total number of bytes in all messages
350 .\"O in all queues on the system.
351 .B IPC_INFO
352 ¤Î¤È¤­¤ÈƱ¤¸¾ðÊó¤ò³ÊǼ¤·¤¿
353 .I msginfo
354 ¹½Â¤ÂΤòÊÖ¤¹¡£
355 ⤷¡¢°Ê²¼¤Î¥Õ¥£¡¼¥ë¥É¤Ë¤Ï¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤¬
356 ¾ÃÈñ¤·¤Æ¤¤¤ë¥·¥¹¥Æ¥à»ñ¸»¤Ë´Ø¤¹¤ë¾ðÊ󤬳ÊǼ¤µ¤ì¤ëÅÀ¤¬°Û¤Ê¤ë¡£
357 .I msgpool
358 ¥Õ¥£¡¼¥ë¥É¤Ï¸½ºß¥·¥¹¥Æ¥à¾å¤Ë¸ºß¤¹¤ë¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤Î¿ô¤òÊÖ¤¹¡£
359 .I msgmap
360 ¥Õ¥£¡¼¥ë¥É¤Ï¥·¥¹¥Æ¥à¾å¤ÎÁ´¤Æ¤Î¥­¥å¡¼¤ËÆþ¤Ã¤Æ¤¤¤ë¥á¥Ã¥»¡¼¥¸Áí¿ô¤òÊÖ¤¹¡£
361 .I msgtql
362 ¥Õ¥£¡¼¥ë¥É¤Ï¥·¥¹¥Æ¥à¾å¤ÎÁ´¤Æ¤Î¥­¥å¡¼¤ËÆþ¤Ã¤Æ¤¤¤ëÁ´¥á¥Ã¥»¡¼¥¸¤Î
363 Áí¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
364 .TP
365 .\"O .BR MSG_STAT " (Linux-specific)"
366 .BR MSG_STAT " (Linux ¸ÇÍ­)"
367 .\"O Returns a
368 .\"O .I msqid_ds
369 .\"O structure as for
370 .\"O .BR IPC_STAT .
371 .B IPC_STAT
372 ¤ÈƱ¤¸¤¯
373 .I msqid_ds
374 ¹½Â¤ÂΤòÊÖ¤¹¡£
375 .\"O However, the
376 .\"O .I msqid
377 .\"O argument is not a queue identifier, but instead an index into
378 .\"O the kernel's internal array that maintains information about
379 .\"O all message queues on the system.
380 ⤷¡¢
381 .I msqid
382 °ú¤­¿ô¤Ï¡¢¥­¥å¡¼¼±Ê̻ҤǤϤʤ¯¡¢¥·¥¹¥Æ¥à¾å¤ÎÁ´¤Æ¤Î¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼
383 ¤Ë´Ø¤¹¤ë¾ðÊó¤ò´ÉÍý¤¹¤ë¥«¡¼¥Í¥ë¤ÎÆâÉôÇÛÎó¤Ø¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ç¤¢¤ë¡£
384 .\"O .SH "RETURN VALUE"
385 .SH ÊÖ¤êÃÍ
386 .\"O On success,
387 .\"O .BR IPC_STAT ,
388 .\"O .BR IPC_SET ,
389 .\"O and
390 .\"O .B IPC_RMID
391 .\"O return 0.
392 À®¸ù¤¹¤ë¤È¡¢
393 .BR IPC_STAT ,
394 .BR IPC_SET ,
395 .B IPC_RMID
396 ¤Ï 0 ¤òÊÖ¤¹¡£
397 .\"O A successful
398 .\"O .B IPC_INFO
399 .\"O or
400 .\"O .B MSG_INFO
401 .\"O operation returns the index of the highest used entry in the
402 .\"O kernel's internal array recording information about all
403 .\"O message queues.
404 .B IPC_INFO
405 ¤È
406 .B MSG_INFO
407 Áàºî¤Ï¡¢À®¸ù¤¹¤ë¤È¡¢Á´¤Æ¤Î¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤Ë´Ø¤¹¤ë¾ðÊó¤ò
408 ´ÉÍý¤·¤Æ¤¤¤ë¥«¡¼¥Í¥ë¤ÎÆâÉôÇÛÎó¤Î»ÈÍÑÃ楨¥ó¥È¥ê¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î
409 ¤¦¤ÁºÇÂçÃͤòÊÖ¤¹
410 .\"O (This information can be used with repeated
411 .\"O .B MSG_STAT
412 .\"O operations to obtain information about all queues on the system.)
413 (¤³¤Î¾ðÊó¤Ï¡¢¥·¥¹¥Æ¥à¤ÎÁ´¤Æ¤Î¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤Ë´Ø¤¹¤ë¾ðÊó¤ò
414 ¼èÆÀ¤¹¤ë¤¿¤á¤Ë¡¢
415 .B MSG_STAT
416 Áàºî¤ò·«¤êÊÖ¤·¼Â¹Ô¤¹¤ëºÝ¤Ë»ÈÍѤǤ­¤ë)¡£
417 .\"O A successful
418 .\"O .B MSG_STAT
419 .\"O operation returns the identifier of the queue whose index was given in
420 .\"O .IR msqid .
421 .B MSG_STAT
422 Áàºî¤Ï¡¢À®¸ù¤¹¤ë¤È¡¢
423 .I msqid
424 ¤Ç»ØÄꤵ¤ì¤¿¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»ý¤Ä¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤Î¼±Ê̻ҤòÊÖ¤¹¡£
425
426 .\"O On error, \-1 is returned with
427 .\"O .I errno
428 .\"O indicating the error.
429 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
430 .I errno
431 ¤òŬÀÚ¤ËÀßÄꤹ¤ë¡£
432 .\"O .SH ERRORS
433 .SH ¥¨¥é¡¼
434 .\"O On failure,
435 .\"O .I errno
436 .\"O is set to one of the following:
437 ¼ºÇÔ¤·¤¿¾ì¹ç¡¢
438 .I errno
439 ¤Ï°Ê²¼¤ÎÃͤÎÃæ¤Î¤É¤ì¤«°ì¤Ä¤ËÀßÄꤵ¤ì¤ë:
440 .TP
441 .B EACCES
442 .\"O The argument
443 .\"O .I cmd
444 .\"O is equal to
445 .\"O .B IPC_STAT
446 .\"O or
447 .\"O .BR MSG_STAT ,
448 .\"O but the calling process does not have read permission on the message queue
449 .\"O .IR msqid ,
450 .\"O and does not have the
451 .\"O .B CAP_IPC_OWNER
452 .\"O capability.
453 °ú¤­¿ô
454 .I cmd
455 ¤¬
456 .B IPC_STAT
457 ¤Þ¤¿¤Ï
458 .B MSG_STAT
459 ¤ËÅù¤·¤¤¤¬¡¢¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤¬¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼
460 .I msqid
461 ¤ËÂФ¹¤ëÆɤ߹þ¤ßµö²Ä¤ò»ý¤Ã¤Æ¤ª¤é¤º¡¢¤«¤Ä
462 .B CAP_IPC_OWNER
463 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
464 .TP
465 .B EFAULT
466 .\"O The argument
467 .\"O .I cmd
468 .\"O has the value
469 .\"O .B IPC_SET
470 .\"O or
471 .\"O .BR IPC_STAT ,
472 .\"O but the address pointed to by
473 .\"O .I buf
474 .\"O isn't accessible.
475 °ú¤­¿ô
476 .I cmd
477 ¤¬
478 .B IPC_SET
479 ¤«
480 .B IPC_STAT
481 ¤Ç¡¢¥Ý¥¤¥ó¥¿
482 .I buf
483 ¤Ç»Ø¤µ¤ì¤Æ¤¤¤ë¥¢¥É¥ì¥¹¤¬¥¢¥¯¥»¥¹²Äǽ¤Ç¤Ê¤¤¡£
484 .TP
485 .B EIDRM
486 .\"O The message queue was removed.
487 ¥á¥Ã¥»¡¼¥¸¡¦¥­¥å¡¼¤¬ºï½ü¤µ¤ì¤¿¡£
488 .TP
489 .B EINVAL
490 .\"O Invalid value for
491 .\"O .I cmd
492 .\"O or
493 .\"O .IR msqid .
494 .\"O Or: for a
495 .\"O .B MSG_STAT
496 .\"O operation, the index value specified in
497 .\"O .I msqid
498 .\"O referred to an array slot that is currently unused.
499 .I cmd
500 ¤Þ¤¿¤Ï
501 .I msqid
502 ¤ËÉÔÀµ¤ÊÃͤ¬ÀßÄꤵ¤ì¤¿¡£
503 ¤â¤·¤¯¤Ï¡¢
504 .B MSG_STAT
505 Áàºî¤Î¾ì¹ç¤Ë¡¢
506 .I msqid
507 ¤Ç»ØÄꤵ¤ì¤¿¥¤¥ó¥Ç¥Ã¥¯¥¹Ãͤ¬¸½ºß̤»ÈÍѤÎÇÛÎó¤Î¥¹¥í¥Ã¥È¤ò»²¾È¤¤¤Æ¤¤¤¿¡£
508 .TP
509 .B EPERM
510 .\"O The argument
511 .\"O .I cmd
512 .\"O has the value
513 .\"O .B IPC_SET
514 .\"O or
515 .\"O .BR IPC_RMID ,
516 .\"O but the effective user ID of the calling process is not the creator
517 .\"O (as found in
518 .\"O .IR msg_perm.cuid )
519 .\"O or the owner
520 .\"O (as found in
521 .\"O .IR msg_perm.uid )
522 .\"O of the message queue,
523 .\"O and the process is not privileged (Linux: it does not have the
524 .\"O .B CAP_SYS_ADMIN
525 .\"O capability).
526 °ú¤­¿ô
527 .I cmd
528 ¤¬
529 .B IPC_SET
530 ¤«
531 .B IPC_RMID
532 ¤Ç¤¢¤ë¤¬¡¢¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤¬¥á¥Ã¥»¡¼¥¸¥­¥å¡¼¤Î
533 .RI ( msg_perm.cuid
534 ¤È¤·¤Æ¸«¤Ä¤«¤ë) ºîÀ®¼Ô
535 ¤È
536 .RI ( msg_perm.uid
537 ¤È¤·¤Æ¸«¤Ä¤«¤ë) ½êÍ­¼Ô¤Î¤¤¤º¤ì¤Ç¤â¤Ê¤¯¡¢
538 ¤«¤Ä¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤ËÆø¢ (Linux ¤Ç¤Ï
539 .B CAP_SYS_ADMIN
540 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£) ¤¬¤Ê¤¤¡£
541 .\"O .SH "CONFORMING TO"
542 .SH ½àµò
543 SVr4, POSIX.1-2001.
544 .\"O .\" SVID does not document the EIDRM error condition.
545 .\" SVID ¤Ë¤Ï EIDRM ¥¨¥é¡¼¤Ë¤Ä¤¤¤Æ¤Îµ­½Ò¤Ï¤Ê¤¤¡£
546 .\"O .SH NOTES
547 .SH Ãí°Õ
548 .\"O The
549 .\"O .BR IPC_INFO ,
550 .\"O .B MSG_STAT
551 .\"O and
552 .\"O .B MSG_INFO
553 .\"O operations are used by the
554 .\"O .BR ipcs (8)
555 .\"O program to provide information on allocated resources.
556 .\"O In the future these may modified or moved to a /proc file system
557 .\"O interface.
558 .BR IPC_INFO ,
559 .BR MSG_STAT ,
560 .B MSG_INFO
561 Áàºî¤Ï¡¢
562 .BR ipcs (8)
563 ¥×¥í¥°¥é¥à¤Ç³ä¤êÅö¤ÆºÑ¤Î»ñ¸»¤Ë´Ø¤¹¤ë¾ðÊó¤òÄ󶡤¹¤ë¤¿¤á¤Ë
564 »ÈÍѤµ¤ì¤Æ¤¤¤ë¡£¾­Íè¡¢¤³¤ì¤é¤ÎÁàºî¤ÏÊѹ¹¤µ¤ì¤¿¤ê¡¢
565 /proc ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ë°ÜÆ°¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
566
567
568 .\"O Various fields in the \fIstruct msqid_ds\fP were
569 .\"O typed as
570 .\"O .I short
571 .\"O under Linux 2.2
572 .\"O and have become
573 .\"O .I long
574 .\"O under Linux 2.4.
575 .\"O To take advantage of this,
576 .\"O a recompilation under glibc-2.1.91 or later should suffice.
577 .\"O (The kernel distinguishes old and new calls by an
578 .\"O .B IPC_64
579 .\"O flag in
580 .\"O .IR cmd .)
581 \fIstruct msqid_ds\fP Æâ¤Î¿¤¯¤Î¥Õ¥£¡¼¥ë¥É¤Ï¡¢
582 Linux 2.2 ¤Ç¤Ï
583 .I short
584 ¤À¤Ã¤¿¤¬¡¢Linux 2.4 ¤Ç¤Ï
585 .I long
586 ¤Ë¤Ê¤Ã¤¿¡£
587 ¤³¤ÎÍøÅÀ¤òÀ¸¤«¤¹¤Ë¤Ï¡¢glibc-2.1.91 °Ê¹ß¤Î´Ä¶­²¼¤Ç
588 ºÆ¥³¥ó¥Ñ¥¤¥ë¤¹¤ì¤Ð½½Ê¬¤Ç¤¢¤ë¡£
589 (¥«¡¼¥Í¥ë¤Ï¿·¤·¤¤·Á¼°¤Î¸Æ¤Ó½Ð¤·¤È¸Å¤¤·Á¼°¤Î¸Æ¤Ó½Ð¤·¤ò
590 .I cmd
591 Æâ¤Î
592 .B IPC_64
593 ¥Õ¥é¥°¤Ç¶èÊ̤¹¤ë¡£)
594 .\"O .SH "SEE ALSO"
595 .SH ´ØÏ¢¹àÌÜ
596 .BR msgget (2),
597 .BR msgrcv (2),
598 .BR msgsnd (2),
599 .BR capabilities (7),
600 .BR mq_overview (7),
601 .BR svipc (7)