OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / draft / man2 / semop.2
index 53cc568..58795e9 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -19,6 +20,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Modified 1996-10-22, Eric S. Raymond <esr@thyrsus.com>
 .\" Modified 2002-01-08, Michael Kerrisk <mtk.manpages@gmail.com>
 .\" 2005-04-08, mtk, Noted kernel version numbers for semtimedop()
 .\" 2007-07-09, mtk, Added an EXAMPLE code segment.
 .\"
-.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
-.\"         all rights reserved.
-.\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Updated 2003-02-09, Kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2003-09-12, Kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2005-03-01, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2005-04-17, Akihiro MOTOKI
-.\" Updated 2005-09-06, Akihiro MOTOKI
-.\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
+.\"*******************************************************************
 .\"
-.\"WORD:       semaphore               ¥»¥Þ¥Õ¥©
-.\"WORD:       member                  ¥á¥ó¥Ð¡¼
-.\"WORD:       process                 ¥×¥í¥»¥¹
-.\"WORD:       system call             ¥·¥¹¥Æ¥à¥³¡¼¥ë
-.\"WORD:       undo                    ¥¢¥ó¥É¥¥
-.\"WORD:       signal                  ¥·¥°¥Ê¥ë
-.\"WORD:       catch                   Êá³Í(catch)
-.\"WORD:       process-ID              ¥×¥í¥»¥¹ID
-.\"WORD:       policy                  Êý¿Ë
-.\"WORD:       implement               ¼ÂÁõ
-.\"WORD:       queue                   ¥­¥å¡¼
-.\"WORD:       free                    ²òÊü(free).
-.\"WORD:       memory                  ¥á¥â¥ê
-.\"WORD:       anonymous structure     ÌµÌ¾¹½Â¤ÂÎ
-.\"WORD:       time limit              À©¸Â»þ´Ö
-\"
-.TH SEMOP 2 2008-10-04 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O semop, semtimedop \- semaphore operations
-semop, semtimedop \- ¥»¥Þ¥Õ¥©¤ÎÁàºî
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH SEMOP 2 2013\-04\-17 Linux "Linux Programmer's Manual"
+.SH 名前
+semop, semtimedop \- System V セマフォの操作
+.SH 書式
 .nf
-.B #include <sys/types.h>
-.B #include <sys/ipc.h>
-.B #include <sys/sem.h>
+\fB#include <sys/types.h>\fP
+\fB#include <sys/ipc.h>\fP
+\fB#include <sys/sem.h>\fP
 .sp
-.BI "int semop(int " semid ", struct sembuf *" sops ", unsigned " nsops );
+\fBint semop(int \fP\fIsemid\fP\fB, struct sembuf *\fP\fIsops\fP\fB, unsigned \fP\fInsops\fP\fB);\fP
 .sp
-.BI "int semtimedop(int " semid ", struct sembuf *" sops ", unsigned " nsops ,
-.BI "               struct timespec *" timeout );
+\fBint semtimedop(int \fP\fIsemid\fP\fB, struct sembuf *\fP\fIsops\fP\fB, unsigned \fP\fInsops\fP\fB,\fP
+\fB               struct timespec *\fP\fItimeout\fP\fB);\fP
 .fi
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
-.RB ( feature_test_macros (7)
-»²¾È):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .in
 .sp
-.BR semtimedop ():
-_GNU_SOURCE
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O Each semaphore in a semaphore set has the following associated values:
-¥»¥Þ¥Õ¥©½¸¹ç (semaphore set) ¤Î¥á¥ó¥Ð¡¼¤Î³Æ¥»¥Þ¥Õ¥©¤Ï
-°Ê²¼¤Î´ØÏ¢¾ðÊó¤ò»ý¤Ã¤Æ¤¤¤ë:
+\fBsemtimedop\fP(): _GNU_SOURCE
+.SH 説明
+System V セマフォ集合 (semaphore set) のメンバーの各セマフォは 以下の関連情報を持っている:
 .sp
 .in +4n
 .nf
-.\"O unsigned short  semval;   /* semaphore value */
-.\"O unsigned short  semzcnt;  /* # waiting for zero */
-.\"O unsigned short  semncnt;  /* # waiting for increase */
-.\"O pid_t           sempid;   /* process that did last op */
-unsigned short  semval;   /* ¥»¥Þ¥Õ¥©ÃÍ */
-unsigned short  semzcnt;  /* ¥¼¥í¤òÂÔ¤Ä¥×¥í¥»¥¹¿ô */
-unsigned short  semncnt;  /* Áý²Ã¤òÂÔ¤Ä¥×¥í¥»¥¹¿ô */
-pid_t           sempid;   /* ºÇ¸å¤ËÁàºî¤ò¹Ô¤Ê¤Ã¤¿¥×¥í¥»¥¹ */
+unsigned short  semval;   /* セマフォ値 */
+unsigned short  semzcnt;  /* ゼロを待つプロセス数 */
+unsigned short  semncnt;  /* 増加を待つプロセス数 */
+pid_t           sempid;   /* 最後に操作を行なったプロセスの ID */
 .sp
 .in -4n
 .fi
-.\"O .BR semop ()
-.\"O performs operations on selected semaphores in the set indicated by
-.\"O .IR semid .
-.BR semop ()
-¤Ï
-.I semid
-¤Ç»ØÄꤵ¤ì¤¿¥»¥Þ¥Õ¥©½¸¹ç¤ÎÁªÂò¤µ¤ì¤¿¥»¥Þ¥Õ¥©¤ËÂФ·¤ÆÁàºî¤ò¹Ô¤¦¡£
-.\"O Each of the
-.\"O .I nsops
-.\"O elements in the array pointed to by
-.\"O .I sops
-.\"O specifies an operation to be performed on a single semaphore.
-.\"O The elements of this structure are of type
-.\"O .IR "struct sembuf" ,
-.\"O containing the following members:
-.I sops
-¤Ï
-.I nsops
-¸Ä¤ÎÍ×ÁǤÎÇÛÎó¤ò»Ø¤·¡¢ÇÛÎó¤Î³ÆÍ×ÁǤϸġ¹¤Î¥»¥Þ¥Õ¥©¤Ë
-ÂФ¹¤ëÁàºî¤ò¼¨¤¹¡£¤½¤Î·¿¤Ï
-.I struct sembuf
-¤Ç¡¢¼¡¤Î¥á¥ó¥Ð¤ò»ý¤Ä:
+\fBsemop\fP()  は \fIsemid\fP で指定されたセマフォ集合の選択されたセマフォに対して操作を行う。 \fIsops\fP は \fInsops\fP
+個の要素の配列を指し、配列の各要素は個々のセマフォに 対する操作を示す。その型は \fIstruct sembuf\fP で、次のメンバを持つ:
 .sp
 .in +4n
 .nf
-.\"O unsigned short sem_num;  /* semaphore number */
-.\"O short          sem_op;   /* semaphore operation */
-.\"O short          sem_flg;  /* operation flags */
-unsigned short sem_num;  /* ¥»¥Þ¥Õ¥©ÈÖ¹æ */
-short          sem_op;   /* ¥»¥Þ¥Õ¥©Áàºî */
-short          sem_flg;  /* Áàºî¥Õ¥é¥° */
+unsigned short sem_num;  /* セマフォ番号 */
+short          sem_op;   /* セマフォ操作 */
+short          sem_flg;  /* 操作フラグ */
 .sp
 .in -4n
 .fi
-.\"O Flags recognized in
-.\"O .I sem_flg
-.\"O are
-.\"O .B IPC_NOWAIT
-.\"O and
-.\"O .BR SEM_UNDO .
-.\"O If an operation specifies
-.\"O .BR SEM_UNDO ,
-.\"O it will be automatically undone when the process terminates.
-.I sem_flg
-¤Ë¤Ï
-.B IPC_NOWAIT
-¤È
-.B SEM_UNDO
-¤¬ÀßÄê¤Ç¤­¤ë¡£
-.B SEM_UNDO
-¤¬»ØÄꤵ¤ì¤¿Áàºî¤Ï¡¢¤½¤Î¥×¥í¥»¥¹¤¬½ªÎ»¤·¤¿»þ¤Ë¼«Æ°Åª¤Ë¼è¤ê¾Ã¤µ¤ì¤ë¡£
+\fIsem_flg\fP には \fBIPC_NOWAIT\fP と \fBSEM_UNDO\fP が設定できる。 \fBSEM_UNDO\fP
+が指定された操作は、そのプロセスが終了した時に自動的に取り消される。
 .PP
-.\"O The set of operations contained in
-.\"O .I sops
-.\"O is performed in
-.\"O .IR "array order" ,
-.\"O and
-.\"O .IR atomically ,
-.\"O that is, the operations are performed either as a complete unit,
-.\"O or not at all.
-.I sops
-¤Ë´Þ¤Þ¤ì¤ëÁàºî¤Î½¸¹ç¤Ï¡¢
-.I "ÇÛÎó¤Î½ç½ø"
-¤Ç¡¢
-.I ¥¢¥È¥ß¥Ã¥¯¤Ë
-¼Â¹Ô¤µ¤ì¤ë¡£
-¤¹¤Ê¤ï¤Á¡¢Á´¤Æ¤ÎÁàºî¤¬´°Á´¤Ë¼Â¹Ô¤µ¤ì¤ë¤«¡¢Á´¤¯¼Â¹Ô¤µ¤ì¤Ê¤¤¤«¤Î
-¤É¤Á¤é¤«¤È¤Ê¤ë¡£
-
-.\"O The behavior of the system call if not all operations can be
-.\"O performed immediately depends on the presence of the
-.\"O .B IPC_NOWAIT
-.\"O flag in the individual
-.\"O .I sem_flg
-.\"O fields, as noted below.
-Á´¤Æ¤ÎÁàºî¤¬Ä¾¤Á¤Ë¼Â¹Ô¤Ç¤­¤Ê¤¤¾ì¹ç¤Î¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î¿¶¤ëÉñ¤¤¤Ï
-¸Ä¡¹¤ÎÁàºî¤Î
-.I sem_flg
-¥Õ¥£¡¼¥ë¥É¤Ë
-.B IPC_NOWAIT
-¤¬Â¸ºß¤¹¤ë¤«¤Ë¤è¤Ã¤Æ·è¤Þ¤ê¡¢¸å½Ò¤Î¤è¤¦¤Ë¤Ê¤ë¡£
+\fIsops\fP に含まれる操作の集合は、 \fI配列の順序\fP で、 \fIアトミックに\fP 実行される。
+すなわち、全ての操作が完全に実行されるか、全く実行されないかの どちらかとなる。 全ての操作が直ちに実行できない場合のこのシステムコールの振る舞いは
+個々の操作の \fIsem_flg\fP フィールドに \fBIPC_NOWAIT\fP が存在するかによって決まり、後述のようになる。
 
-.\"O Each operation is performed on the
-.\"O .IR sem_num \-th
-.\"O semaphore of the semaphore set, where the first semaphore of the set
-.\"O is numbered 0.
-¤½¤ì¤¾¤ì¤ÎÁàºî¤Ï¥»¥Þ¥Õ¥©½¸¹ç¤Î
-.IR sem_num ÈÖÌÜ
-¤Î¥»¥Þ¥Õ¥©¤ËÂФ·¤Æ¼Â¹Ô¤µ¤ì¤ë¡£¥»¥Þ¥Õ¥©½¸¹ç¤ÎºÇ½é¤Î¥»¥Þ¥Õ¥©¤Ë¤Ï
-ÈÖ¹æ 0 ¤¬¿¶¤é¤ì¤ë¡£
-.\"O There are three types of operation, distinguished by the value of
-.\"O .IR sem_op .
-¤½¤·¤ÆÁàºî¤Ï»°¼ïÎढ¤ê¡¢
-.I sem_op
-¤ÎÃͤǶèÊ̤µ¤ì¤ë¡£
+それぞれの操作はセマフォ集合の \fIsem_num\fP番目 のセマフォに対して実行される。セマフォ集合の最初のセマフォには 番号 0 が振られる。
+そして操作は三種類あり、 \fIsem_op\fP の値で区別される。
 .PP
-.\"O If
-.\"O .I sem_op
-.\"O is a positive integer, the operation adds this value to
-.\"O the semaphore value
-.\"O .RI  ( semval ).
-.\"O Furthermore, if
-.\"O .B SEM_UNDO
-.\"O is specified for this operation, the system updates the process undo count
-.\"O .RI ( semadj )
-.\"O for this semaphore.
-.\"O This operation can always proceed \(em it never forces a process to wait.
-.\"O The calling process must have alter permission on the semaphore set.
-.I sem_op
-¤¬Àµ¤ÎÀ°¿ô¤Î¾ì¹ç¡¢Áàºî¤È¤·¤Æ¤½¤ÎÃͤò¥»¥Þ¥Õ¥©¤ÎÃÍ
-.RI ( semval )
-¤Ë²Ã¤¨¤ë¡£¤µ¤é¤Ë¤³¤ÎÁàºî¤Ë
-.B SEM_UNDO
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¥·¥¹¥Æ¥à¤Ï¤³¤Î¥»¥Þ¥Õ¥©¤Î ¥×¥í¥»¥¹¡¦¥¢¥ó¥É¥¥¿ô
-.RI ( semadj )
-¤ò¹¹¿·¤¹¤ë¡£
-¤³¤ÎÁàºî¤Ïɬ¤º¼Â¹Ô¤Ç¤­¡¢¥×¥í¥»¥¹¤ÎÄä»ß¤Ïµ¯¤³¤é¤Ê¤¤¡£
-¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤ÏÂоݤΥ»¥Þ¥Õ¥©½¸¹ç¤òÊѹ¹¤¹¤ëµö²Ä¤¬¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+\fIsem_op\fP が正の整数の場合、その値をセマフォの値 (\fIsemval\fP) に加算する。 さらに、この操作で \fBSEM_UNDO\fP
+が指定されていた場合は、 システムはこのセマフォのの調整値 (\fIsemadj\fP) から値 \fIsem_op\fP を減算する。 この操作は必ず実行でき、
+スレッドの停止は起こらない。 呼び出し元プロセスは対象のセマフォ集合を変更する許可がなければならない。
 .PP
-.\"O If
-.\"O .I sem_op
-.\"O is zero, the process must have read permission on the semaphore
-.\"O set.
-.\"O This is a "wait-for-zero" operation: if
-.\"O .I semval
-.\"O is zero, the operation can immediately proceed.
-.I sem_op
-¤¬ 0 ¤Î¾ì¹ç¡¢¡Ö¥¼¥í¤Þ¤ÇÂԤġ×Áàºî¤Ç¤¢¤ë¡£¤³¤Î¾ì¹ç¡¢¥×¥í¥»¥¹¤Ï
-¤½¤Î¥»¥Þ¥Õ¥©½¸¹ç¤ËÂФ¹¤ëÆɤ߹þ¤ßµö²Ä¤¬¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
-.I semval
-¤¬ 0 ¤Ê¤é¤Ð¡¢Áàºî¤Ïľ¤Á¤Ë¹Ô¤ï¤ì¤ë¡£
-.\"O Otherwise, if
-.\"O .B IPC_NOWAIT
-.\"O is specified in
-.\"O .IR sem_flg ,
-.\"O .BR semop ()
-.\"O fails with
-.\"O .I errno
-.\"O set to
-.\"O .B EAGAIN
-.\"O (and none of the operations in
-.\"O .I sops
-.\"O is performed).
-.I semval
-¤¬ 0 ¤Ç¤Ê¤¤¾ì¹ç¡¢
-.I sem_flg
-¤Ë
-.B IPC_NOWAIT
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤ì¤Ð¡¢
-.BR semop ()
-¤Ï¼ºÇÔ¤·¡¢
-.B errno
-¤Ë
-.B EAGAIN
-¤¬ÀßÄꤵ¤ì¤ë (¤³¤Î¤È¤­
-.I sops
-¤ËÂФ¹¤ëÁàºî¤ÏÁ´¤¯¼Â¹Ô¤µ¤ì¤Ê¤¤)¡£
-.\"O Otherwise
-.\"O .I semzcnt
-.\"O (the count of processes waiting until this semaphore's value becomes zero)
-.\"O is incremented by one and the process sleeps until
-.\"O one of the following occurs:
-.I sem_flg
-¤Ë
-.B IPC_NOWAIT
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
-.I semzcnt
-(¥»¥Þ¥Õ¥©Ãͤ¬ 0 ¤Ë¤Ê¤ë¤Î¤òÂԤäƤ¤¤ë¥×¥í¥»¥¹¤Î¿ô) ¤ò 1 Áý²Ã¤µ¤»¤Æ¡¢
-°Ê²¼¤Î¤¤¤º¤ì¤«¤¬µ¯¤³¤ë¤Þ¤Ç¥×¥í¥»¥¹¤òÄä»ß (sleep) ¤¹¤ë¡£
+\fIsem_op\fP が 0 の場合、「ゼロまで待つ」操作である。この場合、プロセスは そのセマフォ集合に対する読み込み許可がなければならない。
+\fIsemval\fP が 0 ならば、操作は直ちに行われる。 \fIsemval\fP が 0 でない場合、 \fIsem_flg\fP に
+\fBIPC_NOWAIT\fP が指定されていれば、 \fBsemop\fP()  は失敗し、 \fBerrno\fP に \fBEAGAIN\fP が設定される (このとき
+\fIsops\fP に対する操作は全く実行されない)。 \fIsem_flg\fP に \fBIPC_NOWAIT\fP が指定されていない場合、 \fIsemzcnt\fP
+(セマフォ値が 0 になるのを待っているスレッドの数) を 1 増加させて、 以下のいずれかが起こるまでスレッドを停止 (sleep) する。
 .IP \(bu 3
-.\"O .I semval
-.\"O becomes 0, at which time the value of
-.\"O .I semzcnt
-.\"O is decremented.
-.I semval
-¤¬ 0 ¤Ë¤Ê¤Ã¤¿: ¤³¤Î¤È¤­
-.I semzcnt
-¤ÎÃͤϠ1 ¸º»»¤µ¤ì¤ë¡£
+\fIsemval\fP が 0 になった: このとき \fIsemzcnt\fP の値は 1 減算される。
 .IP \(bu
-.\"O The semaphore set
-.\"O is removed:
-.\"O .BR semop ()
-.\"O fails, with
-.\"O .I errno
-.\"O set to
-.\"O .BR EIDRM .
-¥»¥Þ¥Õ¥©½¸¹ç¤¬ºï½ü¤µ¤ì¤¿: ¤³¤Î¤È¤­
-.BR semop ()
-¤Ï¼ºÇÔ¤·¡¢
-.I errno
-¤Ë
-.B EIDRM
-¤¬ÀßÄꤵ¤ì¤ë¡£
+セマフォ集合が削除された: このとき \fBsemop\fP()  は失敗し、 \fIerrno\fP に \fBEIDRM\fP が設定される。
 .IP \(bu
-.\"O The calling process catches a signal:
-.\"O the value of
-.\"O .I semzcnt
-.\"O is decremented and
-.\"O .BR semop ()
-.\"O fails, with
-.\"O .I errno
-.\"O set to
-.\"O .BR EINTR .
-¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤¬¥·¥°¥Ê¥ë¤òÊá³Í¤·¤¿: ¤³¤Î¤È¤­
-.I semzcnt
-¤ÎÃͤϠ1 ¸º»»¤µ¤ì¡¢
-.BR semop ()
-¤Ï¼ºÇÔ¤·
-.I errno
-¤Ë
-.B EINTR
-¤¬ÀßÄꤵ¤ì¤ë¡£
+呼び出し元スレッドがシグナルを捕獲した: このとき \fIsemzcnt\fP の値は 1 減算され、 \fBsemop\fP()  は失敗し \fIerrno\fP に
+\fBEINTR\fP が設定される。
 .IP \(bu
-.\"O The time limit specified by
-.\"O .I timeout
-.\"O in a
-.\"O .BR semtimedop ()
-.\"O call expires:
-.\"O .BR semop ()
-.\"O fails, with
-.\"O .I errno
-.\"O set to
-.\"O .BR EAGAIN .
-.\" motoki: semop () ¤Ï semtimedop () ¤Î´Ö°ã¤¤¡©
-.BR semtimedop ()
-¤Î
-.I timeout
-¤Ç»ØÄꤵ¤ì¤¿À©¸Â»þ´Ö¤¬·Ð²á¤·¤¿: ¤³¤Î¤È¤­
-.BR semtimedop ()
-¤Ï¼ºÇÔ¤·¡¢
-.I errno
-¤Ë
-.B EAGAIN
-¤¬ÀßÄꤵ¤ì¤ë¡£
+\fBsemtimedop\fP()  の \fItimeout\fP で指定された制限時間が経過した: このとき \fBsemtimedop\fP()  は失敗し、
+\fIerrno\fP に \fBEAGAIN\fP が設定される。
 .PP
-.\"O If
-.\"O .I sem_op
-.\"O is less than zero, the process must have alter permission on the
-.\"O semaphore set.
-.\"O If
-.\"O .I semval
-.\"O is greater than or equal to the absolute value of
-.\"O .IR sem_op ,
-.\"O the operation can proceed immediately:
-.\"O the absolute value of
-.\"O .I sem_op
-.\"O is subtracted from
-.\"O .IR semval ,
-.\"O and, if
-.\"O .B SEM_UNDO
-.\"O is specified for this operation, the system updates the process undo count
-.\"O .RI ( semadj )
-.\"O for this semaphore.
-.I sem_op
-¤¬ 0 Ì¤Ëþ¤Î¾ì¹ç¡¢¥×¥í¥»¥¹¤Ë¤Ï¤½¤Î¥»¥Þ¥Õ¥©½¸¹ç¤òÊѹ¹¤¹¤ëµö²Ä¤¬¤Ê¤±¤ì¤Ð
-¤Ê¤é¤Ê¤¤¡£
-.I semval
-¤¬
-.I sem_op
-¤ÎÀäÂÐÃͰʾå¤Î¾ì¹ç¤Ï¡¢Áàºî¤Ïľ¤Á¤Ë¼Â¹Ô¤µ¤ì¤ë:
-.I semval
-¤«¤é
-.I sem_op
-¤ÎÀäÂÐÃͤ¬¸º»»¤µ¤ì¤ë¡£
-¤µ¤é¤Ë¡¢¤³¤ÎÁàºî¤Ë
-.B SEM_UNDO
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤³¤Î¥»¥Þ¥Õ¥©¤Î¥×¥í¥»¥¹¡¦¥¢¥ó¥É¥¥¿ô
-.RI ( semadj )
-¤ò¹¹¿·¤¹¤ë¡£
-.\"O If the absolute value of
-.\"O .I sem_op
-.\"O is greater than
-.\"O .IR semval ,
-.\"O and
-.\"O .B IPC_NOWAIT
-.\"O is specified in
-.\"O .IR sem_flg ,
-.\"O .BR semop ()
-.\"O fails, with
-.\"O .I errno
-.\"O set to
-.\"O .B EAGAIN
-.\"O (and none of the operations in
-.\"O .I sops
-.\"O is performed).
-.I semval
-¤¬
-.I sem_op
-¤ÎÀäÂÐÃͤè¤ê¾®¤µ¤¯¡¢
-.I sem_flg
-¤Ë
-.B IPC_NOWAIT
-¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢
-.BR semop ()
-¤Ï¼ºÇÔ¤·¡¢
-.I errno
-¤Ë
-.B EAGAIN
-¤¬ÀßÄꤵ¤ì¤ë (¤³¤Î¤È¤­
-.I sops
-¤ÎÁàºî¤ÏÁ´¤¯¼Â¹Ô¤µ¤ì¤Ê¤¤)¡£
-.\"O Otherwise
-.\"O .I semncnt
-.\"O (the counter of processes waiting for this semaphore's value to increase)
-.\"O is incremented by one and the process sleeps until
-.\"O one of the following occurs:
-.B IPC_WAIT
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢
-.I semncnt
-(¤³¤Î¥»¥Þ¥Õ¥©¤ÎÃͤ¬Áý²Ã¤¹¤ë¤Î¤òÂԤäƤ¤¤ë¥×¥í¥»¥¹¿ô¤Î¥«¥¦¥ó¥¿)
-¤ò 1 Áý²Ã¤µ¤»¤Æ¡¢°Ê²¼¤Î¤¤¤º¤ì¤«¤¬µ¯¤³¤ë¤Þ¤Ç¥×¥í¥»¥¹¤òÄä»ß (sleep) ¤¹¤ë¡£
+\fIsem_op\fP が 0 未満の場合、プロセスにはそのセマフォ集合を変更する許可がなければ ならない。 \fIsemval\fP が \fIsem_op\fP
+の絶対値以上の場合は、操作は直ちに実行される: \fIsemval\fP から \fIsem_op\fP の絶対値を減算し、さらに、この操作に
+\fBSEM_UNDO\fP が指定されている場合は、このセマフォの調整値 (\fIsemadj\fP) に \fIsem_op\fP の絶対値を加算する。
+\fIsemval\fP が \fIsem_op\fP の絶対値より小さく、 \fIsem_flg\fP に \fBIPC_NOWAIT\fP が指定された場合は、
+\fBsemop\fP()  は失敗し、 \fIerrno\fP に \fBEAGAIN\fP が設定される (このとき \fIsops\fP の操作は全く実行されない)。
+\fIsemval\fP が \fIsem_op\fP の絶対値より小さく、 \fBIPC_WAIT\fP が指定されていない場合は、 \fIsemncnt\fP
+(このセマフォの値が増加するのを待っているスレッド数のカウンタ)  を 1 増加させて、以下のいずれかが起こるまでスレッドを停止 (sleep) する。
 .IP \(bu 3
-.\"O .I semval
-.\"O becomes greater than or equal to the absolute value of
-.\"O .IR sem_op ,
-.\"O at which time the value of
-.\"O .I semncnt
-.\"O is decremented, the absolute value of
-.\"O .I sem_op
-.\"O is subtracted from
-.\"O .I semval
-.\"O and, if
-.\"O .B SEM_UNDO
-.\"O is specified for this operation, the system updates the process undo count
-.\"O .RI ( semadj )
-.\"O for this semaphore.
-.I semval
-¤¬
-.I sem_op
-¤ÎÀäÂÐÃͰʾå¤Ë¤Ê¤Ã¤¿: ¤³¤Î¤È¤­
-.I semncnt
-¤¬ 1 ¸º»»¤µ¤ì¡¢
-.I semval
-¤«¤é
-.I sem_op
-¤ÎÀäÂÐÃͤ¬°ú¤«¤ì¤ë¡£
-¤³¤ÎÁàºî¤Ë
-.B SEM_UNDO
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ë¤Ï¤³¤Î¥»¥Þ¥Õ¥©¤Î¥×¥í¥»¥¹¡¦¥¢¥ó¥É¥¥¿ô
-.RI ( semadj )
-¤â¹¹¿·¤¹¤ë¡£
+\fIsemval\fP が \fIsem_op\fP の絶対値以上になった。この時点で、操作は上述の通り実行される。
 .IP \(bu
-.\"O The semaphore set is removed from the system:
-.\"O .BR semop ()
-.\"O fails, with
-.\"O .I errno
-.\"O set to
-.\"O .BR EIDRM .
-¥»¥Þ¥Õ¥©½¸¹ç¤¬¥·¥¹¥Æ¥à¤«¤éºï½ü¤µ¤ì¤¿: ¤³¤Î¤È¤­
-.BR semop ()
-¤Ï¼ºÇÔ¤·
-.I errno
-¤Ë
-.B EIDRM
-¤¬ÀßÄꤵ¤ì¤ë¡£
+セマフォ集合がシステムから削除された: このとき \fBsemop\fP()  は失敗し \fIerrno\fP に \fBEIDRM\fP が設定される。
 .IP \(bu
-.\"O The calling process catches a signal:
-.\"O the value of
-.\"O .I semncnt
-.\"O is decremented and
-.\"O .BR semop ()
-.\"O fails, with
-.\"O .I errno
-.\"O set to
-.\"O .BR EINTR .
-¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤¬¥·¥°¥Ê¥ë¤òÊá³Í¤·¤¿: ¤³¤Î¤È¤­
-.I semncnt
-¤¬ 1 ¸º»»¤µ¤ì¡¢
-.BR semop ()
-¤Ï¼ºÇÔ¤·
-.I errno
-¤Ë
-.B EINTR
-¤¬ÀßÄꤵ¤ì¤ë¡£
+呼び出したスレッドがシグナルを捕獲した: このとき \fIsemncnt\fP が 1 減算され、 \fBsemop\fP()  は失敗し \fIerrno\fP に
+\fBEINTR\fP が設定される。
 .IP \(bu
-.\"O The time limit specified by
-.\"O .I timeout
-.\"O in a
-.\"O .BR semtimedop ()
-.\"O call expires: the system call fails, with
-.\"O .I errno
-.\"O set to
-.\"O .BR EAGAIN .
-.\" motoki: the system call ¤Ï semtimedop () ¤Î¤³¤È¡©
-.BR semtimedop ()
-¤Î
-.I timeout
-¤Ç»ØÄꤵ¤ì¤¿À©¸Â»þ´Ö¤¬·Ð²á¤·¤¿: ¤³¤Î¤È¤­
-.BR semtimedop ()
-¤Ï¼ºÇÔ¤·¡¢
-.I errno
-¤Ë
-.B EAGAIN
-¤¬ÀßÄꤵ¤ì¤ë¡£
+\fBsemtimedop\fP()  の \fItimeout\fP で指定された制限時間が経過した: このとき \fBsemtimedop\fP()  は失敗し、
+\fIerrno\fP に \fBEAGAIN\fP が設定される。
 .PP
-.\"O On successful completion, the
-.\"O .I sempid
-.\"O value for each semaphore specified in the array pointed to by
-.\"O .I sops
-.\"O is set to the process ID of the calling process.
-Áàºî¤¬À®¸ù¤·¤¿¾ì¹ç¡¢
-.I sops
-¤¬»Ø¤¹ÇÛÎó¤Ë¤è¤Ã¤ÆÁàºîÂоݤȤʤ俳ƥ»¥Þ¥Õ¥©¤Î
-.I sempid
-¥á¥ó¥Ð¡¼¤Ë¤Ï¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤¬ÀßÄꤵ¤ì¤ë¡£
-.\"O In addition, the
-.\"O .I sem_otime
-.\"O .\" and
-.\"O .\" .I sem_ctime
-.\"O is set to the current time.
-¤µ¤é¤Ë
-.I sem_otime
-.\" ¤È
+.\" and
 .\" .I sem_ctime
-¤Ë¸½ºß»þ¹ï¤¬ÀßÄꤵ¤ì¤ë¡£
-.PP
-.\"O The function
-.\"O .BR semtimedop ()
-.\"O behaves identically to
-.\"O .BR semop ()
-.\"O except that in those cases were the calling process would sleep,
-.\"O the duration of that sleep is limited by the amount of elapsed
-.\"O time specified by the
-.\"O .I timespec
-.\"O structure whose address is passed in the
-.\"O .I timeout
-.\"O argument.
-.BR semtimedop ()
-´Ø¿ô¤Î¿¶¤ëÉñ¤¤¤Ï
-.BR semop ()
-¤ÈÁ´¤¯Æ±¤¸¤À¤¬¡¢
-¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤¬Ää»ß¤¹¤ë¾ì¹ç¡¢Ää»ß´ü´Ö¤Î¾å¸Â¤¬
-.I timeout
-°ú¤­¿ô¤Î»Ø¤¹
-.I timespec
-¹½Â¤ÂΤǻØÄꤵ¤ì¤¿»þ´Ö¤È¤Ê¤ëÅÀ¤À¤±¤¬°Û¤Ê¤ë¡£
-.\"O If the specified time limit has been reached,
-.\"O .BR semtimedop ()
-.\"O fails with
-.\"O .I errno
-.\"O set to
-.\"O .B EAGAIN
-.\"O (and none of the operations in
-.\"O .I sops
-.\"O is performed).
-»ØÄꤷ¤¿À©¸Â»þ´Ö¤Ë㤷¤¿¾ì¹ç¤Ï¡¢
-.BR semtimedop ()
-¤Ï¼ºÇÔ¤·¡¢
-.I errno
-¤Ë
-.B EAGAIN
-¤¬ÀßÄꤵ¤ì¤ë
-(¤³¤Î¤È¤­
-.I sops
-¤ÎÁàºî¤Ï¼Â¹Ô¤µ¤ì¤Ê¤¤)¡£
-.\"O If the
-.\"O .I timeout
-.\"O argument is NULL,
-.\"O then
-.\"O .BR semtimedop ()
-.\"O behaves exactly like
-.\"O .BR semop ().
-.I timeout
-°ú¤­¿ô¤¬ NULL ¤Î¾ì¹ç¡¢
-.BR semtimedop ()
-´Ø¿ô¤Î¿¶¤ëÉñ¤¤¤Ï
-.BR semop ()
-´Ø¿ô¤ÈÁ´¤¯Æ±¤¸¤Ë¤Ê¤ë¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O If successful
-.\"O .BR semop ()
-.\"O and
-.\"O .BR semtimedop ()
-.\"O return 0;
-.\"O otherwise they return \-1
-.\"O with
-.\"O .I errno
-.\"O indicating the error.
-À®¸ù¤·¤¿¾ì¹ç¡¢
-.BR semop ()
-¤È
-.BR semtimedop ()
-¤Ï 0 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð \-1 ¤òÊÖ¤·¡¢
-¥¨¥é¡¼¤ò¼¨¤¹
-.I errno
-¤òÀßÄꤹ¤ë¡£
-.\"O .SH ERRORS
-.SH ¥¨¥é¡¼
-.\"O On failure,
-.\"O .I errno
-.\"O is set to one of the following:
-¼ºÇÔ¤·¤¿¾ì¹ç¡¢
-.I errno
-¤Ë°Ê²¼¤Î¤É¤ì¤«¤¬ÀßÄꤵ¤ì¤ë:
-.TP
-.B E2BIG
-.\"O The argument
-.\"O .I nsops
-.\"O is greater than
-.\"O .BR SEMOPM ,
-.\"O the maximum number of operations allowed per system
-.\"O call.
-.I nsops
-°ú¤­¿ô¤¬
-.B SEMOPM
-¤è¤êÂ礭¤¤¡£
-.B SEMOPM
-¤Ï°ì²ó¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Çµö¤µ¤ì¤ëÁàºî¤ÎºÇÂç¸Ä¿ô¤Ç¤¢¤ë¡£
-.TP
-.B EACCES
-.\"O The calling process does not have the permissions required
-.\"O to perform the specified semaphore operations,
-.\"O and does not have the
-.\"O .B CAP_IPC_OWNER
-.\"O capability.
-¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Ë¤Ï»ØÄꤵ¤ì¤¿¥»¥Þ¥Õ¥©Áàºî¤ò¹Ô¤¦¤Î¤Ë
-ɬÍפʥ¢¥¯¥»¥¹µö²Ä¤¬¤Ê¤¯¡¢
-.B CAP_IPC_OWNER
-¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤â¤Ê¤¤¡£
-.TP
-.B EAGAIN
-.\"O An operation could not proceed immediately and either
-.\"O .B IPC_NOWAIT
-.\"O was specified in
-.\"O .I sem_flg
-.\"O or the time limit specified in
-.\"O .I timeout
-.\"O expired.
-Áàºî¤òľ¤Á¤Ë½èÍý¤¹¤ë¤³¤È¤¬¤Ç¤­¤º¡¢¤«¤Ä
-.I sem_flg
-¤Ë
-.B IPC_NOWAIT
-¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤«
-.I timeout
-¤Ç»ØÄꤵ¤ì¤¿À©¸Â»þ´Ö¤¬·Ð²á¤·¤¿¡£
-.TP
-.B EFAULT
-.\"O An address specified in either the
-.\"O .I sops
-.\"O or the
-.\"O .I timeout
-.\"O arguments isn't accessible.
-°ú¤­¿ô
-.I sops
-¤«
-.I timeout
-¤¬»Ø¤·¤Æ¤¤¤ë¥¢¥É¥ì¥¹¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤¡£
-.TP
-.B EFBIG
-.\"O For some operation the value of
-.\"O .I sem_num
-.\"O is less than 0 or greater than or equal to the number
-.\"O of semaphores in the set.
-¤¢¤ëÁàºî¤Ç¡¢
-.I sem_num
-¤ÎÃͤ¬ 0 Ì¤Ëþ¤«¡¢½¸¹çÆâ¤Î¥»¥Þ¥Õ¥©¤Î¿ô°Ê¾å¤Ç¤¢¤ë¡£
-.TP
-.B EIDRM
-.\"O The semaphore set was removed.
-¥»¥Þ¥Õ¥©½¸¹ç¤¬ºï½ü¤µ¤ì¤¿¡£
-.TP
-.B EINTR
-.\"O While blocked in this system call, the process caught a signal; see
-.\"O .BR signal (7).
-¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÇÄä»ß¤·¤Æ¤¤¤ë»þ¤Ë¥×¥í¥»¥¹¤¬¥·¥°¥Ê¥ë¤òÊá³Í¤·¤¿¡£
-.BR single (7)
-»²¾È¡£
-.TP
-.B EINVAL
-.\"O The semaphore set doesn't exist, or
-.\"O .I semid
-.\"O is less than zero, or
-.\"O .I nsops
-.\"O has a nonpositive value.
-¥»¥Þ¥Õ¥©½¸¹ç¤¬Â¸ºß¤·¤Ê¤¤¤«¡¢
-.I semid
-¤¬ 0 Ì¤Ëþ¤Ç¤¢¤ë¤«¡¢
-.I nsops
-¤¬Àµ¤Î¿ô¤Ç¤Ê¤¤¡£
-.TP
-.B ENOMEM
-.\"O The
-.\"O .I sem_flg
-.\"O of some operation specified
-.\"O .B SEM_UNDO
-.\"O and the system does not have enough memory to allocate the undo
-.\"O structure.
-¤¢¤ëÁàºî¤Ç
-.I sem_flg
-¤Ë
-.B SEM_UNDO
-¤¬»ØÄꤵ¤ì¤¿¤¬¡¢¥·¥¹¥Æ¥à¤Ë¥¢¥ó¥É¥¥¹½Â¤ÂΤ˳ä¤êÅö¤Æ¤ë½½Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤¤¡£
-.TP
-.B ERANGE
-.\"O For some operation
-.\"O .I sem_op+semval
-.\"O is greater than
-.\"O .BR SEMVMX ,
-.\"O the implementation dependent maximum value for
-.\"O .IR semval .
-¤¢¤ëÁàºî¤Ç
-.I sem_op+semval
-¤¬
-.B SEMVMX
-¤è¤êÂ礭¤¤¡£
-.B SEMVMX
-¤Ï
-.I semval
-¤ÎºÇÂçÃͤǡ¢¤½¤ÎÃͤϼÂÁõ°Í¸¤Ç¤¢¤ë¡£
-.\"O .SH VERSIONS
-.SH ¥Ð¡¼¥¸¥ç¥ó
-.\"O .BR semtimedop ()
-.\"O first appeared in Linux 2.5.52,
-.\"O and was subsequently backported into kernel 2.4.22.
-.BR semtimedop ()
-¤Ï Linux 2.5.52 ¤Ç½é¤á¤ÆÅо줷¡¢
-¤½¤ì¤«¤é¥«¡¼¥Í¥ë 2.4.22 ¤Ë¤â°Ü¿¢¤µ¤ì¤¿¡£
-.\"O Glibc support for
-.\"O .BR semtimedop ()
-.\"O first appeared in version 2.3.3.
-.BR semtimedop ()
-¤Î glibc ¤Ç¤Î¥µ¥Ý¡¼¥È¤Ï¥Ð¡¼¥¸¥ç¥ó 2.3.3 ¤Ç½é¤á¤ÆÅо줷¤¿¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-SVr4, POSIX.1-2001.
-.\"O .\" SVr4 documents additional error conditions EINVAL, EFBIG, ENOSPC.
-.\" SVr4 ¤Ë¤Ï¡¢ÄɲäǠEINVAL, EFBIG, ENOSPC ¤Î¥¨¥é¡¼¾õÂ֤ˤĤ¤¤Æ¤Î
-.\" µ­½Ò¤¬¤¢¤ë¡£
-.\"O .SH NOTES
-.SH Ãí°Õ
-.\"O The
-.\"O .I sem_undo
-.\"O structures of a process aren't inherited by the child produced by
-.\"O .BR fork (2),
-.\"O but they are inherited across an
-.\"O .BR execve (2)
-.\"O system call.
-¤¢¤ë¥×¥í¥»¥¹¤Î
-.I sem_undo
-¹½Â¤ÂΤÏ
-.BR fork (2)
-¤ÇÀ¸À®¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Ë¤Ï·Ñ¾µ¤µ¤ì¤Ê¤¤¤¬¡¢
-.BR execve (2)
-¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î¾ì¹ç¤Ï·Ñ¾µ¤µ¤ì¤ë¡£
+操作が成功した場合、 \fIsops\fP が指す配列によって操作対象となった各セマフォの \fIsempid\fP メンバーには呼び出し元のプロセス ID
+が設定される。さらに \fIsem_otime\fP に現在時刻が設定される。
 .PP
-.\"O .BR semop ()
-.\"O is never automatically restarted after being interrupted by a signal handler,
-.\"O regardless of the setting of the
-.\"O .B SA_RESTART
-.\"O flag when establishing a signal handler.
-.BR semop ()
-¤Ï¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤Ã¤ÆÃæÃǤµ¤ì¤¿¸å¤Ë¡¢
-·è¤·¤Æ¼«Æ°Åª¤ËºÆ³«¤¹¤ë¤³¤È¤Ï¤Ê¤¤¡£
-¤¿¤È¤¨¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ÎÀßÄê»þ¤Ë
-.B SA_RESTART
-¥Õ¥é¥°¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Æ¤âºÆ³«¤¹¤ë¤³¤È¤Ï¤Ê¤¤
+\fBsemtimedop\fP() 関数の振る舞いは \fBsemop\fP() と全く同じだが、呼び出し元
+スレッドが停止する場合、停止期間の上限が \fItimeout\fP 引き数の指す
+\fItimespec\fP 構造体で指定された時間となる点だけが異なる (この停止期間は
+システムクロックの粒度に切り上げられ、カーネルのスケジューリング遅延に
+より、この停止期間は少しだけ長くなる可能性がある)。
+指定した制限時間に達した場合は、 \fBsemtimedop\fP() は失敗し、 \fIerrno\fP に
+\fBEAGAIN\fP が設定される (このとき \fIsops\fP の操作は実行されない)。
+\fItimeout\fP 引き数が NULL の場合、 \fBsemtimedop\fP() 関数の振る舞いは
+\fBsemop\fP() 関数と全く同じになる。
+.SH 返り値
+成功した場合、 \fBsemop\fP()  と \fBsemtimedop\fP()  は 0 を返す。そうでなければ \-1 を返し、 エラーを示す
+\fIerrno\fP を設定する。
+.SH エラー
+失敗した場合、 \fIerrno\fP に以下のどれかが設定される:
+.TP 
+\fBE2BIG\fP
+\fInsops\fP 引き数が \fBSEMOPM\fP より大きい。 \fBSEMOPM\fP は一回のシステムコールで許される操作の最大個数である。
+.TP 
+\fBEACCES\fP
+呼び出し元プロセスには指定されたセマフォ操作を行うのに 必要なアクセス許可がなく、 \fBCAP_IPC_OWNER\fP ケーパビリティもない。
+.TP 
+\fBEAGAIN\fP
+操作を直ちに処理することができず、かつ \fIsem_flg\fP に \fBIPC_NOWAIT\fP が指定されているか \fItimeout\fP
+で指定された制限時間が経過した。
+.TP 
+\fBEFAULT\fP
+引き数 \fIsops\fP か \fItimeout\fP が指しているアドレスにアクセスできない。
+.TP 
+\fBEFBIG\fP
+ある操作で、 \fIsem_num\fP の値が 0 未満か、集合内のセマフォの数以上である。
+.TP 
+\fBEIDRM\fP
+セマフォ集合が削除された。
+.TP 
+\fBEINTR\fP
+このシステムコールで停止している時にスレッドがシグナルを捕獲した。 \fBsingle\fP(7) 参照。
+.TP 
+\fBEINVAL\fP
+セマフォ集合が存在しないか、 \fIsemid\fP が 0 未満であるか、 \fInsops\fP が正の数でない。
+.TP 
+\fBENOMEM\fP
+ある操作で \fIsem_flg\fP に \fBSEM_UNDO\fP が指定されたが、システムにアンドゥ構造体に割り当てる十分なメモリがない。
+.TP 
+\fBERANGE\fP
+ある操作で \fIsem_op+semval\fP が \fBSEMVMX\fP より大きい。 \fBSEMVMX\fP は \fIsemval\fP
+の最大値で、その値は実装依存である。
+.SH バージョン
+\fBsemtimedop\fP()  は Linux 2.5.52 で初めて登場し、 それからカーネル 2.4.22 にも移植された。
+\fBsemtimedop\fP()  の glibc でのサポートはバージョン 2.3.3 で初めて登場した。
+.SH 準拠
+.\" SVr4 documents additional error conditions EINVAL, EFBIG, ENOSPC.
+SVr4, POSIX.1\-2001.
+.SH 注意
+.\" Like Linux, the FreeBSD man pages still document
+.\" the inclusion of these header files.
+Linux や POSIX の全てのバージョンでは、 \fI<sys/types.h>\fP と \fI<sys/ipc.h>\fP
+のインクルードは必要ない。しかしながら、いくつかの古い実装ではこれらのヘッダファイルのインクルードが必要であり、 SVID
+でもこれらのインクルードをするように記載されている。このような古いシステムへの移植性を意図したアプリケーションではこれらのファイルをインクルードする必要があるかもしれない。
+
+あるプロセスの \fIsem_undo\fP 構造体は \fBfork\fP(2)  で生成された子プロセスには継承されないが、 \fBexecve\fP(2)
+システムコールの場合は継承される。
 .PP
-.\"O .I semadj
-.\"O is a per-process integer which is simply the (negative) count
-.\"O of all semaphore operations performed specifying the
-.\"O .B SEM_UNDO
-.\"O flag.
-.I semadj
-¤Ï¥×¥í¥»¥¹¤´¤È¤ÎÀ°¿ô¤Ç¡¢
-.B SEM_UNDO
-¥Õ¥é¥°¤òÀßÄꤷ¤Æ¼Â¹Ô¤µ¤ì¤¿Á´¤Æ¤Î¥»¥Þ¥Õ¥©Áàºî¤Î(Éé¿ô¤Î)¥«¥¦¥ó¥¿¤Ç¤¢¤ë¡£
-.\"O When a semaphore's value is directly set using the
-.\"O .B SETVAL
-.\"O or
-.\"O .B SETALL
-.\"O request to
-.\"O .BR semctl (2),
-.\"O the corresponding
-.\"O .I semadj
-.\"O values in all processes are cleared.
-.BR semctl (2)
-¤Ë
-.B SETVAL
-¤Þ¤¿¤Ï
-.B SETALL
-¤ò»ØÄꤷ¡¢¥»¥Þ¥Õ¥©¤ÎÃͤ¬
-ľÀÜÀßÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢Á´¤Æ¤Î¥×¥í¥»¥¹¤Ë¤ª¤¤¤ÆÂбþ¤¹¤ë
-.I semadj
-¤ÎÃͤ¬¥¯¥ê¥¢¤µ¤ì¤ë¡£
+\fBsemop\fP()  はシグナルハンドラによって中断された後に、 決して自動的に再開することはない。 たとえシグナルハンドラの設定時に
+\fBSA_RESTART\fP フラグがセットされていても再開することはない
+
+セマフォの調整値 (\fIsemadj\fP) は、プロセス毎のセマフォ毎の整数で、 \fBSEM_UNDO\fP
+フラグを指定して行われた、セマフォに対するすべての操作の合計値を反転したものである。 各プロセスは \fIsemadj\fP の値のリストを保持する \(em
+リストのそれぞれの値は \fBSEM_UNDO\fP を使って操作が行われた個々のセマフォに対応する。 プロセスが終了する際、 セマフォ毎の
+\fIsemadj\fP の各々の値が対応するセマフォに加算される。 これにより、そのプロセスがそのセマフォに対して行った操作の影響が取り消される
+(ただし、下記の「バグ」を参照)。 \fBsemctl\fP(2) の \fBSETVAL\fP や \fBSETALL\fP を使ってセマフォの値が直接設定された場合、
+すべてのプロセスの対応する \fIsemadj\fP の値がクリアされる。
 .PP
-.\"O The \fIsemval\fP, \fIsempid\fP, \fIsemzcnt\fP, and \fIsemnct\fP values
-.\"O for a semaphore can all be retrieved using appropriate
-.\"O .BR semctl (2)
-.\"O calls.
-¤¢¤ë¥»¥Þ¥Õ¥©¤Î \fIsemval\fP, \fIsempid\fP, \fIsemzcnt\fP, \fIsemnct\fP
-¤ÎÃͤϤ¤¤º¤ì¤â¡¢Å¬ÀÚ¤ÊÁàºî¤ò»ØÄꤷ¤Æ
-.BR semctl (2)
-¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ç¼èÆÀ¤Ç¤­¤ë¡£
+あるセマフォの \fIsemval\fP, \fIsempid\fP, \fIsemzcnt\fP, \fIsemnct\fP の値はいずれも、適切な操作を指定して
+\fBsemctl\fP(2)  を呼び出すことで取得できる。
 .PP
-.\"O The following limits on semaphore set resources affect the
-.\"O .BR semop ()
-.\"O call:
-¥»¥Þ¥Õ¥©½¸¹ç¤Î¥ê¥½¡¼¥¹¤Ë´Ø¤¹¤ëÀ©¸Â¤Î¤¦¤Á¡¢
-.BR semop ()
-¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¤â¤Î¤ò°Ê²¼¤Ëµó¤²¤ë:
-.TP
-.B SEMOPM
-.\"O Maximum number of operations allowed for one
-.\"O .BR semop ()
-.\"O call (32)
-.\"O (on Linux, this limit can be read and modified via the third field of
-.\"O .IR /proc/sys/kernel/sem ).
-.\"O .\" This /proc file is not available in Linux 2.2 and earlier -- MTK
-°ì²ó¤Î
-.BR semop ()
-¤Çµö¤µ¤ì¤ëÁàºî¤ÎºÇÂç¿ô (32)¡£
-(Linux ¤Ç¤Ï¡¢¤³¤ÎÀ©¸ÂÃͤÏ
-.I /proc/sys/kernel/sem
-¤ÎÂè3¥Õ¥£¡¼¥ë¥É¤ËÂбþ¤·¡¢Æɤ߽Ф·¤âÊѹ¹¤â¤Ç¤­¤ë)¡£
-.\" ¤³¤Î /proc ¥Õ¥¡¥¤¥ë¤Ï Linux 2.2 °ÊÁ°¤Ç¤ÏÍøÍѤǤ­¤Ê¤¤ -- MTK
-.TP
-.B SEMVMX
-.\"O Maximum allowable value for
-.\"O .IR semval :
-.\"O implementation dependent (32767).
-.I semval
-¤¬¼è¤êÆÀ¤ëºÇÂçÃÍ: ¼ÂÁõ°Í¸ (32767)¡£
+セマフォ集合のリソースに関する制限のうち、 \fBsemop\fP()  に影響を及ぼすものを以下に挙げる:
+.TP 
+\fBSEMOPM\fP
+.\" This /proc file is not available in Linux 2.2 and earlier -- MTK
+一回の \fBsemop\fP()  で許される操作の最大数 (32)。 (Linux では、この制限値は \fI/proc/sys/kernel/sem\fP
+の第3フィールドに対応し、読み出しも変更もできる)。
+.TP 
+\fBSEMVMX\fP
+\fIsemval\fP が取り得る最大値: 実装依存 (32767)。
 .PP
-.\"O The implementation has no intrinsic limits for
-.\"O the adjust on exit maximum value
-.\"O .RB ( SEMAEM ),
-.\"O the system wide maximum number of undo structures
-.\"O .RB ( SEMMNU )
-.\"O and the per-process maximum number of undo entries system parameters.
-°Ê²¼¤ÎÃͤ˴ؤ·¤Æ¤Ï¼ÂÁõ°Í¸¤ÎÀ©¸Â¤Ï¤Ê¤¤¡£
-½ªÎ»»þ¤ÎÄ´À° (adjust on exit) ¤ÎºÇÂçÃÍ
-.RB ( SEMAEM )¡¢
-¥·¥¹¥Æ¥àÁ´ÂΤΥ¢¥ó¥É¥¥¹½Â¤ÂΤκÇÂç¿ô
-.RB ( SEMMNU )¡¢
-¥×¥í¥»¥¹¤¢¤¿¤ê¤Î¥¢¥ó¥É¥¥¹½Â¤ÂΤκÇÂç¿ô¡£
-.\"O .SH BUGS
-.SH ¥Ð¥°
-.\"O When a process terminates, its set of associated
-.\"O .I semadj
-.\"O structures is used to undo the effect of all of the
-.\"O semaphore operations it performed with the
-.\"O .B SEM_UNDO
-.\"O flag.
-¥×¥í¥»¥¹¤¬½ªÎ»¤¹¤ëºÝ¡¢¥×¥í¥»¥¹¤ËÂбþ¤¹¤ë
-.I semadj
-¤Î½¸¹ç¤ò»È¤Ã¤Æ¡¢
-.B SEM_UNDO
-¥Õ¥é¥°ÉÕ¤­¤Ç¼Â¹Ô¤µ¤ì¤¿Á´¤Æ¤Î¥»¥Þ¥Õ¥©Áàºî¤Î±Æ¶Á¤ò¼è¤ê¾Ã¤¹¡£
-.\"O This raises a difficulty: if one (or more) of these semaphore adjustments
-.\"O would result in an attempt to decrease a semaphore's value below zero,
-.\"O what should an implementation do?
-¤³¤ì¤Ë¤è¤ê¤¢¤ëÌäÂ꤬ȯÀ¸¤¹¤ë: ¤³¤ì¤é¤Î¥»¥Þ¥Õ¥©¤ÎÄ´À°¤ò¹Ô¤Ã¤Æ¤¤¤ë¤È¡¢
-Ãæ¤Ë¤Ï¥»¥Þ¥Õ¥©¤ÎÃͤ¬ 0 Ì¤Ëþ¤ÎÃͤˤ·¤è¤¦¤È¤¹¤ë¾ì¹ç¤¬½Ð¤Æ¤¯¤ë¡£
-¤³¤Î¤è¤¦¤Ê¾ì¹ç¡¢¤É¤Î¤è¤¦¤Ë¼ÂÁõ¤¹¤ë¤Ù¤­¤«?
-.\"O One possible approach would be to block until all the semaphore
-.\"O adjustments could be performed.
-.\"O This is however undesirable since it could force process termination to
-.\"O block for arbitrarily long periods.
-¤Ò¤È¤Ä¤Î¹Í¤¨¤é¤ì¤ë¼êË¡¤Ï¡¢Á´¤Æ¤Î¥»¥Þ¥Õ¥©Ä´À°¤¬¼Â¹Ô¤µ¤ì¤ë¤Þ¤Ç
-Ää»ß¤¹¤ë¤³¤È¤Ç¤¢¤ë¡£¤·¤«¤·¡¢¤³¤ÎÊýË¡¤Ç¤Ï¥×¥í¥»¥¹¤Î½ªÎ»¤¬
-Ĺ»þ´Ö¤Ë¤ï¤¿¤Ã¤ÆÄä»ß¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¤Î¤Ç˾¤Þ¤·¤¯¤Ê¤¤¡£
-¤·¤«¤â¤É¤ì¤¯¤é¤¤Ä¹»þ´Ö¤Ë¤Ê¤ë¤«¤Ïʬ¤«¤é¤Ê¤¤¡£
-.\"O Another possibility is that such semaphore adjustments could be ignored
-.\"O altogether (somewhat analogously to failing when
-.\"O .B IPC_NOWAIT
-.\"O is specified for a semaphore operation).
-Ê̤ÎÁªÂò»è¤È¤·¤Æ¡¢¤³¤Î¤è¤¦¤Ê¥»¥Þ¥Õ¥©Ä´À°¤ò´°Á´¤Ë̵»ë¤·¤Æ¤·¤Þ¤¦ÊýË¡¤¬¤¢¤ë
-(¤³¤ì¤Ï¥»¥Þ¥Õ¥©Áàºî¤È¤·¤Æ
-.B IPC_NOWAIT
-¤¬»ØÄꤹ¤ë¤Î¤È¾¯¤·»÷¤Æ¤¤¤ë)¡£
-.\"O Linux adopts a third approach: decreasing the semaphore value
-.\"O as far as possible (i.e., to zero) and allowing process
-.\"O termination to proceed immediately.
-Linux ¤ÏÂè»°¤Î¼êË¡¤òºÎÍѤ·¤Æ¤¤¤ë: ¥»¥Þ¥Õ¥©¤ÎÃͤò½ÐÍè¤ë¤À¤± (¤Ä¤Þ¤ê
-0 ¤Þ¤Ç) ¸º¾¯¤µ¤»¤Æ¡¢¥×¥í¥»¥¹¤Î½ªÎ»¤òľ¤Á¤Ë³¹Ô¤Ç¤­¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤ë¡£
+以下の値に関しては実装依存の制限はない。 終了時の調整 (adjust on exit) の最大値 (\fBSEMAEM\fP)、
+システム全体のアンドゥ構造体の最大数 (\fBSEMMNU\fP)、 プロセスあたりのアンドゥ構造体の最大数。
+.SH バグ
+プロセスが終了する際、プロセスに対応する \fIsemadj\fP の集合を使って、 \fBSEM_UNDO\fP
+フラグ付きで実行された全てのセマフォ操作の影響を取り消す。 これによりある問題が発生する: これらのセマフォの調整を行っていると、 中にはセマフォの値が
+0 未満の値にしようとする場合が出てくる。 このような場合、どのように実装するべきか? ひとつの考えられる手法は、全てのセマフォ調整が実行されるまで
+停止することである。しかし、この方法ではプロセスの終了が 長時間にわたって停止されることがあるので望ましくない。
+しかもどれくらい長時間になるかは分からない。 別の選択肢として、このようなセマフォ調整を完全に無視してしまう方法がある (これはセマフォ操作として
+\fBIPC_NOWAIT\fP が指定するのと少し似ている)。 Linux は第三の手法を採用している: セマフォの値を出来るだけ (つまり 0 まで)
+減少させて、プロセスの終了を直ちに続行できるようにしている。
 
-.\"O In kernels 2.6.x, x <= 10, there is a bug that in some circumstances
-.\"O prevents a process that is waiting for a semaphore value to become
-.\"O zero from being woken up when the value does actually become zero.
-.\"O This bug is fixed in kernel 2.6.11.
-.\"O .\" The bug report:
-.\"O .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=110260821123863&w=2
-.\"O .\" the fix:
-.\"O .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=110261701025794&w=2
-¥«¡¼¥Í¥ë 2.6.x (x <= 10) ¤Ë¤Ï¡¢¤¢¤ë¾õ¶·¤Ë¤ª¤¤¤Æ¥»¥Þ¥Õ¥©Ãͤ¬ 0 ¤Ë¤Ê¤ë¤Î¤ò
-ÂԤäƤ¤¤ë¥×¥í¥»¥¹¤¬¡¢¥»¥Þ¥Õ¥©Ãͤ¬¼ÂºÝ¤Ë 0 ¤Ë¤Ê¤Ã¤¿¤È¤­¤Ëµ¯¾² (wake up)
-¤µ¤ì¤Ê¤¤¡¢¤È¤¤¤¦¥Ð¥°¤¬¤¢¤ë¡£¤³¤Î¥Ð¥°¤Ï¥«¡¼¥Í¥ë 2.6.11 ¤Ç½¤Àµ¤µ¤ì¤Æ¤¤¤ë¡£
-.\" ¥Ð¥°¥ì¥Ý¡¼¥È:
+.\" The bug report:
 .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=110260821123863&w=2
-.\" ½¤Àµ:
+.\" the fix:
 .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=110261701025794&w=2
-.\"O .SH EXAMPLE
-.SH Îã
-.\"O The following code segment uses
-.\"O .BR semop ()
-.\"O to atomically wait for the value of semaphore 0 to become zero,
-.\"O and then increment the semaphore value by one.
-°Ê²¼¤ÎÉôʬŪ¤Ê¥³¡¼¥É¤Ï¡¢
-¥»¥Þ¥Õ¥© 0 ¤ÎÃͤ¬ 0 ¤Ë¤Ê¤ë¤Î¤òÂԤäƤ«¤é¡¢
-¥»¥Þ¥Õ¥©¤ÎÃͤò 1 ²Ã»»¤¹¤ë½èÍý¤ò¡¢
-.BR semop ()
-¤ò»È¤Ã¤Æ¥¢¥È¥ß¥Ã¥¯ (atomically) ¤Ë¹Ô¤¦¡£
+カーネル 2.6.x (x <= 10) には、ある状況においてセマフォ値が 0 になるのを 待っているスレッドが、セマフォ値が実際に 0
+になったときに起床 (wake up)  されない、というバグがある。このバグはカーネル 2.6.11 で修正されている。
+.SH 例
+以下の部分的なコードは、 セマフォ 0 の値が 0 になるのを待ってから、 セマフォの値を 1 加算する処理を、 \fBsemop\fP()
+を使ってアトミック (atomically) に行う。
 .nf
 
     struct sembuf sops[2];
@@ -926,12 +258,10 @@ Linux 
         exit(EXIT_FAILURE);
     }
 .fi
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR semctl (2),
-.BR semget (2),
-.BR sigaction (2),
-.BR capabilities (7),
-.BR sem_overview (7),
-.BR svipc (7),
-.BR time (7)
+.SH 関連項目
+\fBclone\fP(2), \fBsemctl\fP(2), \fBsemget\fP(2), \fBsigaction\fP(2),
+\fBcapabilities\fP(7), \fBsem_overview\fP(7), \fBsvipc\fP(7), \fBtime\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。