gettimeofday: port recent C++ fix to Emacs
[gnulib.git] / doc / posix-functions / select.texi
1 @node select
2 @section @code{select}
3 @findex select
4
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/select.html}
6
7 Gnulib module: select
8
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 On Windows platforms (excluding Cygwin), @code{select} can only be
13 called on descriptors created by the @code{socket} function, not on regular
14 file descriptors.
15 @item
16 On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
17 placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
18 @item
19 This function fails when the @code{nfds} argument is 0 on some platforms:
20 Interix 3.5.
21 @item
22 On some platforms, this function fails to detect invalid fds with
23 EBADF, but only if they lie beyond the current maximum open fd:
24 FreeBSD 8.2.
25 @end itemize
26
27 Portability problems not fixed by Gnulib:
28 @itemize
29 @item
30 When you call @code{select} with a timeout, some implementations modify the
31 timeout parameter so that upon return from the function, it contains the
32 amount of time not slept.  Other implementations leave the timeout parameter
33 unmodified.
34 @item
35 On BeOS, @code{select} can only be called on descriptors created by the
36 @code{socket} function, not on regular file descriptors.
37 @item
38 Under Windows, when passing a pipe, Gnulib's @code{select} replacement might
39 return 0 even before the timeout has passed.  Programs using it with pipes can
40 thus busy wait.
41 @item
42 On Solaris 2.6 and older, @code{select} applied to a file descriptor opened
43 for reading and associated with @code{/dev/null} hangs, waiting for input,
44 when instead it should return immediately.
45 @item
46 On Linux, when some file descriptor refers to a regular file, @code{select}
47 may fail, setting @code{errno} to @code{EBADF}.
48 @item
49 This function is declared in @code{<unistd.h>}, not @code{<sys/select.h>},
50 on some platforms:
51 IRIX 5.3.
52 @end itemize