OSDN Git Service

Update release for LDP 3.67
[linuxjm/LDP_man-pages.git] / release / man2 / semget.2
index 6042b9d..ba85c95 100644 (file)
@@ -47,7 +47,7 @@
 .\" Updated 2006-07-20, Akihiro MOTOKI, LDP v2.36
 .\" Updated 2013-05-01, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.TH SEMGET 2 2012\-05\-31 Linux "Linux Programmer's Manual"
+.TH SEMGET 2 2014\-05\-21 Linux "Linux Programmer's Manual"
 .SH 名前
 semget \- System V セマフォ集合の識別子を取得する
 .SH 書式
@@ -59,8 +59,8 @@ semget \- System V セマフォ集合の識別子を取得する
 .sp
 \fBint semget(key_t \fP\fIkey\fP\fB,\fP \fBint \fP\fInsems\fP\fB,\fP \fBint \fP\fIsemflg\fP\fB);\fP
 .SH 説明
-\fBsemget\fP()  システムコールは、引き数 \fIkey\fP に対応する System V セマフォ集合 (semaphore set) の 識別子
-(identifier) を返す。 \fIkey\fP の値が \fBIPC_PRIVATE\fP の場合、もしくは \fIsemflg\fP に
+\fBsemget\fP()  システムコールは、引き数 \fIkey\fP に対応する System\ V セマフォ集合 (semaphore set) の
+識別子 (identifier) を返す。 \fIkey\fP の値が \fBIPC_PRIVATE\fP の場合、もしくは \fIsemflg\fP に
 \fBIPC_CREAT\fP が指定されていて、 \fIkey\fP に対応するセマフォ集合が存在しない場合、 \fInsems\fP
 個のセマフォからなる新しい集合が作成される。
 .PP
@@ -73,13 +73,6 @@ semget \- System V セマフォ集合の識別子を取得する
 と同じ形式で同じ意味である (但し、実行 (execute) 許可はセマフォでは意味を持たず、 書き込み (write) 許可はセマフォ値の変更
 (alter) 許可として機能する)。
 .PP
-.\" In truth, every one of the many implementations that I've tested sets
-.\" the values to zero, but I suppose there is/was some obscure
-.\" implementation out there that does not.
-新しく作成されたセマフォ集合の各セマフォの値は不定である (この点は POSIX.1\-2001 に明記されている)。 Linux
-は他の多くの実装と同様にセマフォ値を 0 に初期化するが、 移植性を考慮したアプリケーションではこの動作を前提にすべきではない。
-アプリケーションは明示的にセマフォを希望の値で初期化すべきである。
-.PP
 新規のセマフォ集合を作成する際、 \fBsemget\fP()  はセマフォ集合の情報を保持するデータ構造体 \fIsemid_ds\fP を次のように初期化する
 (\fIsemid_ds\fP については \fBsemctl\fP(2)  を参照):
 .IP
@@ -104,7 +97,7 @@ semget \- System V セマフォ集合の識別子を取得する
 .SH 返り値
 成功した場合、セマフォ集合の識別子 (非負の整数) が返り値となる。 失敗した場合は \-1 が返され、 \fIerrno\fP にエラーを示す値が設定される。
 .SH エラー
-失æ\95\97ã\81\97ã\81\9få ´å\90\88ã\80\81 \fIerrno\fP ã\81«ã\81¯ä»¥ä¸\8bã\81®å\80¤ã\81®ã\81\84ã\81\9aã\82\8cã\81\8bä¸\80ã\81¤が設定される:
+失æ\95\97ã\81\97ã\81\9få ´å\90\88ã\81¯ \fIerrno\fP ã\81«ã\81¯ä»¥ä¸\8bã\81®å\80¤ã\81®ã\81©ã\82\8cã\81\8bが設定される:
 .TP 
 \fBEACCES\fP
 \fIkey\fP に対応するセマフォ集合は存在するが、 呼び出し元のプロセスはその集合へのアクセス許可がなく、 \fBCAP_IPC_OWNER\fP
@@ -114,11 +107,16 @@ semget \- System V セマフォ集合の識別子を取得する
 .\" .TP
 .\" .B EIDRM
 .\" The semaphore set is marked to be deleted.
-\fIkey\fP に対応するセマフォ集合が存在し、 \fIsemflg\fP には \fBIPC_CREAT\fP と \fBIPC_EXCL\fP が指定されていた。
+\fBIPC_CREAT\fP and \fBIPC_EXCL\fP were specified in \fIsemflg\fP, but a semaphore
+set already exists for \fIkey\fP.
 .TP 
 \fBEINVAL\fP
-\fInsems\fP が 0 より小さいか、セマフォ集合あたりのセマフォの最大数 (\fBSEMMSL\fP)  より大きい。 または、 \fIkey\fP
-に対応するセマフォ集合が既に存在し、 \fInsems\fP がその集合のセマフォ数よりも大きい。
+\fInsems\fP is less than 0 or greater than the limit on the number of
+semaphores per semaphore set (\fBSEMMSL\fP).
+.TP 
+\fBEINVAL\fP
+A semaphore set corresponding to \fIkey\fP already exists, but \fInsems\fP is
+larger than the number of semaphores in that set.
 .TP 
 \fBENOENT\fP
 \fIkey\fP に対応するセマフォ集合が存在せず、 \fIsemflg\fP に \fBIPC_CREAT\fP が指定されてもいない。
@@ -140,36 +138,51 @@ Linux や POSIX の全てのバージョンでは、 \fI<sys/types.h>\fP と \fI
 のインクルードは必要ない。しかしながら、いくつかの古い実装ではこれらのヘッダファイルのインクルードが必要であり、 SVID
 でもこれらのインクルードをするように記載されている。このような古いシステムへの移植性を意図したアプリケーションではこれらのファイルをインクルードする必要があるかもしれない。
 
+.\"
 \fBIPC_PRIVATE\fP はフラグ・フィールドに指定するものではなく、 \fIkey_t\fP 型である。 この特別な値が \fIkey\fP に指定されると、
 \fBsemget\fP()  \fIsemflg\fP の下位 9 ビット以外は全て無視し、 (成功した場合は) 新しいセマフォ集合を作成する。
-.PP
+.SS "Semaphore initialization"
+.\" In truth, every one of the many implementations that I've tested sets
+.\" the values to zero, but I suppose there is/was some obscure
+.\" implementation out there that does not.
+The values of the semaphores in a newly created set are indeterminate.
+(POSIX.1\-2001 and POSIX.1\-2008 are explicit on this point, although
+POSIX.1\-2008 notes that a future version of the standard may require an
+implementation to initialize the semaphores to 0.)  Although Linux, like
+many other implementations, initializes the semaphore values to 0, a
+portable application cannot rely on this: it should explicitly initialize
+the semaphores to the desired values.
+
+.\"
+Initialization can be done using \fBsemctl\fP(2)  \fBSETVAL\fP or \fBSETALL\fP
+operation.  Where multiple peers do not know who will be the first to
+initialize the set, checking for a nonzero \fIsem_otime\fP in the associated
+data structure retrieved by a \fBsemctl\fP(2)  \fBIPC_STAT\fP operation can be
+used to avoid races.
+.SS "Semaphore limits"
 セマフォ集合のリソースに関する制限のうち、 \fBsemget\fP()  に影響を及ぼすものを以下に挙げる:
 .TP 
 \fBSEMMNI\fP
 .\" This /proc file is not available in Linux 2.2 and earlier -- MTK
-システム全体のセマフォ集合の最大数: 方針依存 (Linux では、この制限値は \fI/proc/sys/kernel/sem\fP
-の第4フィールドに対応し、読み出しも変更もできる)。
+System\-wide limit on the number of semaphore sets: policy dependent (on
+Linux, this limit can be read and modified via the fourth field of
+\fI/proc/sys/kernel/sem\fP).
 .TP 
 \fBSEMMSL\fP
-semid あたりのセマフォの最大数: 実装依存 (Linux では、この制限値は \fI/proc/sys/kernel/sem\fP
+セマフォ ID あたりのセマフォの最大数: 実装依存 (Linux では、この制限値は \fI/proc/sys/kernel/sem\fP
 の第1フィールドに対応し、読み出しも変更もできる)。
 .TP 
 \fBSEMMNS\fP
-システム全体のセマフォの最大数: 方針依存 (Linux では、この制限値は \fI/proc/sys/kernel/sem\fP
-の第2フィールドに対応し、読み出しも変更もできる)。 \fBSEMMSL * SEMMNI\fP より大きな値は意味を持たない。
+System\-wide limit on the number of semaphores: policy dependent (on Linux,
+this limit can be read and modified via the second field of
+\fI/proc/sys/kernel/sem\fP).  Note that number of semaphores system\-wide is
+also limited by the product of \fBSEMMSL\fP and \fBSEMMNI\fP.
 .SH バグ
 \fBIPC_PRIVATE\fP という名前を選んだのはおそらく失敗であろう。 \fBIPC_NEW\fP の方がより明確にその機能を表しているだろう。
-.LP
-.\" In fact they are initialized to zero on Linux, but POSIX.1-2001
-.\" does not specify this, and we can't portably rely on it.
-セマフォ集合内のセマフォは \fBsemget\fP()  では初期化されない。 このセマフォを初期化するには、セマフォ集合に対して \fBsemctl\fP(2)
-を使って \fBSETVAL\fP か \fBSETALL\fP 操作を実行する必要がある。 (複数箇所からセマフォ集合の操作が行われる場面では、
-誰が最初に集合を初期化すればよいか分からない。 この状況を避けるには、 \fBsemctl\fP(2)  の \fBIPC_STAT\fP
-操作で取得できるセマフォのデータ構造体の \fIsem_otime\fP が 0 以外になっているかをチェックすればよい。)
 .SH 関連項目
 \fBsemctl\fP(2), \fBsemop\fP(2), \fBftok\fP(3), \fBcapabilities\fP(7),
 \fBsem_overview\fP(7), \fBsvipc\fP(7)
 .SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
 である。プロジェクトの説明とバグ報告に関する情報は
 http://www.kernel.org/doc/man\-pages/ に書かれている。