Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ select(2) — Ultrix-11 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

accept(2)

connect(2)

read(2)

recv(2)

send(2)

write(2)

select(2)

NAME

select − synchronous I/O multiplexing

SYNTAX

int nfound = select(nfds, readfds, writefds, execptfds, timeout)
int nfds, *timeout;
long *readfds, *writefds, *execptfds;

DESCRIPTION

The select system call examines the I/O descriptors specified by the bit masks readfds, writefds, and execptfds to see if they are ready for reading, writing, or have an exceptional condition pending, respectively.  File descriptor f is represented by the bit “1<<f” in the mask.  The specified nfds descriptors are checked.  That is, the bits from 0 through nfds-1 in the masks are examined.  The select call returns, in place, a mask of those descriptors which are ready.  The total number of ready descriptors is returned in nfound.

If timeout is a non-zero pointer, it specifies a maximum interval of time to wait for the selection to complete.  If timeout is a zero pointer, the select blocks indefinitely.  To affect a poll, the timeout should be non-zero, pointing to a zero valued int. 

Any of readfds, writefds, and execptfds may be given as 0 if no descriptors are of interest. 

RESTRICTIONS

The descriptor masks are always modified on return, even if the call returns as the result of the timeout. 

RETURN VALUE

If the time limit expires, returns a 0.  Otherwise, if successful, returns the number of descriptors which are contained in the bit mask.  If unsuccessful, returns a −1, and the global variable errno indicates the error code. 

DIAGNOSTICS

The select call will fail if:

[EBADF] One of the bit masks specified is an invalid descriptor. 

[EINTR] Either an signal was delivered before any of the selected for events occurred, or the time limit expired. 

SEE ALSO

accept(2), connect(2), read(2), recv(2), send(2), write(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026