mirror of https://github.com/mkerrisk/man-pages
select.2: Linux select() is buggy wrt POSIX in its check for EBADF errors
Reported-by: Matthew Wilcox <willy@infradead.org> Reported-by: Carlos O'Donell <carlos@redhat.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
ad8c02ab2e
commit
8b58a9d467
|
@ -163,7 +163,10 @@ this is useful after
|
|||
returns.
|
||||
.PP
|
||||
.I nfds
|
||||
is the highest-numbered file descriptor in any of the three sets, plus 1.
|
||||
should be set to the highest-numbered file descriptor in any
|
||||
of the three sets, plus 1.
|
||||
The indicated file descriptors in each set are checked, up to this limit
|
||||
(but see BUGS).
|
||||
.PP
|
||||
The
|
||||
.I timeout
|
||||
|
@ -328,6 +331,7 @@ becomes undefined.
|
|||
An invalid file descriptor was given in one of the sets.
|
||||
(Perhaps a file descriptor that was already closed,
|
||||
or one on which an error has occurred.)
|
||||
However, see BUGS.
|
||||
.TP
|
||||
.B EINTR
|
||||
A signal was caught; see
|
||||
|
@ -542,6 +546,18 @@ To monitor file descriptors greater than 1023, use
|
|||
.BR poll (2)
|
||||
instead.
|
||||
|
||||
According to POSIX,
|
||||
.BR select ()
|
||||
should check all specified file descriptors in the three file descriptor sets,
|
||||
up to the limit
|
||||
.IR nfds\-1 .
|
||||
However, the current implementation ignores any file descriptor in
|
||||
these sets that is greater than the maximum file descriptor number
|
||||
that the process currently has open.
|
||||
According to POSIX, any such file descriptor that is specified in one
|
||||
of the sets should result in the error
|
||||
.BR EBADF .
|
||||
|
||||
Glibc 2.0 provided a version of
|
||||
.BR pselect ()
|
||||
that did not take a
|
||||
|
|
Loading…
Reference in New Issue