fcntl.2: Rework description of F_SETOWN

As suggested by Jason, make it clearer that I/O signalling
requires the use of both F_SETOWN and O_ASYNC. While we're at,
make a few other cleanups to the text.

Reported-by: Jason Vas Dias <jason.vas.dias@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-03-11 07:49:11 +01:00
parent 501934a934
commit 7255c7c0df
1 changed files with 17 additions and 14 deletions

View File

@ -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