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 le descriptor; for example:
fd = open(... .);
err = select(fd + 1, ...);
The application can use a xed 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
le descriptors.
Applications composed entirely of old objects that use a xed 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 le descriptors under pre-T9055G12 PVUs or to
4096 le descriptors under T9055G12 or newer PVUs.
Applications composed entirely of new objects that use a xed value for the nfds parameter run
correctly on systems running T9055G12 or newer PVUs. For such applications, select() calls are
restricted to 4096 le descriptors.
Applications composed entirely of new objects that use a xed 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 le denitions.
Specifying arbitrarily large values for the nfds parameter can cause the function to behave
inefciently.
The time limit value specied 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 le descriptor bits in all the le descriptor sets. When an error
occurs, the value -1 is returned, and errno is set to indicate the error.
When the time limit specied 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 le descriptor sets pointed to by the readfds, writefds, and
errorfds parameters remain unmodied.
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 le descriptor specied by its fd parameter is set in
the le descriptor set pointed to by its fdset parameter; otherwise, the FD_ISSET macro returns 0
(zero).
78 Hewlett-Packard Company 527186-005