Open System Services System Calls Reference Manual (G06.25+, H06.03+)
select(2) OSS System Calls Reference Manual
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 pipe, or a FIFO.
There is a file descriptor set for reading, for writing, and for pending exceptions. These file
descriptor sets are pointed to by the readfds, writefds, and errorfds parameters, respectively.
When the select() function is called, it checks the file descriptor sets in the range 0 through
nfds-1. If there is reading, writing, or an 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 signals 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), signal 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:
— ready for reading
— ready for writing
— has an exception pending
When these conditions exist, a corresponding bit position is set in the returned file
descriptor set pointed to by the readfds, writefds, and errorfds parameters.
On return, the select() function replaces the original file descriptor sets with the corresponding
file descriptor sets that have a bit set for each file descriptor representing those objects that are
ready for the requested operation. The total number of ready objects represented by set bits in all
the file descriptor sets is returned by the select() function.
7−6 Hewlett-Packard Company 527186-003