The functions select and pselect wait for a number of file descriptors to change status.
Their function is identical, with three differences:
The select function uses a timeout that is a struct timeval (with seconds and microseconds), while pselect uses a struct timespec (with seconds and nanoseconds).
The select function may update the timeout parameter to indicate how much time was left. The pselect function does not change this parameter.
The select function has no sigmask parameter, and behaves as pselect called with NULL sigmask.
Three independent sets of descriptors are watched. Those listed in readfds will be watched to see if characters become available for reading (more precisely, to see if a read will not block - in particular, a file descriptor is also ready on end-of-file), those in writefds will be watched to see if a write will not block, and those in exceptfds will be watched for exceptions. On exit, the sets are modified in place to indicate which descriptors actually changed status.
Four macros are provided to manipulate the sets. FD_ZERO will clear a set. FD_SET and FD_CLR add or remove a given descriptor from a set. FD_ISSET tests to see if a descriptor is part of the set; this is useful after select returns.
n is the highest-numbered descriptor in any of the three sets, plus 1.
timeout is an upper bound on the amount of time elapsed before select returns. It may be zero, causing select to return immediately. (This is useful for polling.) If timeout is NULL (no timeout), select can block indefinitely.
sigmask is a pointer to a signal mask (see sigprocmask(2)); if it is not NULL, then pselect first replaces the current signal mask by the one pointed to by sigmask, then does the `select' function, and then restores the original signal mask again.
An invalid file descriptor was given in one of the sets.
A non blocked signal was caught.
n is negative.
Some code calls select with all three sets empty, n zero, and a non-null timeout as a fairly portable way to sleep with subsecond precision.
4.4BSD (the select function first appeared in 4.2BSD). Generally portable to/from non-BSD systems supporting clones of the BSD socket layer (including System V variants). However, note that the System V variant typically sets the timeout variable before exit, but the BSD variant does not.
lib/main.php:944: Notice: PageInfo: Cannot find action page