Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (s and S) select(2)
After a file descriptor set is created, it can be modified with these macros:
FD_CLR(fd,&fdset)
Clears the file descriptor bit specified by the fd parameter in the file descriptor
set pointed to by the fdset parameter.
FD_ISSET(fd,&fdset)
Returns a nonzero value when the file descriptor bit specified by the fd parameter
is set in the file descriptor set pointed to by the fdset parameter. Otherwise, the
value 0 (zero) is returned.
FD_SET(fd,&fdset)
Includes the particular file descriptor bit specified by the fd parameter in the file
descriptor set pointed to by the fdset parameter.
FD_ZERO(&fdset)
Initializes the file descriptor set pointed to by the fdset parameter to a null value.
The behavior of these macros is undefined 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 files (disk files) or EDIT files in /G. Such files are
always ready for selection.
The select() function can be used on a Telserv or OSSTTY terminal process. The select() func-
tion cannot be used on any other type of Guardian object.
Use From the Guardian Environment
The select() function is one of a set of functions that have these effects when the first of them is
called from the Guardian environment:
• Two Guardian file system file numbers (not necessarily the next two available) are allo-
cated for the root directory and the current working directory. These file 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 first of the set of functions is called. The effects are not cumu-
lative.
NOTES
The select() function cannot be used on terminal device files (ttys) in the HP implementation.
Beginning with the G06.26 release version update (RVU), FD_SETSIZE was increased. Appli-
cations that use a variable select() limit based on the highest numbered file descriptor run
corrrectly on both prior and subsequent RVUs and benefit from the higher limit on subsequent
RVUs.
Applications that use a fixed select() limit run on both prior and subsequent RVUs if compiled
on prior RVUs but only run on subsequent RVUs if compiled on a subsequent RVU.
Applications that mix select()-related object modules from prior and subsequent RVUs are
unsafe because the select() file descriptor bit arrays have different size declarations in the RVUs.
To avoid application failures, select()-related object modules should be compiled using a con-
sistent set of select() definitions.
527186-003 Hewlett-Packard Company 7−7