|
|
1.1 root 1: .TH SELECT 2 "2 July 1983"
2: .UC 4
3: .SH NAME
4: select \- synchronous i/o multiplexing
5: .SH SYNOPSIS
6: .nf
7: .ft B
8: #include <sys/time.h>
9: .PP
10: .ft B
11: nfound = select(nfds, readfds, writefds, execptfds, timeout)
12: int nfound, nfds, *readfds, *writefds, *execptfds;
13: struct timeval *timeout;
14: .fi
15: .SH DESCRIPTION
16: .I Select
17: examines the i/o descriptors specified by the bit masks
18: .IR readfds ,
19: .IR writefds ,
20: and
21: .I execptfds
22: to see if they are ready for reading, writing, or have an exceptional
23: condition pending, respectively.
24: File descriptor
25: .I f
26: is represented by the bit \*(lq1<<f\*(rq in
27: the mask.
28: .I Nfds
29: desciptors are checked,
30: i.e. the bits from 0 through
31: .IR nfds -1
32: in the masks are examined.
33: .I Select
34: returns, in place, a mask of those descriptors which are ready.
35: The total number of ready descriptors is returned in
36: .IR nfound .
37: .PP
38: If
39: .I timeout
40: is a non-zero pointer, it specifies a maximum interval to wait for the
41: selection to complete. If
42: .I timeout
43: is a zero pointer, the select blocks indefinitely. To affect a poll, the
44: .I timeout
45: argument should be non-zero, pointing to a zero valued timeval structure.
46: .PP
47: Any of
48: .IR readfds ,
49: .IR writefds ,
50: and
51: .I execptfds
52: may be given as 0 if no descriptors are of interest.
53: .SH "RETURN VALUE
54: .I Select
55: returns the number of descriptors which are contained in
56: the bit masks,
57: or \-1 if an error occurred.
58: If the time limit expires then
59: .I select
60: returns 0.
61: .SH "ERRORS
62: An error return from \fIselect\fP indicates:
63: .TP 15
64: [EBADF]
65: One of the bit masks specified an invalid descriptor.
66: .TP 15
67: [EINTR]
68: An signal was delivered before any of the selected for
69: events occurred or the time limit expired.
70: .SH SEE ALSO
71: accept(2), connect(2), read(2), write(2), recv(2), send(2)
72: .SH BUGS
73: The descriptor masks are always modified on return, even
74: if the call returns as the result of the timeout.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.