Open System Services System Calls Reference Manual (G06.28+)
select(2) OSS System Calls Reference Manual
• The application can use a variable value for the nfds parameter that is based on the
highest numbered file descriptor; for example:
fd = open(... .);
err = select(fd + 1, ...);
• The application can use a fixed value for the nfds parameter that is based on the value of
the FD_SETSIZE literal at the time of compilation; for example:
err = select(FD_SETSIZE,
...);
Applications composed entirely of old objects that use a variable value for the nfds parameter run
correctly on systems running pre-T9055G12 PVUs and run correctly on systems running
T9055G12 or a more recent PVU. For such applications,
select() calls are restricted to 1024
file descriptors.
Applications composed entirely of old objects that use a fixed value for the nfds parameter run
correctly on systems running pre-T9055G12 or T9055G12 or newer PVUs. For such applica-
tions, select() calls are restricted to 1024 file descriptors.
Applications composed entirely of new objects that use a variable value for the nfds parameter
run correctly on systems running pre-T9055G12 PVUs or T9055G12 or newer PVUs. For such
applications, select() calls are restricted to 1024 file descriptors under pre-T9055G12 PVUs or to
4096 file descriptors under T9055G12 or newer PVUs.
Applications composed entirely of new objects that use a fixed value for the nfds parameter run
correctly on systems running T9055G12 or newer PVUs. For such applications, select() calls are
restricted to 4096 file descriptors.
Applications composed entirely of new objects that use a fixed value for the nfds parameter are
unsafe on systems running pre-T9055G12 PVUs.
Applications which mix old objects and new objects are unsafe on any system. All object
modules of an application must be compiled using a consistent set of header file definitions.
Specifying arbitrarily large values for the nfds parameter can cause the function to behave
inefficiently.
The time limit value specified by the timeout parameter has no effect on the operation of the
alarm() or settimer() function.
RETURN VALUES
Upon successful completion, the select() function returns the number of ready objects
represented by corresponding file descriptor bits in all the file descriptor sets. When an error
occurs, the value -1 is returned, and errno is set to indicate the error.
When the time limit specified by the timeout parameter expires, the select() function returns the
value 0 (zero), and all bits in the objects pointed to by the readfds, writefds, and errorfds parame-
ters are also set to 0 (zero).
When select() returns an error, the file descriptor sets pointed to by the readfds, writefds, and
errorfds parameters remain unmodified.
The FD_CLR, FD_SET, and FD_ZERO macros do not return values. The FD_ISSET macro
returns a nonzero value when the bit for the file descriptor specified by its fd parameter is set in
the file descriptor set pointed to by its fdset parameter; otherwise, the FD_ISSET macro returns 0
(zero).
7−8 Hewlett-Packard Company 527186-005