]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/fcntl.2
locale.1, localedef.1, _exit.2, accept.2, access.2, acct.2, adjtimex.2, bdflush.2...
[thirdparty/man-pages.git] / man2 / fcntl.2
index 963c339fdafb65c259cec7473a06741c69bf0879..675ded768621d423028037a0108cd070dbcb1121 100644 (file)
@@ -62,7 +62,7 @@
 .\" 2014-07-08, David Herrmann <dh.herrmann@gmail.com>
 .\"     Document F_ADD_SEALS and F_GET_SEALS
 .\"
-.TH FCNTL 2 2015-05-07 "Linux" "Linux Programmer's Manual"
+.TH FCNTL 2 2016-03-15 "Linux" "Linux Programmer's Manual"
 .SH NAME
 fcntl \- manipulate file descriptor
 .SH SYNOPSIS
@@ -113,9 +113,9 @@ and make it be a copy of
 .IR fd .
 This is different from
 .BR dup2 (2),
-which uses exactly the descriptor specified.
+which uses exactly the file descriptor specified.
 .IP
-On success, the new descriptor is returned.
+On success, the new file descriptor is returned.
 .IP
 See
 .BR dup (2)
@@ -125,7 +125,7 @@ for further details.
 As for
 .BR F_DUPFD ,
 but additionally set the
-close-on-exec flag for the duplicate descriptor.
+close-on-exec flag for the duplicate file descriptor.
 Specifying this flag permits a program to avoid an additional
 .BR fcntl ()
 .B F_SETFD
@@ -681,9 +681,9 @@ Set the process ID or process group ID that will receive
 .B SIGIO
 and
 .B SIGURG
-signals for events on file descriptor
-.IR fd
-to the ID given in
+signals for events on the file descriptor
+.IR fd .
+The target process or process group ID is specified in
 .IR arg .
 A process ID is specified as a positive value;
 a process group ID is specified as a negative value.
@@ -693,22 +693,23 @@ Most commonly, the calling process specifies itself as the owner
 is specified as
 .BR getpid (2)).
 
-.\" From glibc.info:
-If you set the
-.B O_ASYNC
-status flag on a file descriptor by using the
+As well as setting the file descriptor owner,
+one must also enable generation of signals on the file descriptor.
+This is done by using the
+.BR fcntl ()
 .B F_SETFL
-command of
-.BR fcntl (),
-a
+command to set the
+.B O_ASYNC
+file status flag on the file descriptor.
+Subsequently, a
 .B SIGIO
 signal is sent whenever input or output becomes possible
-on that file descriptor.
+on the file descriptor.
+The
+.BR fcntl ()
 .B F_SETSIG
-can be used to obtain delivery of a signal other than
+command can be used to obtain delivery of a signal other than
 .BR SIGIO .
-If this permission check fails, then the signal is
-silently discarded.
 
 Sending a signal to the owner process (group) specified by
 .B F_SETOWN
@@ -717,6 +718,8 @@ is subject to the same permissions checks as are described for
 where the sending process is the one that employs
 .B F_SETOWN
 (but see BUGS below).
+If this permission check fails, then the signal is
+silently discarded.
 
 If the file descriptor
 .I fd
@@ -937,7 +940,7 @@ set etc.) to determine which file descriptors are available for I/O.
 
 Note that the file descriptor provided in
 .I si_fd
-is the one that that was specified during the
+is the one that was specified during the
 .BR F_SETSIG
 operation.
 This can lead to an unusual corner case.
@@ -1052,8 +1055,8 @@ refer to the same lease, and this lease may be modified
 or released using any of these descriptors.
 Furthermore, the lease is released by either an explicit
 .B F_UNLCK
-operation on any of these duplicate descriptors, or when all
-such descriptors have been closed.
+operation on any of these duplicate file descriptors, or when all
+such file descriptors have been closed.
 .P
 Leases may be taken out only on regular files.
 An unprivileged process may take out a lease only on a file whose
@@ -1159,7 +1162,7 @@ then the handler will receive a
 .I siginfo_t
 structure as its second argument, and the
 .I si_fd
-field of this argument will hold the descriptor of the leased file
+field of this argument will hold the file descriptor of the leased file
 that has been accessed by another process.
 (This is useful if the caller holds leases against multiple files.)
 .SS File and directory change notification (dnotify)
@@ -1425,7 +1428,7 @@ Note that shrinking or growing the size of the file is
 still possible and allowed.
 .\" 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
+.\" while it would no longer be possible 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
@@ -1465,7 +1468,7 @@ all outstanding writes will be discarded.
 For a successful call, the return value depends on the operation:
 .TP 0.9i
 .B F_DUPFD
-The new descriptor.
+The new file descriptor.
 .TP
 .B F_GETFD
 Value of file descriptor flags.
@@ -1477,7 +1480,7 @@ Value of file status flags.
 Type of lease held on file descriptor.
 .TP
 .B F_GETOWN
-Value of descriptor owner.
+Value of file descriptor owner.
 .TP
 .B F_GETSIG
 Value of signal sent when read or write becomes possible, or zero
@@ -1629,7 +1632,8 @@ was not specified as zero.
 .I cmd
 is
 .BR F_DUPFD
-and the process already has the maximum number of file descriptors open.
+and the per-process limit on the number of open file descriptors
+has been reached.
 .TP
 .B ENOLCK
 Too many segment locks open, lock table is full, or a remote locking
@@ -1676,8 +1680,8 @@ and
 .B F_SETOWN
 are specified in POSIX.1-2001.
 (To get their definitions, define either
-.BR _BSD_SOURCE ,
-or
+.\" .BR _BSD_SOURCE ,
+.\" or
 .BR _XOPEN_SOURCE
 with the value 500 or greater, or
 .BR _POSIX_C_SOURCE
@@ -1940,7 +1944,8 @@ It is therefore inadvisable to rely on mandatory locking.
 .BR socket (2),
 .BR lockf (3),
 .BR capabilities (7),
-.BR feature_test_macros (7)
+.BR feature_test_macros (7),
+.BR lslocks (8)
 
 .IR locks.txt ,
 .IR mandatory-locking.txt ,