Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (s and S) select(2)
errorfds Points to a file descriptor set consisting of file descriptors for objects opened for
reading or writing. When the function is called, this file descriptor set specifies
file descriptors to be checked for having exception conditions pending. Upon
return from a successful call, this file descriptor set specifies file descriptors that
have exception conditions pending.
timeout Points to a type timeval structure that specifies the time to wait for a response
from a call to the select() function. When the timeout parameter is not a null
pointer, the maximum time interval to wait for the select() function to finish is
specified by values stored in space reserved by the type timeval structure
pointed to by the timeout parameter. A timeout value of 0 (zero) is treated as "do
not wait". A timeout value of less than 10 milliseconds is rounded up so that the
timeout value used is at least 10 milliseconds. A timeout value more than 10
milliseconds is rounded down to the nearest multiple of 10 milliseconds.
The object pointed to by the timeout parameter can be modified after successful
completion of the call.
fd Specifies a file descriptor.
fdset Points to a file descriptor set.
DESCRIPTION
The select() function checks the status of objects identified by bit masks called file descriptor
sets.
Each file descriptor set consists of an array of bits whose relative position and state represent a
file descriptor and the true or false status for the condition of its corresponding object. An object
is an open file descriptor for an OSS directory (that is, a directory that is not in /G or /E), a
socket, a regular file, a terminal device file, a pipe, or a FIFO.
There is a file descriptor set for reading, for writing, and for pending exceptions. The readfds,
writefds, and errorfds parameters point to these file descriptor sets.
When the select() function is called, it checks the file descriptor sets in the range 0 through
nfds-1. If any file descriptors are ready for reading or writing, or have a pending exception, the
select() function returns a modified file descriptor set.
If no condition is true for any specified file descriptor in any specified file descriptor set, the
select() function blocks until one of these conditions occurs:
• A specified condition is true for one of the specified descriptors in one of the specified
sets.
• The interval specified by the timeout parameter elapses. If the timeout parameter points
to a structure whose members have the value 0 (zero), process blocking does not occur.
A modified file descriptor set has these characteristics:
• It is a selected file descriptor set pointed to by the readfds, writefds, and errorfds param-
eters.
• When the function was called, the file descriptor set had at least one bit set that
corresponded to an active file descriptor.
• The object represented by the set bit is any of these:
527186-023 Hewlett-Packard Company 7−9