.\" Updated 2012-05-08, Akihiro MOTOKI <amotoki@gmail.com>
.\" Updated 2013-03-26, Akihiro MOTOKI <amotoki@gmail.com>
.\"
-.TH FCNTL 2 2014\-09\-06 Linux "Linux Programmer's Manual"
+.TH FCNTL 2 2015\-01\-22 Linux "Linux Programmer's Manual"
.SH 名前
fcntl \- ファイルディスクリプタの操作を行う
.SH 書式
.\"
\fIfd\fP が参照するパイプの容量を (関数の結果として) 返す。
.SS "File Sealing"
-File seals limit the set of allowed operations on a given file. For each
-seal that is set on a file, a specific set of operations will fail with
-\fBEPERM\fP on this file from now on. The file is said to be sealed. The
-default set of seals depends on the type of the underlying file and
-filesystem. For an overview of file sealing, a discussion of its purpose,
-and some code examples, see \fBmemfd_create\fP(2).
+file seal は指定されたファイルで許可される操作の集合を制限する。 ファイルに設定される seal 毎に対応する操作の集合が規定されており、
+それ以降のそのファイルに対する対応する操作は \fBEPERM\fP で失敗する。 このようなファイルは sealed (seal が適用されている)
+と呼ばれる。 デフォルトの seal の集合は、適用されるファイルやファイルシステムに依存する。 file seal の概要、 その目的、
+サンプルコードについては \fBmemfd_create\fP(2) を参照。
-Currently, only the \fItmpfs\fP filesystem supports sealing. On other
-filesystems, all \fBfcntl\fP(2) operations that operate on seals will return
-\fBEINVAL\fP.
+現在のところ \fItmpfs\fP ファイルシステムだけが sealing をサポートしている。 他のファイルシステムでは、 seal に関連する
+\fBfcntl\fP(2) の操作はすべて \fBEINVAL\fP を返す。
-Seals are a property of an inode. Thus, all open file descriptors referring
-to the same inode share the same set of seals. Furthermore, seals can never
-be removed, only added.
+seal は inode の属性である。 したがって、 同じ inode を参照するすべてのオープンされたファイルディスクリプターは、 同じ seal
+の集合を共有する。 さらに、 seal は削除することはできず、 追加のみ可能である。
.TP
\fBF_ADD_SEALS\fP (\fIint\fP; Linux 3.17 以降)
-Add the seals given in the bit\-mask argument \fIarg\fP to the set of seals of
-the inode referred to by the file descriptor \fIfd\fP. Seals cannot be removed
-again. Once this call succeeds, the seals are enforced by the kernel
-immediately. If the current set of seals includes \fBF_SEAL_SEAL\fP (see
-below), then this call will be rejected with \fBEPERM\fP. Adding a seal that
-is already set is a no\-op, in case \fBF_SEAL_SEAL\fP is not set already. In
-order to place a seal, the file descriptor \fIfd\fP must be writable.
+ビットマスク引き数 \fIarg\fP で指定された seal を、 ファイルディスクリプター \fIfd\fP が参照する inode の seal
+の集合に追加する。 一度追加した seal を削除することはできない。 この呼び出しが成功すると、 seal はただちにカーネルにより適用される。
+現在の seal の集合に \fBF_SEAL_SEAL\fP (下記参照) が含まれている場合、 この呼び出しは \fBEPERM\fP で拒否される。
+すでに設定されている seal を追加した場合、 \fBF_SEAL_SEAL\fP がまだ設定されていない場合は no\-op (何もしない) となる。
+seal を設定するには、 ファイルディスクリプター \fIfd\fP が書き込み可能でなければならない。
.TP
\fBF_GET_SEALS\fP (\fIvoid\fP; Linux 3.17 以降)
-Return (as the function result) the current set of seals of the inode
-referred to by \fIfd\fP. If no seals are set, 0 is returned. If the file does
-not support sealing, \-1 is returned and \fIerrno\fP is set to \fBEINVAL\fP.
+(関数の結果として) \fIfd\fP が参照する inode の seal の現在の集合を返す。 seal が何も設定されていない場合、 0 が返される。
+ファイルが sealing をサポートしていない場合、 \-1 が返され、 \fIerrno\fP に \fBEINVAL\fP が設定される。
.PP
-The following seals are available:
+以下の seal が利用できる。
.TP
\fBF_SEAL_SEAL\fP
-If this seal is set, any further call to \fBfcntl\fP(2) with \fBF_ADD_SEALS\fP
-will fail with \fBEPERM\fP. Therefore, this seal prevents any modifications to
-the set of seals itself. If the initial set of seals of a file includes
-\fBF_SEAL_SEAL\fP, then this effectively causes the set of seals to be constant
-and locked.
+この seal が設定されると、 これ以降の \fBF_ADD_SEALS\fP を指定した \fBfcntl\fP(2) の呼び出しはすべて \fBEPERM\fP
+で失敗する。 したがって、 この seal を設定すると seal の集合自身の変更を防止できる。 ファイルの最初の seal の集合に
+\fBF_SEAL_SEAL\fP が含まれていた場合、 結果的に seal の集合が定数になりロックされることになる。
.TP
\fBF_SEAL_SHRINK\fP
-If this seal is set, the file in question cannot be reduced in size. This
-affects \fBopen\fP(2) with the \fBO_TRUNC\fP flag as well as \fBtruncate\fP(2) and
-\fBftruncate\fP(2). Those calls will fail with \fBEPERM\fP if you try to shrink
-the file in question. Increasing the file size is still possible.
+この seal が設定されると、 設定されたファイルのサイズを小さくできなくなる。 この seal は \fBopen\fP(2) の \fBO_TRUNC\fP
+フラグに影響する。 \fBtruncate\fP(2) と \fBftruncate\fP(2) についても同様である。
+対象のファイルのサイズを小さくしようとした場合、 これらの呼び出しは \fBEPERM\fP で失敗する。
+ファイルサイズを増やすことはこの場合でも可能である。
.TP
\fBF_SEAL_GROW\fP
-If this seal is set, the size of the file in question cannot be increased.
-This affects \fBwrite\fP(2) beyond the end of the file, \fBtruncate\fP(2),
-\fBftruncate\fP(2), and \fBfallocate\fP(2). These calls will fail with \fBEPERM\fP
-if you use them to increase the file size. If you keep the size or shrink
-it, those calls still work as expected.
+この seal が設定されると、 設定されたファイルのサイズを増やせなくなる。 この seal はファイルの末尾を超えての \fBwrite\fP(2) や
+\fBtruncate\fP(2), \fBftruncate\fP(2), \fBfallocate\fP(2) に影響する。
+対象のファイルのサイズを大きくしようとした場合、 これらの呼び出しは \fBEPERM\fP で失敗する。 ファイルサイズが変わらない場合、
+小さくなる場合は、 これらの呼び出しはそのまま動作する。
.TP
\fBF_SEAL_WRITE\fP
.\" One or more other seals are typically used with F_SEAL_WRITE
.\" then increase the file size by 100 bytes, which would have
.\" the effect of replacing the last hundred bytes by zeros.
.\"
-If this seal is set, you cannot modify the contents of the file. Note that
-shrinking or growing the size of the file is still possible and allowed.
-Thus, this seal is normally used in combination with one of the other
-seals. This seal affects \fBwrite\fP(2) and \fBfallocate\fP(2) (only in
-combination with the \fBFALLOC_FL_PUNCH_HOLE\fP flag). Those calls will fail
-with \fBEPERM\fP if this seal is set. Furthermore, trying to create new
-shared, writable memory\-mappings via \fBmmap\fP(2) will also fail with
-\fBEPERM\fP.
-
-Setting \fBF_SEAL_WRITE\fP via \fBfcntl\fP(2) with \fBF_ADD_SEALS\fP will fail with
-\fBEBUSY\fP if any writable, shared mapping exists. Such mappings must be
-unmapped before you can add this seal. Furthermore, if there are any
-asynchronous I/O operations (\fBio_submit\fP(2)) pending on the file, all
-outstanding writes will be discarded.
+この seal が設定されていると、 ファイルの内容を変更できない。 ファイルのサイズを縮小したり伸張したりすることは可能で許可されている。
+したがって、 この seal は通常は他の seal のいずれかと組み合わせて使用される。 この seal は \fBwrite\fP(2) と
+\fBfallocate\fP(2) (\fBFALLOC_FL_PUNCH_HOLE\fP フラグとの組み合わせの場合のみ) に影響する。 この seal
+が設定されると、 これらの呼び出しは \fBEPERM\fP で失敗する。 また、 \fBmmap\fP(2)
+による新しい書き込み可能な共有メモリマッピングの作成も \fBEPERM\fP で失敗する。
+
+\fBfcntl\fP(2) の \fBF_ADD_SEALS\fP で \fBF_SEAL_WRITE\fP を設定しようとした場合、
+書き込み可能な共有マッピングが存在すると \fBEBUSY\fP で失敗する。 このようなマッピングは、 この seal
+を追加する前にアンマップしなければならない。 また、 ファイルに対して処理待ちの非同期 I/O 操作 (\fBio_submit\fP(2) がある場合、
+処理されていない書き込みは破棄される。
.SH 返り値
成功した場合の返り値は操作の種類により違う:
.TP 0.9i
パイプの容量。
.TP
\fBF_GET_SEALS\fP
-A bit mask identifying the seals that have been set for the inode referred
-to by \fIfd\fP.
+\fIfd\fP が参照する inode に設定されている seal を示すビットマスク。
.TP
他の全てのコマンド
0 を返す。
必要となるロックの型にマッチしていない。
.TP
\fBEBUSY\fP
-\fIcmd\fP is \fBF_SETPIPE_SZ\fP and the new pipe capacity specified in \fIarg\fP is
-smaller than the amount of buffer space currently used to store data in the
-pipe.
+\fIcmd\fP が \fBF_SETPIPE_SZ\fP で、 \fIarg\fP で指定されたパイプの新しい容量がパイプが、
+現在パイプにあるデータを格納するのに使用されているバッファ容量よりも小さい。
.TP
\fBEBUSY\fP
-\fIcmd\fP is \fBF_ADD_SEALS\fP, \fIarg\fP includes \fBF_SEAL_WRITE\fP, and there exists
-a writable, shared mapping on the file referred to by \fIfd\fP.
+\fIcmd\fP が \fBF_ADD_SEALS\fP で、 \fIarg\fP に \fBF_SEAL_WRITE\fP が含まれており、 \fIfd\fP
+が参照するファイルに対する書き込み可能な共有マッピングが存在する。
.TP
\fBEDEADLK\fP
指定された \fBF_SETLKW\fP コマンドを実行した場合にはデッドロックになることが検出された。
カーネルが認識しない値が \fIcmd\fP で指定された。
.TP
\fBEINVAL\fP
-\fIcmd\fP is \fBF_ADD_SEALS\fP and \fIarg\fP includes an unrecognized sealing bit.
+\fIcmd\fP が \fBF_ADD_SEALS\fP で、 \fIarg\fP に認識できない seal を示すビットが含まれている。
.TP
\fBEINVAL\fP
-\fIcmd\fP is \fBF_ADD_SEALS\fP or \fBF_GET_SEALS\fP and the filesystem containing the
-inode referred to by \fIfd\fP does not support sealing.
+\fIcmd\fP が \fBF_ADD_SEALS\fP か \fBF_GET_SEALS\fP で、 \fIfd\fP が参照している inode
+が格納されているファイルシステムが sealing をサポートしていない。
.TP
\fBEINVAL\fP
\fIcmd\fP が \fBF_DUPFD\fP で、 \fIarg\fP が負か、もしくは許される最大値よりも大きい (\fBgetrlimit\fP(2) の
追加専用属性が設定されたファイルの \fBO_APPEND\fP フラグをクリアしようと試みた。
.TP
\fBEPERM\fP
-\fIcmd\fP was \fBF_ADD_SEALS\fP, but \fIfd\fP was not open for writing or the current
-set of seals on the file already includes \fBF_SEAL_SEAL\fP.
+\fIcmd\fP が \fBF_ADD_SEALS\fP だが、 \fIfd\fP が書き込み用にオープンされていないか、 ファイルの現在の seal の集合にすでに
+\fBF_SEAL_SEAL\fP が含まれている。
.SH 準拠
SVr4, 4.3BSD, POSIX.1\-2001. POSIX.1\-2001 で規定されている操作は、
\fBF_DUPFD\fP, \fBF_GETFD\fP, \fBF_SETFD\fP, \fBF_GETFL\fP, \fBF_SETFL\fP,
\fImandatory\-locking.txt\fP, \fIdnotify.txt\fP (以前のカーネルでは、これらのファイルは
\fIDocumentation/\fP ディレクトリ直下にあり、 \fImandatory\-locking.txt\fP は \fImandatory.txt\fP
という名前であった)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.78 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。