OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / draft / man2 / msgget.2
1 .\" Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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 .\" %%%LICENSE_END
24 .\"
25 .\" Added correction due to Nick Duffek <nsd@bbc.com>, aeb, 960426
26 .\" Modified Wed Nov  6 04:00:31 1996 by Eric S. Raymond <esr@thyrsus.com>
27 .\" Modified, 8 Jan 2003, Michael Kerrisk, <mtk.manpages@gmail.com>
28 .\"     Removed EIDRM from errors - that can't happen...
29 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
30 .\"     Added notes on capability requirements
31 .\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
32 .\"     Language and formatting clean-ups
33 .\"     Added notes on /proc files
34 .\"
35 .\"*******************************************************************
36 .\"
37 .\" This file was generated with po4a. Translate the source file.
38 .\"
39 .\"*******************************************************************
40 .TH MSGGET 2 2012\-05\-31 Linux "Linux Programmer's Manual"
41 .SH 名前
42 msgget \- System V メッセージ・キュー識別子を取得する
43 .SH 書式
44 .nf
45 \fB#include <sys/types.h>\fP
46 \fB#include <sys/ipc.h>\fP
47 \fB#include <sys/msg.h>\fP
48
49 \fBint msgget(key_t \fP\fIkey\fP\fB, int \fP\fImsgflg\fP\fB);\fP
50 .fi
51 .SH 説明
52 \fBmsgget\fP()  システムコールは \fIkey\fP 引き数の値に対応する System V メッセージ・キューの識別子を返す。 \fIkey\fP
53 の値が \fBIPC_PRIVATE\fP の場合、または \fIkey\fP が \fBIPC_PRIVATE\fP でなくても、 \fIkey\fP
54 に対応するメッセージ・キューが存在せず、 \fImsgflg\fP に \fBIPC_CREAT\fP が指定されている場合、
55 新しいメッセージ・キューが作成される。
56 .PP
57 \fImsgflg\fP に \fBIPC_CREAT\fP と \fBIPC_EXCL\fP の両方が指定された場合、 \fIkey\fP
58 に対応するメッセージ・キューが既に存在すると、 \fBmsgget\fP()  は失敗し、 \fIerrno\fP に \fBEEXIST\fP が設定される。 (これは
59 \fBopen\fP(2)  に \fBO_CREAT | O_EXCL\fP を指定した場合の動作と同じである)
60 .PP
61 メッセージ・キューの作成時に、 \fImsgflg\fP 引き数の下位 9 ビットは、 そのメッセージ・キューのアクセス許可の定義として使用される。
62 これらの許可ビットは \fBopen\fP(2)  の引き数 \fImode\fP と同じ形式で同じ意味である。 や \fBcreat\fP(2)
63 システム・コールのアクセス許可パラメータと同じ形式で、同じ意味を持つ。 (但し、実行 (execute) 許可は使用されない。)
64 .PP
65 新規のメッセージ・キューを作成する際、 \fBmsgget\fP()  システム・コールはメッセージ・キューのデータ構造体 \fImsqid_ds\fP
66 を以下のように初期化する (\fImsqid_ds\fP については \fBmsgctl\fP(2)  を参照):
67 .IP
68 \fImsg_perm.cuid\fP と \fImsg_perm.uid\fP に呼び出し元プロセスの実効 (effective) ユーザーID を設定する。
69 .IP
70 \fImsg_perm.cgid\fP と \fImsg_perm.gid\fP に呼び出し元プロセスの実効 (effective) グループID を設定する。
71 .IP
72 \fImsg_perm.mode\fP の下位 9 ビットは \fImsgflg\fP の下位 9 ビットを設定する。
73 .IP
74 \fImsg_qnum\fP, \fImsg_lspid\fP, \fImsg_lrpid\fP, \fImsg_stime\fP, \fImsg_rtime\fP に 0
75 を設定される。
76 .IP
77 \fImsg_ctime\fP に現在の時刻を設定する。
78 .IP
79 \fImsg_qbytes\fP に、システムで決められたメッセージ・キューの最大サイズ \fBMSGMNB\fP を設定する。
80 .PP
81 メッセージ・キューがすでに存在する場合は、アクセス許可の検査と、 破棄 (destruction) マークがないかの確認が行われる。
82 .SH 返り値
83 成功した場合、返り値はメッセージ・キュー識別子 (非負の整数) となる。 失敗した場合は \-1 が返され、 \fIerrno\fP にそのエラーが示される。
84 .SH エラー
85 失敗した場合、 \fIerrno\fP に以下の値のいずれか一つが設定される:
86 .TP 
87 \fBEACCES\fP
88 \fIkey\fP に対応するメッセージ・キューは存在するが、 呼び出し元プロセスはそのキューに対するアクセス許可がなく、 \fBCAP_IPC_OWNER\fP
89 ケーパビリティも持っていない。
90 .TP 
91 \fBEEXIST\fP
92 \fIkey\fP に対応するメッセージ・キューが存在し、 \fImsgflg\fP に \fBIPC_CREAT\fP と \fBIPC_EXCL\fP が指定されていた。
93 .TP 
94 \fBENOENT\fP
95 \fIkey\fP に対応するメッセージ・キューが存在せず、 \fImsgflg\fP に \fBIPC_CREAT\fP が指定されていなかった。
96 .TP 
97 \fBENOMEM\fP
98 メッセージ・キューを作成しようとしたが、新しいデータ構造体を作成 するのに十分なメモリがシステムに存在しない。
99 .TP 
100 \fBENOSPC\fP
101 メッセージ・キューを作成しようとしたが、作成すると システム全体のメッセージ・キュー数の最大値 (\fBMSGMNI\fP)  を超えてしまう。
102 .SH 準拠
103 SVr4, POSIX.1\-2001.
104 .SH 注意
105 .\" Like Linux, the FreeBSD man pages still document
106 .\" the inclusion of these header files.
107 Linux や POSIX の全てのバージョンでは、 \fI<sys/types.h>\fP と \fI<sys/ipc.h>\fP
108 のインクルードは必要ない。しかしながら、いくつかの古い実装ではこれらのヘッダファイルのインクルードが必要であり、 SVID
109 でもこれらのインクルードをするように記載されている。このような古いシステムへの移植性を意図したアプリケーションではこれらのファイルをインクルードする必要があるかもしれない。
110
111 \fBIPC_PRIVATE\fP はフラグではなく、 \fIkey_t\fP 型である。 この特別な値が \fIkey\fP として使用された場合、
112 \fBmsgget\fP()  システムコールは \fImsgflg\fP の下位 9 ビット以外の全てを無視して (成功した場合は)
113 新しいメッセージ・キューを作成する。
114 .PP
115 \fBmsgget\fP()  システムコールに影響を及ぼすメッセージ・キューの資源の システムとしての制限を以下に示す:
116 .TP 
117 \fBMSGMNI\fP
118 システム全体のメッセージ・キュー数の最大値: 方針依存 (Linux では、この制限値は \fI/proc/sys/kernel/msgmni\fP
119 経由で参照したり、変更したりできる)。
120 .SS "Linux での注意"
121 Linux 2.3.20 までは、削除が予定されているメッセージ・キューに対して \fBmsgget\fP()  を行うと \fBEIDRM\fP
122 がエラーとして返されるようになっていた。
123 .SH バグ
124 \fBIPC_PRIVATE\fP という名前を選んだのはおそらく失敗であろう。 \fBIPC_NEW\fP の方がより明確にその機能を表しているだろう。
125 .SH 関連項目
126 \fBmsgctl\fP(2), \fBmsgrcv\fP(2), \fBmsgsnd\fP(2), \fBftok\fP(3), \fBcapabilities\fP(7),
127 \fBmq_overview\fP(7), \fBsvipc\fP(7)
128 .SH この文書について
129 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
130 である。プロジェクトの説明とバグ報告に関する情報は
131 http://www.kernel.org/doc/man\-pages/ に書かれている。