SELECT(3N) — Silicon Graphics
NAME
select − synchronous I/O multiplexing
SYNOPSIS
#include <time.h>
nfound = select(nfds, readfds, writefds, timeout)
int nfound, nfds, *readfds, *writefds;
time_t *timeout;
DESCRIPTION
Select examines the I/O descriptors in bits 0 through nfds-1 in the readfds and writefds masks. It checks if the descriptors are ready for reading or writing. Mask bit “<<f” represents the file descriptor f.
Select returns a mask and count (nfound) of the ready descriptors.
If timeout is a non-zero pointer, it specifies the maimum interval to wait for the selection to complete. If timeout is a zero pointer, select blocks indefinitely. To affect a poll, the timeout argument should be non-zero, and point to a zero valued timeval structure.
readfds and/or writefds may be specified as 0 if no descriptors are of interest.
RETURN VALUE
Select returns the number of descriptors which are contained in the bit masks, or −1 if an error occurred. If the time limit epires then select returns 0.
ERRORS
[EBADF] An invalid descriptor was specified.
[EINTR] A signal was delivered before any selected events occurred, or the time limit epired.
SEE ALSO
accept(3N), connect(3N), read(2), write(2), recv(2), send(3N)
BUGS
The descriptor masks are always modified on return, even if the call returns as the result of the timeout.
Select works only on socket-file descriptors.
Version 2.3 — July 04, 1985