Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (s and S) select(2)
• The use of static memory by the process increases slightly.
These effects occur only when the first of the set of functions is called. The effects are not cumu-
lative.
Use From a Threaded Application
The thread-aware select() function can be used to check the status of multiple file descriptors.
To check the status of a single file descriptor, use the _PUT_SELECT_SINGLE_ feature test
macro, which uses another thread-aware version of the select() function and provides better per-
formance. To use _PUT_SELECT_SINGLE_, you must include the pthread.h header file in
the application and link the application to the zputdll library (/G/system/zdllnnn/zputdll).
NOTES
Beginning with the release of product version T9055G12 and product version update (PVU)
T8645G08 AAO, FD_SETSIZE was increased. In T8645G08 AAO, the FD_SETSIZE literal
in the sys/time.h file was increased from 1024 to 4096. Object modules that were compiled using
pre-T8645G08-AAO header files use the smaller 1024 FD_SETSIZE and are termed old objects.
Object modules that were compiled using T8645G08 AAO header files use the bigger 4096
FD_SETSIZE and are termed new objects. The way an application behaves for old or new
objects depends on the way in which it calls the select() function:
• 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 that mix old objects and new objects are unsafe on any system. You must compile
all object modules of an application 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.
527186-023 Hewlett-Packard Company 7−11