#include <sys/time.h>
int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout);
...
If the timeout argument is not a null pointer, it points to
an object of type struct timeval that specifies a maximum
interval to wait for the selection to complete. If the
timeout argument points to an object of type struct timeval
whose members are 0, select() does not block. If the timeout
argument is a null pointer, select() blocks until an event
causes one of the masks to be returned with a valid (non-
zero) value. If the time limit expires before any event
occurs that would cause one of the masks to be set to a
non-zero value, select() completes successfully and returns
If the readfs, writefs, and errorfds arguments are all null
pointers and the timeout argument is not a null pointer,
select() blocks for the time specified, or until interrupted
by a signal. If the readfs, writefs, and errorfds arguments
are all null pointers and the timeout argument is a null
pointer, select() blocks until interrupted by a signal.
...