select.2: Consolidate the discussion of pselect into a headed subsection

The current text layout is a little hard to parse, with details of
pselect() spread in the main description.  Move some of that text
to a headed subsection, and add a one-sentence introduction
describing the purpose of pselect().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-02-18 08:52:58 +01:00
parent 1eda1a3a5b
commit 01901530b2
1 changed files with 41 additions and 36 deletions

View File

@ -73,9 +73,7 @@ Feature Test Macro Requirements for glibc (see
_POSIX_C_SOURCE\ >=\ 200112L
.SH DESCRIPTION
.BR select ()
and
.BR pselect ()
allow a program to monitor multiple file descriptors,
allows a program to monitor multiple file descriptors,
waiting until one or more of the file descriptors become "ready"
for some class of I/O operation (e.g., input possible).
A file descriptor is considered ready if it is possible to
@ -92,39 +90,6 @@ can monitor only file descriptors numbers that are less than
does not have this limitation.
See BUGS.
.PP
The operation of
.BR select ()
and
.BR pselect ()
is identical, other than these three differences:
.TP
(i)
.BR select ()
uses a timeout that is a
.I struct timeval
(with seconds and microseconds), while
.BR pselect ()
uses a
.I struct timespec
(with seconds and nanoseconds).
.TP
(ii)
.BR select ()
may update the
.I timeout
argument to indicate how much time was left.
.BR pselect ()
does not change this argument.
.TP
(iii)
.BR select ()
has no
.I sigmask
argument, and behaves as
.BR pselect ()
called with NULL
.IR sigmask .
.PP
Three independent sets of file descriptors are watched.
The file descriptors listed in
.I readfds
@ -201,6 +166,46 @@ If
is NULL (no timeout),
.BR select ()
can block indefinitely.
.\"
.SS pselect()
.PP
The
.BR pselect ()
system call allows an application to safely wait until either
a file descriptor becomes ready or until a signal is caught.
.PP
The operation of
.BR select ()
and
.BR pselect ()
is identical, other than these three differences:
.TP
(i)
.BR select ()
uses a timeout that is a
.I struct timeval
(with seconds and microseconds), while
.BR pselect ()
uses a
.I struct timespec
(with seconds and nanoseconds).
.TP
(ii)
.BR select ()
may update the
.I timeout
argument to indicate how much time was left.
.BR pselect ()
does not change this argument.
.TP
(iii)
.BR select ()
has no
.I sigmask
argument, and behaves as
.BR pselect ()
called with NULL
.IR sigmask .
.PP
.I sigmask
is a pointer to a signal mask (see