fcntl.2: Edits and additions after review by David Herrmann

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-01-19 09:21:26 +01:00
parent fbab10e5d6
commit 158439352c
1 changed files with 17 additions and 26 deletions

View File

@ -1315,7 +1315,6 @@ For an overview of file sealing, a discussion of its purpose,
and some code examples, see and some code examples, see
.BR memfd_create (2). .BR memfd_create (2).
.\" FIXME I changed "shmem" to "tmpfs" in the next sentence. Okay?
Currently, only the Currently, only the
.I tmpfs .I tmpfs
filesystem supports sealing. filesystem supports sealing.
@ -1325,7 +1324,6 @@ operations that operate on seals will return
.BR EINVAL . .BR EINVAL .
Seals are a property of an inode. Seals are a property of an inode.
.\" FIXME: I reworded the following sentence a little. Please check it.
Thus, all open file descriptors referring to the same inode share Thus, all open file descriptors referring to the same inode share
the same set of seals. the same set of seals.
Furthermore, seals can never be removed, only added. Furthermore, seals can never be removed, only added.
@ -1358,7 +1356,7 @@ If the file does not support sealing, \-1 is returned and
is set to is set to
.BR EINVAL . .BR EINVAL .
.PP .PP
The following set of seals is available so far: The following seals are available:
.TP .TP
.BR F_SEAL_SEAL .BR F_SEAL_SEAL
If this seal is set, any further call to If this seal is set, any further call to
@ -1378,9 +1376,10 @@ This affects
.BR open (2) .BR open (2)
with the with the
.B O_TRUNC .B O_TRUNC
flag and flag as well as
.BR truncate (2)
and
.BR ftruncate (2). .BR ftruncate (2).
.\" FIXME and also truncate(2)?
Those calls will fail with Those calls will fail with
.B EPERM .B EPERM
if you try to shrink the file in question. if you try to shrink the file in question.
@ -1390,34 +1389,27 @@ Increasing the file size is still possible.
If this seal is set, the size of the file in question cannot be increased. If this seal is set, the size of the file in question cannot be increased.
This affects This affects
.BR write (2) .BR write (2)
if you write across size boundaries, beyond the end of the file,
.BR truncate (2),
.BR ftruncate (2), .BR ftruncate (2),
.\" FIXME and also truncate(2)?
and and
.BR fallocate (2). .BR fallocate (2).
These calls will fail with These calls will fail with
.B EPERM .B EPERM
if you use them to increase the file size or write beyond size boundaries. if you use them to increase the file size.
.\" FIXME What does "size boundaries" mean here?
If you keep the size or shrink it, those calls still work as expected. If you keep the size or shrink it, those calls still work as expected.
.TP .TP
.BR F_SEAL_WRITE .BR F_SEAL_WRITE
If this seal is set, you cannot modify the contents of the file. If this seal is set, you cannot modify the contents of the file.
Note that shrinking or growing the size of the file is Note that shrinking or growing the size of the file is
still possible and allowed. still possible and allowed.
.\" FIXME So, just to confirm my understanding of the previous sentence: .\" One or more other seals are typically used with F_SEAL_WRITE
.\" Given a file with the F_SEAL_WRITE seal set, then: .\" because, given a file with the F_SEAL_WRITE seal set, then,
.\" .\" while it would no longer be possinle to (say) write zeros into
.\" * Writing zeros into (say) the last 100 bytes of the file is .\" the last 100 bytes of a file, it would still be possible
.\" NOT be permitted. .\" to (say) shrink the file by 100 bytes using ftruncate(), and
.\" .\" then increase the file size by 100 bytes, which would have
.\" * Shrinking the file by 100 bytes using ftruncate(), and then .\" the effect of replacing the last hundred bytes by zeros.
.\" increasing the file size by 100 bytes, which would have the
.\" effect of replacing the last hundred bytes by zeros, IS
.\" permitted.
.\"
.\"   Either my understanding is incorrect, or the above two cases
.\" seem a little anomalous. Can you comment?
.\" .\"
Thus, this seal is normally used in combination with one of the other seals. Thus, this seal is normally used in combination with one of the other seals.
This seal affects This seal affects
@ -1445,9 +1437,9 @@ will fail with
.B EBUSY .B EBUSY
if any writable, shared mapping exists. if any writable, shared mapping exists.
Such mappings must be unmapped before you can add this seal. Such mappings must be unmapped before you can add this seal.
Furthermore, if there are any asynchronous Furthermore, if there are any asynchronous I/O operations
.\" FIXME Does this mean io_submit(2)? .RB ( io_submit (2))
I/O operations pending on the file, pending on the file,
all outstanding writes will be discarded. all outstanding writes will be discarded.
.SH RETURN VALUE .SH RETURN VALUE
For a successful call, the return value depends on the operation: For a successful call, the return value depends on the operation:
@ -1530,7 +1522,6 @@ NFS), but can sometimes happen locally.
The value specified in The value specified in
.I cmd .I cmd
is not recognized by this kernel. is not recognized by this kernel.
.\" FIXME I added the following error case. Is it correct?
.TP .TP
.B EINVAL .B EINVAL
.I cmd .I cmd