1 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
2 .\" and Copyright 2004, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
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
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>
43 .\"WORD: message メッセージ
46 .\"WORD: structure 構造体
47 .\"WORD: effective user ID 実効ユーザ ID
50 .\"WORD: feature test macro 機能検査マクロ
52 .TH MSGCTL 2 2008-08-06 "Linux" "Linux Programmer's Manual"
55 .\"O msgctl \- message control operations
60 .B #include <sys/types.h>
61 .B #include <sys/ipc.h>
62 .B #include <sys/msg.h>
64 .BI "int msgctl(int " msqid ", int " cmd ", struct msqid_ds *" buf );
69 .\"O performs the control operation specified by
71 .\"O on the message queue with identifier
76 で指定されたメッセージ・キュー (message queue) に対して
82 .\"O data structure is defined in \fI<sys/msg.h>\fP as follows:
84 データ構造体は \fI<sys/msg.h>\fP で以下のように定義されている:
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
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; /* キューにある現在のバイト数
107 msgqnum_t msg_qnum; /* キューにある現在入っている
109 msglen_t msg_qbytes; /* キューに許可されている
111 pid_t msg_lspid; /* 最後の msgsnd(2) の PID */
112 pid_t msg_lrpid; /* 最後の msgrcv(2) の PID */
119 .\"O structure is defined in \fI<sys/ipc.h>\fP as follows
120 .\"O (the highlighted fields are settable using
123 構造体は \fI<sys/ipc.h>\fP で以下のように定義されている
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; /* シーケンス番号 */
149 .\"O Valid values for
156 .\"O Copy information from the kernel data structure associated with
160 .\"O structure pointed to by
162 .\"O The caller must have read permission on the message queue.
164 に関連づけられたメッセージ・キュー・データ構造体から、ポインタ
169 呼び出し側はメッセージ・キューに対する読み込み許可を持っていなければならない。
172 .\"O Write the values of some members of the
174 .\"O structure pointed to by
176 .\"O to the kernel data structure associated with this message queue,
177 .\"O updating also its
184 構造体のメンバーの値を、メッセージ・キューに関連づけられた
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 .
200 .\"O The effective UID of the calling process must match the owner
201 .\"O .RI ( msg_perm.uid )
203 .\"O .RI ( msg_perm.cuid )
204 .\"O of the message queue, or the caller must be privileged.
205 呼び出したプロセスの実効ユーザ ID が、メッセージ・キューの所有者
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
214 .\"O value beyond the system parameter
219 を超えて設定するには、適切な特権 (Linux では
221 ケーパビリティ (capability)) が必要である。
224 .\"O Immediately remove the message queue,
225 .\"O awakening all waiting reader and writer processes (with an error
231 同時にその構造体の読み書きの待ち状態にあったプロセスに通知する
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 でなければならない。
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
249 システム全体でのメッセージ・キューの制限とパラメータに関する情報を、
252 .\"O This structure is of type
254 .\"O (thus, a cast is required),
259 .\"O feature test macro is defined:
262 型である (そのためキャストが必要である)。
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
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 バイト単位);
295 int msgmap; /* メッセージ・マップの最大エントリ数;
297 int msgmax; /* 一つのメッセージに書き込み可能な
299 int msgmnb; /* 一つのキューに書き込み可能な最大バイト数;
300 (msgget(2) での) キュー作成中の msg_qbytes
302 int msgmni; /* メッセージ・キューの数の最大値 */
303 int msgssz; /* メッセージ・セグメントのサイズ;
305 int msgtql; /* システム上の全キューの最大メッセージ数;
307 unsigned short int msgseg;
308 /* 最大セグメント数; カーネル内では未使用 */
318 .\"O settings can be changed via
320 .\"O files of the same name; see
329 にある同じ名前のファイル経由で変更可能である。
334 .\"O .BR MSG_INFO " (Linux-specific)"
335 .BR MSG_INFO " (Linux 固有)"
338 .\"O structure containing the same information as for
340 .\"O except that the following fields are returned with information
341 .\"O about system resources consumed by message queues: the
343 .\"O field returns the number of message queues that currently exist
344 .\"O on the system; the
346 .\"O field returns the total number of messages in all queues
347 .\"O on the system; and the
349 .\"O field returns the total number of bytes in all messages
350 .\"O in all queues on the system.
355 但し、以下のフィールドにはメッセージ・キューが
356 消費しているシステム資源に関する情報が格納される点が異なる。
358 フィールドは現在システム上に存在するメッセージ・キューの数を返す。
360 フィールドはシステム上の全てのキューに入っているメッセージ総数を返す。
362 フィールドはシステム上の全てのキューに入っている全メッセージの
365 .\"O .BR MSG_STAT " (Linux-specific)"
366 .BR MSG_STAT " (Linux 固有)"
369 .\"O structure as for
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.
382 引き数は、キュー識別子ではなく、システム上の全てのメッセージ・キュー
383 に関する情報を管理するカーネルの内部配列へのインデックスである。
384 .\"O .SH "RETURN VALUE"
401 .\"O operation returns the index of the highest used entry in the
402 .\"O kernel's internal array recording information about all
407 操作は、成功すると、全てのメッセージ・キューに関する情報を
408 管理しているカーネルの内部配列の使用中エントリのインデックスの
410 .\"O (This information can be used with repeated
412 .\"O operations to obtain information about all queues on the system.)
413 (この情報は、システムの全てのメッセージ・キューに関する情報を
419 .\"O operation returns the identifier of the queue whose index was given in
424 で指定されたインデックスを持つメッセージ・キューの識別子を返す。
426 .\"O On error, \-1 is returned with
428 .\"O indicating the error.
436 .\"O is set to one of the following:
448 .\"O but the calling process does not have read permission on the message queue
450 .\"O and does not have the
451 .\"O .B CAP_IPC_OWNER
459 に等しいが、呼び出したプロセスがメッセージ・キュー
472 .\"O but the address pointed to by
474 .\"O isn't accessible.
483 で指されているアドレスがアクセス可能でない。
486 .\"O The message queue was removed.
490 .\"O Invalid value for
496 .\"O operation, the index value specified in
498 .\"O referred to an array slot that is currently unused.
507 で指定されたインデックス値が現在未使用の配列のスロットを参照いていた。
516 .\"O but the effective user ID of the calling process is not the creator
518 .\"O .IR msg_perm.cuid )
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
532 であるが、呼び出したプロセスの実効ユーザ ID がメッセージキューの
537 として見つかる) 所有者のいずれでもなく、
538 かつ呼び出したプロセスに特権 (Linux では
541 .\"O .SH "CONFORMING TO"
544 .\"O .\" SVID does not document the EIDRM error condition.
545 .\" SVID には EIDRM エラーについての記述はない。
553 .\"O operations are used by the
555 .\"O program to provide information on allocated resources.
556 .\"O In the future these may modified or moved to a /proc file system
563 プログラムで割り当て済の資源に関する情報を提供するために
564 使用されている。将来、これらの操作は変更されたり、
565 /proc ファイルシステムのインタフェースに移動されるかもしれない。
568 .\"O Various fields in the \fIstruct msqid_ds\fP were
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
581 \fIstruct msqid_ds\fP 内の多くのフィールドは、
587 この利点を生かすには、glibc-2.1.91 以降の環境下で
589 (カーネルは新しい形式の呼び出しと古い形式の呼び出しを
599 .BR capabilities (7),