147 .Fn pselect
148 functions support regular files, terminal and pseudo-terminal devices,
149 STREAMS-based files, FIFOs, pipes, and sockets.
150 The behavior of
151 .Fn select
152 and
153 .Fn pselect
154 on file descriptors that refer to other types of file is unspecified.
155 .Pp
156 The
157 .Fa nfds
158 argument specifies the range of file descriptors to be tested.
159 The first
160 .Fa nfds
161 descriptors are checked in each set; that is, the
162 descriptors from zero through
163 .Dq Li nfds - 1
164 in the descriptor sets are examined.
165 .Pp
166 If the
167 .Fa readfs
168 argument is not a null pointer, it points to an object of
169 type
170 .Vt fd_set
171 that on input specifies the file descriptors to be checked
172 for being ready to read, and on output indicates which file descriptors are
173 ready to read.
174 .Pp
175 If the
176 .Fa writefs
177 argument is not a null pointer, it points to an object of
178 type
179 .Vt fd_set
180 that on input specifies the file descriptors to be checked
181 for being ready to write, and on output indicates which file descriptors are
182 ready to write.
183 .Pp
184 If the
185 .Fa errorfds
186 argument is not a null pointer, it points to an object of
187 type
188 .Vt fd_set
189 that on input specifies the file descriptors to be checked
190 for error conditions pending, and on output indicates which file descriptors
191 have error conditions pending.
192 .Pp
193 Upon successful completion, the objects pointed to by the
194 .Fa readfs ,
195 .Fa writefs ,
196 and
197 .Fa errorfds
198 arguments are modified to indicate which file descriptors are ready for reading,
199 ready for writing, or have an error condition pending, respectively, and return
200 the total number of ready descriptors in all the output sets.
201 For each file descriptor less than
202 .Fa nfds ,
203 the corresponding bit will be set on successful completion if it was set on
204 input and the associated condition is true for that file descriptor.
205 .Pp
206 If none of the selected descriptors are ready for the requested operation, the
207 .Fn select
208 or
209 .Fn pselect
210 function blocks until at least one of the
211 requested operations becomes ready, until the timeout occurs, or until
212 interrupted by a signal.
213 The
214 .Fa timeout
215 parameter controls how long the
337 selection to complete.
338 If the
339 .Fa timeout
340 argument points to an object of type
341 .Vt struct timeval
342 whose members are 0,
343 .Fn select
344 does not block.
345 If the
346 .Fa timeout
347 argument is a null pointer,
348 .Fn select
349 blocks until an event causes one of the masks to be returned with a valid
350 (non-zero) value.
351 If the time limit expires before any event occurs that would cause one of the
352 masks to be set to a non-zero value,
353 .Fn select
354 completes successfully and returns 0.
355 .Pp
356 If the
357 .Fa readfs ,
358 .Fa writefds ,
359 and
360 .Fa errorfds
361 arguments are all null pointers and the
362 .Fa timeout
363 argument is not a null pointer,
364 .Fn select
365 or
366 .Fn pselect
367 blocks for the time specified, or until interrupted by a
368 signal.
369 If the
370 .Fa readfds ,
371 .Fa writefds ,
372 and
373 .Fa errorfds
374 arguments are all null pointers and the
375 .Fa timeout
376 argument is a null pointer,
377 .Fn select
|
147 .Fn pselect
148 functions support regular files, terminal and pseudo-terminal devices,
149 STREAMS-based files, FIFOs, pipes, and sockets.
150 The behavior of
151 .Fn select
152 and
153 .Fn pselect
154 on file descriptors that refer to other types of file is unspecified.
155 .Pp
156 The
157 .Fa nfds
158 argument specifies the range of file descriptors to be tested.
159 The first
160 .Fa nfds
161 descriptors are checked in each set; that is, the
162 descriptors from zero through
163 .Dq Li nfds - 1
164 in the descriptor sets are examined.
165 .Pp
166 If the
167 .Fa readfds
168 argument is not a null pointer, it points to an object of
169 type
170 .Vt fd_set
171 that on input specifies the file descriptors to be checked
172 for being ready to read, and on output indicates which file descriptors are
173 ready to read.
174 .Pp
175 If the
176 .Fa writefds
177 argument is not a null pointer, it points to an object of
178 type
179 .Vt fd_set
180 that on input specifies the file descriptors to be checked
181 for being ready to write, and on output indicates which file descriptors are
182 ready to write.
183 .Pp
184 If the
185 .Fa errorfds
186 argument is not a null pointer, it points to an object of
187 type
188 .Vt fd_set
189 that on input specifies the file descriptors to be checked
190 for error conditions pending, and on output indicates which file descriptors
191 have error conditions pending.
192 .Pp
193 Upon successful completion, the objects pointed to by the
194 .Fa readfds ,
195 .Fa writefds ,
196 and
197 .Fa errorfds
198 arguments are modified to indicate which file descriptors are ready for reading,
199 ready for writing, or have an error condition pending, respectively, and return
200 the total number of ready descriptors in all the output sets.
201 For each file descriptor less than
202 .Fa nfds ,
203 the corresponding bit will be set on successful completion if it was set on
204 input and the associated condition is true for that file descriptor.
205 .Pp
206 If none of the selected descriptors are ready for the requested operation, the
207 .Fn select
208 or
209 .Fn pselect
210 function blocks until at least one of the
211 requested operations becomes ready, until the timeout occurs, or until
212 interrupted by a signal.
213 The
214 .Fa timeout
215 parameter controls how long the
337 selection to complete.
338 If the
339 .Fa timeout
340 argument points to an object of type
341 .Vt struct timeval
342 whose members are 0,
343 .Fn select
344 does not block.
345 If the
346 .Fa timeout
347 argument is a null pointer,
348 .Fn select
349 blocks until an event causes one of the masks to be returned with a valid
350 (non-zero) value.
351 If the time limit expires before any event occurs that would cause one of the
352 masks to be set to a non-zero value,
353 .Fn select
354 completes successfully and returns 0.
355 .Pp
356 If the
357 .Fa readfds ,
358 .Fa writefds ,
359 and
360 .Fa errorfds
361 arguments are all null pointers and the
362 .Fa timeout
363 argument is not a null pointer,
364 .Fn select
365 or
366 .Fn pselect
367 blocks for the time specified, or until interrupted by a
368 signal.
369 If the
370 .Fa readfds ,
371 .Fa writefds ,
372 and
373 .Fa errorfds
374 arguments are all null pointers and the
375 .Fa timeout
376 argument is a null pointer,
377 .Fn select
|