Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ select(2dn) — Ultrix DECnet 3.0 VAX

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

accept(2dn)

connect(2dn)

read(2dn)

recv(2dn)

send(2dn)

write(2dn)

select(2dn)

NAME

select − synchronous I/O multiplexing

SYNTAX

#include <sys/time.h>

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

ARGUMENTS

Input Arguments

nfds Specifies the number of descriptors to be checked.  For example, the bits from 0 to nfds -1 in the masks are examined. 

readfds Specifies the descriptor to be examined for read (or receive) data ready.  This descriptor can be given as a null pointer (0) if it is of no interest. 

writefds Specifies the descriptor to be examined for write (or send) data ready.  This descriptor can be passed as a null pointer (0) if it is of no interest. 

exceptfds Specifies the descriptor to be examined for exception data ready. This descriptor should be given as a null pointer (0), because it is of no interest. 

timeout Specifies an address of a structure timeval. If timeout is a nonzero pointer, it specifies a maximum interval to wait for the selection to complete.  If timeout is a zero pointer, the select blocks indefinitely.  To affect a poll, timeout should be nonzero, pointing to a zero valued timeval structure.

Return Argument

nfound Total number of ready descriptors returned. 

DESCRIPTION

The select call examines the I/O descriptors specified by the bit masks readfds, writefds, and execptfds to determine whether they are ready for reading, writing, or have an exceptional condition pending.  File descriptor f is represented by the bit 1<<f in the mask.  nfds descriptors are checked; that is, the bits from 0 through nfds −1 in the masks are examined.  The select call returns a mask of those descriptors that are ready. The total number of ready descriptors is returned in nfound. 

If timeout is a nonzero pointer, it specifies a maximum interval to wait for the selection to complete.  If timeout is a zero pointer, the select blocks indefinitely.  To affect a poll, the timeout argument should be nonzero, pointing to a zero valued timeval structure.

The readfds, writefds, and execptfds can be defined as 0 if no descriptors are of interest. 

RETURN VALUE

The select call returns the number of descriptors that are contained in the bit masks.  If an error occurs, a value of -1 is returned. Additional error detail will be contained in the external variable errno. If the time limit expires, a value of 0 is returned.

DIAGNOSTICS

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

[EINTR] An asynchronous signal was delivered before any of the selected events occurred, or the time limit expired. 

RESTRICTIONS

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

SEE ALSO

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

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