X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=draft%2Fman2%2Ffcntl.2;fp=draft%2Fman2%2Ffcntl.2;h=8a557016f314ff7af43e7906f914448ce2260882;hb=898c3329e032dd492adb9ff4949129997cd7849b;hp=b85139539e4582344b0f62bc3f44723316dafa49;hpb=48e5bc8158018a8bea7cedb7c4bb6299a869b140;p=linuxjm%2FLDP_man-pages.git diff --git a/draft/man2/fcntl.2 b/draft/man2/fcntl.2 index b8513953..8a557016 100644 --- a/draft/man2/fcntl.2 +++ b/draft/man2/fcntl.2 @@ -4,6 +4,7 @@ .\" and Copyright (C) 1998 Jamie Lokier; .\" and Copyright (C) 2002-2010, 2014 Michael Kerrisk; .\" and Copyright (C) 2014 Jeff Layton +.\" and Copyright (C) 2014 David Herrmann .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this @@ -58,6 +59,8 @@ .\" Document F_SETOWN_EX and F_GETOWN_EX .\" 2010-06-17, Michael Kerrisk .\" Document F_SETPIPE_SZ and F_GETPIPE_SZ. +.\" 2014-07-08, David Herrmann +.\" Document F_ADD_SEALS and F_GET_SEALS .\" .\"******************************************************************* .\" @@ -629,7 +632,83 @@ lease holder への通知に使われるデフォルトのシグナルは \fBSIG サイズよりも小さくしようとした場合は、エラー \fBEBUSY\fP が発生する。 .TP \fBF_GETPIPE_SZ\fP (\fIvoid\fP; Linux 2.6.35 以降) +.\" \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). + +Currently, only the \fItmpfs\fP filesystem supports sealing. On other +filesystems, all \fBfcntl\fP(2) operations that operate on seals will return +\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. +.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. +.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. +.PP +The following seals are available: +.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. +.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. +.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. +.TP +\fBF_SEAL_WRITE\fP +.\" One or more other seals are typically used with F_SEAL_WRITE +.\" because, given a file with the F_SEAL_WRITE seal set, then, +.\" while it would no longer be possinle to (say) write zeros into +.\" the last 100 bytes of a file, it would still be possible +.\" to (say) shrink the file by 100 bytes using ftruncate(), and +.\" 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. .SH 返り値 成功した場合の返り値は操作の種類により違う: .TP 0.9i @@ -654,6 +733,10 @@ lease holder への通知に使われるデフォルトのシグナルは \fBSIG \fBF_GETPIPE_SZ\fP, \fBF_SETPIPE_SZ\fP パイプの容量。 .TP +\fBF_GET_SEALS\fP +A bit mask identifying the seals that have been set for the inode referred +to by \fIfd\fP. +.TP 他の全てのコマンド 0 を返す。 .PP @@ -667,8 +750,20 @@ lease holder への通知に使われるデフォルトのシグナルは \fBSIG そのファイルは他のプロセスによってメモリマップされているため、 操作が禁止されている。 .TP \fBEBADF\fP -\fIfd\fP がオープンされたファイルディスクリプタでない。 あるいはコマンドが \fBF_SETLK\fP または \fBF_SETLKW\fP -だったが、対象のファイルディスクリプタのオープンモードが 必要となるロックの型にマッチしていない。 +\fIfd\fP がオープンされたファイルディスクリプタではない。 +.TP +\fBEBADF\fP +\fIcmd\fP が \fBF_SETLK\fP または \fBF_SETLKW\fP だったが、対象のファイルディスクリプタのオープンモードが +必要となるロックの型にマッチしていない。 +.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. +.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. .TP \fBEDEADLK\fP 指定された \fBF_SETLKW\fP コマンドを実行した場合にはデッドロックになることが検出された。 @@ -677,7 +772,12 @@ lease holder への通知に使われるデフォルトのシグナルは \fBSIG \fIlock\fP が利用可能なアドレス空間の外部にある。 .TP \fBEINTR\fP -\fBF_SETLKW\fP コマンドがシグナルにより割り込まれた (\fBsignal\fP(7) 参照)。 \fBF_GETLK\fP と \fBF_SETLK\fP +\fIcmd\fP が \fBF_SETLKW\fP か \fBF_OFD_SETLKW\fP で、 操作がシグナルにより割り込まれた。 \fBsignal\fP(7) +参照。 +.TP +\fBEINTR\fP +\fIcmd\fP が \fBF_GETLK\fP, \fBF_SETLK\fP, \fBF_OFD_GETLK\fP, \fBF_OFD_SETLK\fP で、 +操作がシグナルにより割り込まれた (\fBsignal\fP(7) 参照)。 \fBF_GETLK\fP と \fBF_SETLK\fP の場合、ロックを確認したり取得したりする前にシグナルによって割り込まれた。 これはたいていリモートのファイルをロックする場合 (例えば NFS 上でロックする場合) に起こる。 しかしローカルでも起こる場合がある。 .TP @@ -685,15 +785,25 @@ lease holder への通知に使われるデフォルトのシグナルは \fBSIG カーネルが認識しない値が \fIcmd\fP で指定された。 .TP \fBEINVAL\fP -\fBF_DUPFD\fPで、 \fIarg\fP が負か、もしくは許される最大値よりも大きい。 \fBF_SETSIG\fP の場合、 \fIarg\fP -が利用可能なシグナル番号ではない。 +\fIcmd\fP is \fBF_ADD_SEALS\fP and \fIarg\fP includes an unrecognized sealing bit. +.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. +.TP +\fBEINVAL\fP +\fIcmd\fP が \fBF_DUPFD\fP で、 \fIarg\fP が負か、もしくは許される最大値よりも大きい (\fBgetrlimit\fP(2) の +\fBRLIMIT_NOFILE\fP の議論を参照)。 +.TP +\fBEINVAL\fP +\fIcmd\fP が \fBF_SETSIG\fP で、 \fIarg\fP が許可されたシグナル番号ではない。 .TP \fBEINVAL\fP \fIcmd\fP が \fBF_OFD_SETLK\fP, \fBF_OFD_SETLKW\fP, \fBF_OFD_GETLK\fP のいずれかで、 \fIl_pid\fP に 0 が指定されなかった。 .TP \fBEMFILE\fP -\fBF_DUPFD\fPで、 プロセスがすでに最大数までファイルディスクリプタをオープンしている。 +\fIcmd\fP が \fBF_DUPFD\fPで、 プロセスがすでに最大数までファイルディスクリプタをオープンしている。 .TP \fBENOLCK\fP オープンされているロックの数が多過ぎて、ロックテーブルがいっぱいである。 または remote locking protocol (例えば NFS @@ -704,6 +814,10 @@ lease holder への通知に使われるデフォルトのシグナルは \fBSIG .TP \fBEPERM\fP 追加専用属性が設定されたファイルの \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. .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, @@ -727,6 +841,9 @@ SVr4, 4.3BSD, POSIX.1\-2001. POSIX.1\-2001 で規定されている操作は、 \fBF_OFD_SETLK\fP, \fBF_OFD_SETLKW\fP, \fBF_OFD_GETLK\fP は Linux 固有だが (これらの定義を得るには \fB_GNU_SOURCE\fP を定義しなければならない)、 POSIX.1 の次のバージョンに含めようという活動が進められている。 + +.\" FIXME . Once glibc adds support, add a note about FTM requirements +\fBF_ADD_SEALS\fP と \fBF_GET_SEALS\fP は Linux 固有である。 .SH 注意 .\" エラーの際の返り値が \fBdup2\fP(2) と \fBF_DUPFD\fP では異なっている。 @@ -845,7 +962,3 @@ Linux カーネルソースの \fIDocumentation/filesystems/\fP ディレクト \fImandatory\-locking.txt\fP, \fIdnotify.txt\fP (以前のカーネルでは、これらのファイルは \fIDocumentation/\fP ディレクトリ直下にあり、 \fImandatory\-locking.txt\fP は \fImandatory.txt\fP という名前であった) -.SH この文書について -この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.77 の一部 -である。プロジェクトの説明とバグ報告に関する情報は -http://www.kernel.org/doc/man\-pages/ に書かれている。