Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ select(3N) — GL2 W2.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

accept(3N)

connect(3N)

read(2)

write(2)

receive(3N)

send(3N)

SELECT(3N)  —  Silicon Graphics

NAME

select − synchronous I/O multiplexing

SYNOPSIS

#include <sys/time.h>
nfound = select(nfds, readfds, writefds, timeout)
int nfound, nfds, *readfds, *writefds;
long timeout;

DESCRIPTION

select examines the I/O descriptors in the bits 0 through nfds −1 in the readfds and writefds masks.  It checks if the descriptors are ready for reading or writing.  Mask bit "1<<f" represents the file descriptor f. 

select returns a mask and count (nfound) of the ready descriptors. 

timeout specifies the maximum interval to wait for the selection to complete, in milliseconds. 

readfds and/or writefds may be specified as 0 if no descriptors are of interest. 

RETURN VALUE

select returns the number of descriptors that are contained in the bit masks, or −1 if an error occurred.  If the time limit expires, select returns 0. 

ERRORS

[EBADF] An invalid descriptor was specified. 

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

SEE ALSO

accept(3N), connect(3N), read(2), write(2), receive(3N), send(3N)

BUGS

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

select works only on socket-file descriptors.  All other files always select as being writable or readable. 

Version 2.4  —  September 29, 2021

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