Open System Services System Calls Reference Manual (G06.28+)

System Functions (s and S) select(2)
On return, the select() function replaces the original le descriptor sets with the corresponding
le descriptor sets that have a bit set for each le descriptor representing those objects that are
ready for the requested operation. The total number of ready objects represented by set bits in all
the le descriptor sets is returned by the select() function.
After a le descriptor set is created, it can be modied with these macros:
FD_CLR(fd,&fdset)
Clears the le descriptor bit specied by the fd parameter in the le descriptor
set pointed to by the fdset parameter.
FD_ISSET(fd,&fdset)
Returns a nonzero value when the le descriptor bit specied by the fd parameter
is set in the le descriptor set pointed to by the fdset parameter. Otherwise, the
value 0 (zero) is returned.
FD_SET(fd,&fdset)
Includes the particular le descriptor bit specied by the fd parameter in the le
descriptor set pointed to by the fdset parameter.
FD_ZERO(&fdset)
Initializes the le descriptor set pointed to by the fdset parameter to a null value.
The behavior of these macros is undened when the fd parameter has a value less than 0 (zero) or
greater than or equal to FD_SETSIZE.
Use on Guardian Objects
The select() function can be used on regular les (disk les) or EDIT les in /G. Such les are
always ready for selection.
The select() function can be used on an OSS terminal (Telserv or OSSTTY). The select() func-
tion cannot be used on any other type of Guardian object.
If select() is called using a le descriptor for a version of the Telserv process or OSSTTY pro-
cess that does not support select(), the call fails, and errno is set to the value of [ENOTSUP].
Use From the Guardian Environment
The select() function is one of a set of functions that have these effects when the rst of them is
called from the Guardian environment:
Two Guardian le system le numbers (not necessarily the next two available) are allo-
cated for the root directory and the current working directory. These le numbers cannot
be closed by calling the Guardian FILE_CLOSE_ procedure.
The current working directory is assigned from the VOLUME attribute of the Guardian
environment =_DEFAULTS DEFINE.
The use of static memory by the process increases slightly.
These effects occur only when the rst of the set of functions is called. The effects are not cumu-
lative.
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 le was increased from 1024 to 4096. Object modules which were compiled
using pre-T8645G08-AAO header les use the smaller 1024 FD_SETSIZE and are termed "old
objects". Object modules which were compiled using T8645G08 AAO header les 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:
527186-005 Hewlett-Packard Company 77