Main index | Section 3 | Options |
#include <sys/select.h>
The descriptor sets are stored as bit fields in arrays of integers. The following macros are provided for manipulating such descriptor sets: FD_ZERO(&fdset) initializes a descriptor set fdset to the null set. FD_SET(fd, &fdset) includes a particular descriptor fd in fdset. FD_CLR(fd, &fdset) removes fd from fdset. FD_ISSET(fd, &fdset) is non-zero if fd is a member of fdset, zero otherwise. The behavior of these macros is undefined if a descriptor value is less than zero or greater than or equal to FD_SETSIZE, which is normally at least equal to the maximum number of descriptors supported by the system.
If timeout is not a null pointer, it specifies the maximum interval to wait for the selection to complete. System activity can lengthen the interval by an indeterminate amount.
If timeout is a null pointer, the select blocks indefinitely.
To effect a poll, the timeout argument should not be a null pointer, but it should point to a zero-valued timeval structure.
Any of readfds, writefds, and exceptfds may be given as null pointers if no descriptors are of interest.
[EBADF] | |
One of the descriptor sets specified an invalid descriptor. | |
[EFAULT] | |
One of the arguments readfds, ,, writefds, ,, exceptfds, or timeout points to an invalid address. | |
[EINTR] | |
A signal was delivered before the time limit expired and before any of the selected events occurred. | |
[EINVAL] | |
The specified time limit is invalid. One of its components is negative or too large. | |
[EINVAL] | |
The nfds argument was invalid. | |
If nfds is greater than the number of open files, select() is not guaranteed to examine the unused file descriptors. For historical reasons, select() will always examine the first 256 descriptors.
SELECT (2) | June 25, 2020 |
Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | Unix’s “power tools” are more like power switchblades that slice off the operator’s fingers quickly and efficiently. | ” |
— The Unix Haters' handbook |