From 5766b1963715893beb8f301dee22d0b1e5a740a1 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sat, 16 Jun 2007 10:46:33 +0000 Subject: [PATCH] Noted that timeout can also be changed is select() is interrupted by a signal. --- man2/select.2 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/man2/select.2 b/man2/select.2 index 44448232a..2cccb6934 100644 --- a/man2/select.2 +++ b/man2/select.2 @@ -446,9 +446,21 @@ in which a file descriptor is spuriously reported as ready. .\" returns successfully because of an intervening RST from the client. Thus it may be safer to use O_NONBLOCK on sockets that should not block. .\" Maybe the kernel should have returned EIO in such a situation? -.\" -.\" FIXME select() (and pselect()?) also modify the timeout -.\" on an EINTR error return; POSIX.1-2001 doesn't permit this. + +On Linux, +.BR select () +also modifies +.I timeout +if the call is interrupted by a signal handler (i.e., the +.B EINTR +error return). +This is not permitted by POSIX.1-2001. +The Linux +.BR pselect (2) +system call has the same behavior, +but the glibc wrapper hides this behavior by internally copying the +.I timeout +to a local variable and passing that variable to the system call. .SH EXAMPLE .nf #include