OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man2 / msgget.2
1 .\" Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provflags the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Added correction due to Nick Duffek <nsd@bbc.com>, aeb, 960426
24 .\" Modified Wed Nov  6 04:00:31 1996 by Eric S. Raymond <esr@thyrsus.com>
25 .\" Modified, 8 Jan 2003, Michael Kerrisk, <mtk.manpages@gmail.com>
26 .\"     Removed EIDRM from errors - that can't happen...
27 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
28 .\"     Added notes on capability requirements
29 .\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
30 .\"     Language and formatting clean-ups
31 .\"     Added notes on /proc files
32 .\"
33 .\"*******************************************************************
34 .\"
35 .\" This file was generated with po4a. Translate the source file.
36 .\"
37 .\"*******************************************************************
38 .TH MSGGET 2 2004\-05\-27 Linux "Linux Programmer's Manual"
39 .SH 名前
40 msgget \- メッセージ・キュー識別子を取得する
41 .SH 書式
42 .nf
43 \fB#include <sys/types.h>\fP
44 \fB#include <sys/ipc.h>\fP
45 \fB#include <sys/msg.h>\fP
46
47 \fBint msgget(key_t \fP\fIkey\fP\fB, int \fP\fImsgflg\fP\fB);\fP
48 .fi
49 .SH 説明
50 \fBmsgget\fP()  システムコールは \fIkey\fP 引き数の値に対応するメッセージ・キューの識別子を返す。 \fIkey\fP の値が
51 \fBIPC_PRIVATE\fP の場合、または \fIkey\fP が \fBIPC_PRIVATE\fP でなくても、 \fIkey\fP
52 に対応するメッセージ・キューが存在せず、 \fImsgflg\fP に \fBIPC_CREAT\fP が指定されている場合、
53 新しいメッセージ・キューが作成される。
54 .PP
55 \fImsgflg\fP に \fBIPC_CREAT\fP と \fBIPC_EXCL\fP の両方が指定された場合、 \fIkey\fP
56 に対応するメッセージ・キューが既に存在すると、 \fBmsgget\fP()  は失敗し、 \fIerrno\fP に \fBEEXIST\fP が設定される。 (これは
57 \fBopen\fP(2)  に \fBO_CREAT | O_EXCL\fP を指定した場合の動作と同じである)
58 .PP
59 メッセージ・キューの作成時に、 \fImsgflg\fP 引き数の下位 9 ビットは、 そのメッセージ・キューのアクセス許可の定義として使用される。
60 これらの許可ビットは \fBopen\fP(2)  の引き数 \fImode\fP と同じ形式で同じ意味である。 や \fBcreat\fP(2)
61 システム・コールのアクセス許可パラメータと同じ形式で、同じ意味を持つ。 (但し、実行 (execute) 許可は使用されない。)
62 .PP
63 新規のメッセージ・キューを作成する際、 \fBmsgget\fP()  システム・コールはメッセージ・キューのデータ構造体 \fImsqid_ds\fP
64 を以下のように初期化する (\fImsqid_ds\fP については \fBmsgctl\fP(2)  を参照):
65 .IP
66 \fImsg_perm.cuid\fP と \fImsg_perm.uid\fP に呼び出し元プロセスの実効 (effective) ユーザーID を設定する。
67 .IP
68 \fImsg_perm.cgid\fP と \fImsg_perm.gid\fP に呼び出し元プロセスの実効 (effective) グループID を設定する。
69 .IP
70 \fImsg_perm.mode\fP の下位 9 ビットは \fImsgflg\fP の下位 9 ビットを設定する。
71 .IP
72 \fImsg_qnum\fP, \fImsg_lspid\fP, \fImsg_lrpid\fP, \fImsg_stime\fP, \fImsg_rtime\fP に 0
73 を設定される。
74 .IP
75 \fImsg_ctime\fP に現在の時刻を設定する。
76 .IP
77 \fImsg_qbytes\fP に、システムで決められたメッセージ・キューの最大サイズ \fBMSGMNB\fP を設定する。
78 .PP
79 メッセージ・キューがすでに存在する場合は、アクセス許可の検査と、 破棄 (destruction) マークがないかの確認が行われる。
80 .SH 返り値
81 成功した場合、返り値はメッセージ・キュー識別子 (非負の整数) となる。 失敗した場合は \-1 が返され、 \fIerrno\fP にそのエラーが示される。
82 .SH エラー
83 失敗した場合、 \fIerrno\fP に以下の値のいずれか一つが設定される:
84 .TP 
85 \fBEACCES\fP
86 \fIkey\fP に対応するメッセージ・キューは存在するが、 呼び出し元プロセスはそのキューに対するアクセス許可がなく、 \fBCAP_IPC_OWNER\fP
87 ケーパビリティも持っていない。
88 .TP 
89 \fBEEXIST\fP
90 \fIkey\fP に対応するメッセージ・キューが存在し、 \fImsgflg\fP に \fBIPC_CREAT\fP と \fBIPC_EXCL\fP が指定されていた。
91 .TP 
92 \fBENOENT\fP
93 \fIkey\fP に対応するメッセージ・キューが存在せず、 \fImsgflg\fP に \fBIPC_CREAT\fP が指定されていなかった。
94 .TP 
95 \fBENOMEM\fP
96 メッセージ・キューを作成しようとしたが、新しいデータ構造体を作成 するのに十分なメモリがシステムに存在しない。
97 .TP 
98 \fBENOSPC\fP
99 メッセージ・キューを作成しようとしたが、作成すると システム全体のメッセージ・キュー数の最大値 (\fBMSGMNI\fP)  を超えてしまう。
100 .SH 準拠
101 SVr4, POSIX.1\-2001.
102 .SH 注意
103 \fBIPC_PRIVATE\fP はフラグではなく、 \fIkey_t\fP 型である。 この特別な値が \fIkey\fP として使用された場合、
104 \fBmsgget\fP()  システムコールは \fImsgflg\fP の下位 9 ビット以外の全てを無視して (成功した場合は)
105 新しいメッセージ・キューを作成する。
106 .PP
107 \fBmsgget\fP()  システムコールに影響を及ぼすメッセージ・キューの資源の システムとしての制限を以下に示す:
108 .TP 
109 \fBMSGMNI\fP
110 システム全体のメッセージ・キュー数の最大値: 方針依存 (Linux では、この制限値は \fI/proc/sys/kernel/msgmni\fP
111 経由で参照したり、変更したりできる)。
112 .SS "Linux での注意"
113 Linux 2.3.20 までは、削除が予定されているメッセージ・キューに対して \fBmsgget\fP()  を行うと \fBEIDRM\fP
114 がエラーとして返されるようになっていた。
115 .SH バグ
116 \fBIPC_PRIVATE\fP という名前を選んだのはおそらく失敗であろう。 \fBIPC_NEW\fP の方がより明確にその機能を表しているだろう。
117 .SH 関連項目
118 \fBmsgctl\fP(2), \fBmsgrcv\fP(2), \fBmsgsnd\fP(2), \fBftok\fP(3), \fBcapabilities\fP(7),
119 \fBmq_overview\fP(7), \fBsvipc\fP(7)