41 microseconds in an argument of type struct timeval, whereas for the
42 pselect() function the timeout period is given in seconds and
43 nanoseconds in an argument of type struct timespec
44
45 o The select() function has no sigmask argument. It behaves as
46 pselect() does when sigmask is a null pointer.
47
48 o Upon successful completion, the select() function might modify the
49 object pointed to by the Itimeout argument.
50
51 The select() and pselect() functions support regular files, terminal and
52 pseudo-terminal devices, STREAMS-based files, FIFOs, pipes, and sockets.
53 The behavior of select() and pselect() on file descriptors that refer to
54 other types of file is unspecified.
55
56 The nfds argument specifies the range of file descriptors to be tested.
57 The first nfds descriptors are checked in each set; that is, the
58 descriptors from zero through ``nfds - 1'' in the descriptor sets are
59 examined.
60
61 If the readfs argument is not a null pointer, it points to an object of
62 type fd_set that on input specifies the file descriptors to be checked
63 for being ready to read, and on output indicates which file descriptors
64 are ready to read.
65
66 If the writefs argument is not a null pointer, it points to an object of
67 type fd_set that on input specifies the file descriptors to be checked
68 for being ready to write, and on output indicates which file descriptors
69 are ready to write.
70
71 If the errorfds argument is not a null pointer, it points to an object of
72 type fd_set that on input specifies the file descriptors to be checked
73 for error conditions pending, and on output indicates which file
74 descriptors have error conditions pending.
75
76 Upon successful completion, the objects pointed to by the readfs,
77 writefs, and errorfds arguments are modified to indicate which file
78 descriptors are ready for reading, ready for writing, or have an error
79 condition pending, respectively, and return the total number of ready
80 descriptors in all the output sets. For each file descriptor less than
81 nfds, the corresponding bit will be set on successful completion if it
82 was set on input and the associated condition is true for that file
83 descriptor.
84
85 If none of the selected descriptors are ready for the requested
86 operation, the select() or pselect() function blocks until at least one
87 of the requested operations becomes ready, until the timeout occurs, or
88 until interrupted by a signal. The timeout parameter controls how long
89 the select() or pselect() function takes before timing out. If the
90 timeout parameter is not a null pointer, it specifies a maximum interval
91 to wait for the selection to complete. If the specified time interval
92 expires without any requested operation becoming ready, the function
93 returns. If the timeout parameter is a null pointer, then the call to
94 select() or pselect() blocks indefinitely until at least one descriptor
95 meets the specified criteria. To effect a poll, the timeout parameter
96 should not be a null pointer, and should point to a zero-valued timespec
97 structure.
151 A file descriptor for a socket that is listening for connections will
152 indicate that it is ready for reading, when connections are available. A
153 file descriptor for a socket that is connecting asynchronously will
154 indicate that it is ready for writing, when a connection has been
155 established.
156
157 Selecting true for reading on a socket descriptor upon which a
158 listen(3XNET) call has been performed indicates that a subsequent
159 accept(3XNET) call on that descriptor will not block.
160
161 If the timeout argument is not a null pointer, it points to an object of
162 type struct timeval that specifies a maximum interval to wait for the
163 selection to complete. If the timeout argument points to an object of
164 type struct timeval whose members are 0, select() does not block. If the
165 timeout argument is a null pointer, select() blocks until an event causes
166 one of the masks to be returned with a valid (non-zero) value. If the
167 time limit expires before any event occurs that would cause one of the
168 masks to be set to a non-zero value, select() completes successfully and
169 returns 0.
170
171 If the readfs, writefds, and errorfds arguments are all null pointers and
172 the timeout argument is not a null pointer, select() or pselect() blocks
173 for the time specified, or until interrupted by a signal. If the
174 readfds, writefds, and errorfds arguments are all null pointers and the
175 timeout argument is a null pointer, select() blocks until interrupted by
176 a signal.
177
178 File descriptors associated with regular files always select true for
179 ready to read, ready to write, and error conditions.
180
181 On failure, the objects pointed to by the readfds, writefds, and errorfds
182 arguments are not modified. If the timeout interval expires without the
183 specified condition being true for any of the specified file descriptors,
184 the objects pointed to by the readfds, writefds, and errorfds arguments
185 have all bits set to 0.
186
187 File descriptor masks of type fd_set can be initialized and tested with
188 the macros FD_CLR(), FD_ISSET(), FD_SET(), and FD_ZERO().
189
190 FD_CLR(fd, &fdset)
191 Clears the bit for the file descriptor fd in the file descriptor
192 set fdset.
193
|
41 microseconds in an argument of type struct timeval, whereas for the
42 pselect() function the timeout period is given in seconds and
43 nanoseconds in an argument of type struct timespec
44
45 o The select() function has no sigmask argument. It behaves as
46 pselect() does when sigmask is a null pointer.
47
48 o Upon successful completion, the select() function might modify the
49 object pointed to by the Itimeout argument.
50
51 The select() and pselect() functions support regular files, terminal and
52 pseudo-terminal devices, STREAMS-based files, FIFOs, pipes, and sockets.
53 The behavior of select() and pselect() on file descriptors that refer to
54 other types of file is unspecified.
55
56 The nfds argument specifies the range of file descriptors to be tested.
57 The first nfds descriptors are checked in each set; that is, the
58 descriptors from zero through ``nfds - 1'' in the descriptor sets are
59 examined.
60
61 If the readfds argument is not a null pointer, it points to an object of
62 type fd_set that on input specifies the file descriptors to be checked
63 for being ready to read, and on output indicates which file descriptors
64 are ready to read.
65
66 If the writefds argument is not a null pointer, it points to an object of
67 type fd_set that on input specifies the file descriptors to be checked
68 for being ready to write, and on output indicates which file descriptors
69 are ready to write.
70
71 If the errorfds argument is not a null pointer, it points to an object of
72 type fd_set that on input specifies the file descriptors to be checked
73 for error conditions pending, and on output indicates which file
74 descriptors have error conditions pending.
75
76 Upon successful completion, the objects pointed to by the readfds,
77 writefds, and errorfds arguments are modified to indicate which file
78 descriptors are ready for reading, ready for writing, or have an error
79 condition pending, respectively, and return the total number of ready
80 descriptors in all the output sets. For each file descriptor less than
81 nfds, the corresponding bit will be set on successful completion if it
82 was set on input and the associated condition is true for that file
83 descriptor.
84
85 If none of the selected descriptors are ready for the requested
86 operation, the select() or pselect() function blocks until at least one
87 of the requested operations becomes ready, until the timeout occurs, or
88 until interrupted by a signal. The timeout parameter controls how long
89 the select() or pselect() function takes before timing out. If the
90 timeout parameter is not a null pointer, it specifies a maximum interval
91 to wait for the selection to complete. If the specified time interval
92 expires without any requested operation becoming ready, the function
93 returns. If the timeout parameter is a null pointer, then the call to
94 select() or pselect() blocks indefinitely until at least one descriptor
95 meets the specified criteria. To effect a poll, the timeout parameter
96 should not be a null pointer, and should point to a zero-valued timespec
97 structure.
151 A file descriptor for a socket that is listening for connections will
152 indicate that it is ready for reading, when connections are available. A
153 file descriptor for a socket that is connecting asynchronously will
154 indicate that it is ready for writing, when a connection has been
155 established.
156
157 Selecting true for reading on a socket descriptor upon which a
158 listen(3XNET) call has been performed indicates that a subsequent
159 accept(3XNET) call on that descriptor will not block.
160
161 If the timeout argument is not a null pointer, it points to an object of
162 type struct timeval that specifies a maximum interval to wait for the
163 selection to complete. If the timeout argument points to an object of
164 type struct timeval whose members are 0, select() does not block. If the
165 timeout argument is a null pointer, select() blocks until an event causes
166 one of the masks to be returned with a valid (non-zero) value. If the
167 time limit expires before any event occurs that would cause one of the
168 masks to be set to a non-zero value, select() completes successfully and
169 returns 0.
170
171 If the readfds, writefds, and errorfds arguments are all null pointers
172 and the timeout argument is not a null pointer, select() or pselect()
173 blocks for the time specified, or until interrupted by a signal. If the
174 readfds, writefds, and errorfds arguments are all null pointers and the
175 timeout argument is a null pointer, select() blocks until interrupted by
176 a signal.
177
178 File descriptors associated with regular files always select true for
179 ready to read, ready to write, and error conditions.
180
181 On failure, the objects pointed to by the readfds, writefds, and errorfds
182 arguments are not modified. If the timeout interval expires without the
183 specified condition being true for any of the specified file descriptors,
184 the objects pointed to by the readfds, writefds, and errorfds arguments
185 have all bits set to 0.
186
187 File descriptor masks of type fd_set can be initialized and tested with
188 the macros FD_CLR(), FD_ISSET(), FD_SET(), and FD_ZERO().
189
190 FD_CLR(fd, &fdset)
191 Clears the bit for the file descriptor fd in the file descriptor
192 set fdset.
193
|