.\" t
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
.\" and Copyright (C) 1993 Michael Haardt, Ian Jackson;
.\" and Copyright (C) 1998 Jamie Lokier;
.\" and Copyright (C) 2002-2010 Michael Kerrisk.
.\"
+.\" %%%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.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
.\" Modified 1995-09-26 by Andries Brouwer <aeb@cwi.nl>
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
+.\"
+.\" Japanese Version Copyright (c) 1996 Takeshi Ueno
+.\" and Copyright (c) 2005, 2006, 2008 Akihiro MOTOKI
+.\" Translated 1996-07-03, Takeshi Ueno <tueno@vio.co.jp>
+.\" Modified 1998-09-10, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
+.\" Modified 1999-08-14, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
+.\" Updated & Modified 2001-04-03, Yuichi SATO <ysato@h4.dion.ne.jp>
+.\" Updated & Modified 2005-03-15, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
+.\" Updated & Modified 2005-04-22, Akihiro MOTOKI
+.\" Updated & Modified 2005-10-14, Akihiro MOTOKI
+.\" Updated & Modified 2005-11-19, Akihiro MOTOKI, LDP v2.14
+.\" Updated 2006-04-16, Akihiro MOTOKI, LDP v2.29
+.\" Updated 2008-02-11, Akihiro MOTOKI, LDP v2.77
+.\" Updated 2008-09-19, Akihiro MOTOKI, LDP v3.09
+.\" Updated 2010-04-23, Akihiro MOTOKI, LDP v3.24
+.\" Updated 2012-05-08, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-03-26, Akihiro MOTOKI <amotoki@gmail.com>
+.\"
.TH FCNTL 2 2012\-04\-15 Linux "Linux Programmer's Manual"
.SH 名前
fcntl \- ファイルディスクリプタの操作を行う
の場合はファイルの末尾からのオフセットと解釈される。 後ろの2つの場合には、 ファイルの先頭より前にならない範囲で、 \fIl_start\fP
に負の値を指定することができる。
-\fIl_len\fP はロックしたいバイト数を示す。 \fIl_len\fP が正の場合、ロックされるバイト範囲は \fIl_start\fP 以上
-\fIl_start\fP+\fIl_len\fP\-\fI1\fP 以下となる。 \fIl_len\fP に 0 を指定した場合は特別な意味を持つ: \fIl_whence\fP
-and \fIl_start\fP で指定される位置からファイルの末尾までの全てのバイトをロックする
-(ファイルがどんなに大きくなったとしてもファイルの末尾までロックする)。
+\fIl_len\fP specifies the number of bytes to be locked. If \fIl_len\fP is
+positive, then the range to be locked covers bytes \fIl_start\fP up to and
+including \fIl_start\fP+\fIl_len\fP\-1. Specifying 0 for \fIl_len\fP has the special
+meaning: lock all bytes starting at the location specified by \fIl_whence\fP
+and \fIl_start\fP through to the end of file, no matter how large the file
+grows.
POSIX.1\-2001 では、負の値の \fIl_len\fP をサポートする実装を認めている (必須ではない)。 \fIl_len\fP
が負の場合、ロックされるバイト範囲は \fIl_start\fP+\fIl_len\fP 以上 \fIl_start\fP\-1 以下となる。 この動作はカーネル
フラグが有効になっていないときは、ロックが削除されるか、 ロックがアクセスと互換性のあるモードに変換されるまで、 システムコールは停止 (block)
される。 \fBO_NONBLOCK\fP フラグが有効になっているときは、システムコールはエラー \fBEAGAIN\fP で失敗する。
-強制ロックを使用するためには、ロック対象のファイルが含まれるファイルシステム
-と、ロック対象のファイル自身の両方について、強制ロックが有効になっていなけれ ばならない。ファイルシステムについて強制ロックを有効にするには、
-\fBmount\fP(8) に "\-o mand" オプションを渡すか、 \fBmount\fP(2) に \fBMS_MANDLOCK\fP
-フラグを指定する。ファイルについて強制ロックを有効にするには、 そのファイルのグループ実行許可 (group execute permission)
-を無効とし、 かつ set\-group\-ID 許可ビットを有効にする (\fBchmod\fP(1) と \fBchmod\fP(2) を参照)。
+To make use of mandatory locks, mandatory locking must be enabled both on
+the filesystem that contains the file to be locked, and on the file itself.
+Mandatory locking is enabled on a filesystem using the "\-o mand" option to
+\fBmount\fP(8), or the \fBMS_MANDLOCK\fP flag for \fBmount\fP(2). Mandatory locking
+is enabled on a file by disabling group execute permission on the file and
+enabling the set\-group\-ID permission bit (see \fBchmod\fP(1) and \fBchmod\fP(2)).
Linux の強制ロックの実装は信頼性に欠けるものである。 下記の「バグ」の節を参照のこと。
.SS シグナルの管理
解放したりできる。 また、これらのファイルディスクリプタのいずれかに対して \fBF_UNLCK\fP
操作が明示的に実行された場合や、すべてのファイルディスクリプタが 閉じられた場合にも、リースは解放される。
.P
-リースの取得は通常のファイル (regular file) に対してのみ可能である。 非特権プロセスがリースを取得できるのは、UID (所有者)
-がプロセスの ファイルシステム UID と一致するファイルに対してだけである。 \fBCAP_LEASE\fP
-ケーパビリティを持つプロセスは任意のファイルに対してリースを取得できる。
+Leases may be taken out only on regular files. An unprivileged process may
+take out a lease only on a file whose UID (owner) matches the filesystem UID
+of the process. A process with the \fBCAP_LEASE\fP capability may take out
+leases on arbitrary files.
.TP
\fBF_GETLEASE\fP (\fIvoid\fP)
ファイルディスクリプタ \fIfd\fP に対して設定されているリースの種別を取得する。 \fBF_RDLCK\fP, \fBF_WRLCK\fP, \fBF_UNLCK\fP
特に \fBDN_MULTISHOT\fP を使う場合は、通知にはリアルタイムシグナルを使うべきである。
それは、リアルタイムシグナルを使うことで、複数の通知をキューに入れる ことができるからである。
-\fB注意:\fP 新しくアプリケーションを書く際には、(カーネル 2.6.13 以降で利用可能となった) \fIinotify\fP
-インタフェースを使用すべきである。 \fIinotify\fP はファイルシステムイベントの通知を取得するための ずっと優れたインタフェースである。
-\fBinotify\fP(7) を参照。
+\fBNOTE:\fP New applications should use the \fIinotify\fP interface (available
+since kernel 2.6.13), which provides a much superior interface for obtaining
+notifications of filesystem events. See \fBinotify\fP(7).
.SS パイプの容量の変更
.TP
\fBF_SETPIPE_SZ\fP (\fIint\fP; Linux 2.6.35 以降)
.SH 関連項目
\fBdup2\fP(2), \fBflock\fP(2), \fBopen\fP(2), \fBsocket\fP(2), \fBlockf\fP(3),
\fBcapabilities\fP(7), \fBfeature_test_macros\fP(7)
-.P
-カーネルソースの \fIDocumentation/filesystems/\fP ディレクトリ内の \fIlocks.txt\fP,
-\fImandatory\-locking.txt\fP, \fIdnotify.txt\fP も参照のこと。 (以前のカーネルでは、これらのファイルは
+
+Linux カーネルソースの \fIDocumentation/filesystems/\fP ディレクトリ内の \fIlocks.txt\fP,
+\fImandatory\-locking.txt\fP, \fIdnotify.txt\fP (以前のカーネルでは、これらのファイルは
\fIDocumentation/\fP ディレクトリ直下にあり、 \fImandatory\-locking.txt\fP は \fImandatory.txt\fP
-という名前であった。)
+という名前であった)
.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。