OSDN Git Service

(split) LDP: Update draft and release (from the previous commit)
[linuxjm/LDP_man-pages.git] / draft / man2 / fcntl.2
index ed25ae1..f87bfd2 100644 (file)
@@ -138,12 +138,11 @@ fcntl \- ファイルディスクリプタの操作を行う
 \fIarg\fP は無視される。
 .TP 
 \fBF_SETFL\fP (\fIint\fP)
-Set the file status flags to the value specified by \fIarg\fP.  File access
-mode (\fBO_RDONLY\fP, \fBO_WRONLY\fP, \fBO_RDWR\fP)  and file creation flags (i.e.,
-\fBO_CREAT\fP, \fBO_EXCL\fP, \fBO_NOCTTY\fP, \fBO_TRUNC\fP)  in \fIarg\fP are ignored.  On
-Linux this command can change only the \fBO_APPEND\fP, \fBO_ASYNC\fP, \fBO_DIRECT\fP,
-\fBO_NOATIME\fP, and \fBO_NONBLOCK\fP flags.  It is not possible to change the
-\fBO_DSYNC\fP and \fBO_SYNC\fP flags; see BUGS, below.
+ファイル状態フラグに \fIarg\fP で指定された値を設定する。 \fIarg\fP のうち、ファイルのアクセスモード (\fBO_RDONLY\fP,
+\fBO_WRONLY\fP, \fBO_RDWR\fP)  とファイル作成フラグ (すなわち \fBO_CREAT\fP, \fBO_EXCL\fP,
+\fBO_NOCTTY\fP, \fBO_TRUNC\fP)  に関するビットは無視される。 Linux では、このコマンドで変更できるのは
+\fBO_APPEND\fP, \fBO_ASYNC\fP, \fBO_DIRECT\fP, \fBO_NOATIME\fP, \fBO_NONBLOCK\fP
+フラグだけである。フラグ \fBO_DSYNC\fP, \fBO_SYNC\fP を変更することはできない。下記の「バグ」を参照。
 .SS アドバイザリロック
 \fBF_SETLK\fP, \fBF_SETLKW\fP, \fBF_GETLK\fP は、レコードロックの獲得/解放/テストのために使用する
 (レコードロックはファイルセグメントロックや ファイル領域ロックとも呼ばれる)。 三番目の引き数 \fIlock\fP
@@ -203,15 +202,12 @@ POSIX.1\-2001 では、負の値の \fIl_len\fP をサポートする実装を
 \fBEINTR\fP が設定される; \fBsignal\fP(7)  参照)。
 .TP 
 \fBF_GETLK\fP (\fIstruct flock *\fP)
-On input to this call, \fIlock\fP describes a lock we would like to place on
-the file.  If the lock could be placed, \fBfcntl\fP()  does not actually place
-it, but returns \fBF_UNLCK\fP in the \fIl_type\fP field of \fIlock\fP and leaves the
-other fields of the structure unchanged.  If one or more incompatible locks
-would prevent this lock being placed, then \fBfcntl\fP()  returns details about
-one of these locks in the \fIl_type\fP, \fIl_whence\fP, \fIl_start\fP, and \fIl_len\fP
-fields of \fIlock\fP and sets \fIl_pid\fP to be the PID of the process holding
-that lock.  Note that the information returned by \fBF_GETLK\fP may already be
-out of date by the time the caller inspects it.
+このコールの呼び出し時には、 \fIlock\fP にはそのファイルに適用しようとするロックに関する情報が入っている。 ロックを適用できる場合には、
+\fBfcntl\fP()  は実際にはロックを行わず、構造体 \fIlock\fP の \fIl_type\fP フィールドに \fBF_UNLCK\fP
+を設定し、他のフィールドは変更せずに、復帰する。 違う種別のロックが (一つもしくは複数) 適用されていて ロックを適用できないような場合には、
+\fBfcntl\fP()  は、原因となったロックの一つについての詳細情報を構造体 \fIlock\fP のフィールド \fIl_type\fP,
+\fIl_whence\fP, \fIl_start\fP, \fIl_len\fP に格納し、また \fIl_pid\fP にロックを保持しているプロセスの PID
+を設定して、復帰する。 \fBF_GETLK\fP が返す情報は呼び出し元がその情報を使用するときにはすでに古くなっている可能性がある点に注意すること。
 .P
 読み出しロックを適用するには、 \fIfd\fP は読み出し用にオープンされていなければならない。 書き込みロックを適用するには、 \fIfd\fP
 は書き込み用にオープンされていなければならない。 読み書き両方のロックを適用するには、読み書き両用で ファイルをオープンしなければならない。
@@ -384,13 +380,11 @@ ID が \fIpid\fP で指定された値のプロセスグループにそのシグ
 これらの機構を使用することで、ほとんどの場合で \fBselect\fP(2)  や \fBpoll\fP(2)  を使用せずに完全な非同期 I/O
 を実装することができる。
 .PP
-The use of \fBO_ASYNC\fP is specific to BSD and Linux.  The only use of
-\fBF_GETOWN\fP and \fBF_SETOWN\fP specified in POSIX.1 is in conjunction with the
-use of the \fBSIGURG\fP signal on sockets.  (POSIX does not specify the
-\fBSIGIO\fP signal.)  \fBF_GETOWN_EX\fP, \fBF_SETOWN_EX\fP, \fBF_GETSIG\fP, and
-\fBF_SETSIG\fP are Linux\-specific.  POSIX has asynchronous I/O and the
-\fIaio_sigevent\fP structure to achieve similar things; these are also
-available in Linux as part of the GNU C Library (Glibc).
+\fBO_ASYNC\fP の使用方法は BSD と Linux に特有である。 POSIX.1 で規定されている \fBF_GETOWN\fP と
+\fBF_SETOWN\fP の使用方法は、ソケットに対する \fBSIGURG\fP シグナルとの組み合わせだけである (POSIX は \fBSIGIO\fP
+シグナルは規定していない)。 \fBF_GETOWN_EX\fP, \fBF_SETOWN_EX\fP, \fBF_GETSIG\fP, \fBF_SETSIG\fP は
+Linux 固有である。POSIX には、同様のことを行うために、非同期 I/O と \fIaio_sigevent\fP 構造体がある。Linux
+では、GNU C ライブラリ (Glibc) の一部として これらも利用可能である。
 .SS "リース (leases)"
 (Linix 2.4 以降で利用可能)  \fBF_SETLEASE\fP は、 \fIfd\fP
 が参照するオープンファイル記述に対して新しいリースを設定するのに使用される。 \fBF_GETLEASE\fP は、 \fIfd\fP
@@ -651,9 +645,8 @@ SVr4, 4.3BSD, POSIX.1\-2001.  POSIX.1\-2001 で規定されている操作は、
 .\" FIXME . According to POSIX.1-2001, O_SYNC should also be modifiable
 .\" via fcntl(2), but currently Linux does not permit this
 .\" See http://bugzilla.kernel.org/show_bug.cgi?id=5994
-It is not possible to use \fBF_SETFL\fP to change the state of the \fBO_DSYNC\fP
-and \fBO_SYNC\fP flags.  Attempts to change the state of these flags are
-silently ignored.
+\fBF_SETFL\fP を使って、 フラグ \fBO_DSYNC\fP と \fBO_SYNC\fP
+の状態を変更することはできない。これらのフラグの状態を変更しようとした場合には、黙って無視される。
 .SS F_GETOWN
 .\" glibc source: sysdeps/unix/sysv/linux/i386/sysdep.h
 .\" mtk, Dec 04: some limited testing on alpha and ia64 seems to