Debian Codegraph @

templates/man2/select.2.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:42+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "select"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-08"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid ""
50 "select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO, fd_set - synchronous I/O "
51 "multiplexing"
52 msgstr ""
53
54 #. type: SH
55 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
56 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
57 #, no-wrap
58 msgid "LIBRARY"
59 msgstr ""
60
61 #. type: Plain text
62 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
63 #: opensuse-leap-16-1 opensuse-tumbleweed
64 msgid "Standard C library (I<libc>,\\ I<-lc>)"
65 msgstr ""
66
67 #. type: SH
68 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
69 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
70 #, no-wrap
71 msgid "SYNOPSIS"
72 msgstr ""
73
74 #. type: Plain text
75 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
76 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
77 #, no-wrap
78 msgid "B<#include E<lt>sys/select.hE<gt>>\n"
79 msgstr ""
80
81 #. type: Plain text
82 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
83 #: opensuse-tumbleweed
84 #, no-wrap
85 msgid "B<typedef> /* .\\|.\\|.\\& */ B<fd_set;>\n"
86 msgstr ""
87
88 #. type: Plain text
89 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
90 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
91 #, no-wrap
92 msgid ""
93 "B<int select(int >I<nfds>B<, fd_set *_Nullable restrict >I<readfds>B<,>\n"
94 "B< fd_set *_Nullable restrict >I<writefds>B<,>\n"
95 "B< fd_set *_Nullable restrict >I<exceptfds>B<,>\n"
96 "B< struct timeval *_Nullable restrict >I<timeout>B<);>\n"
97 msgstr ""
98
99 #. type: Plain text
100 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
101 #: opensuse-tumbleweed
102 #, no-wrap
103 msgid ""
104 "B<void FD_CLR(int >I<fd>B<, fd_set *>I<set>B<);>\n"
105 "B<int FD_ISSET(int >I<fd>B<, const fd_set *>I<set>B<);>\n"
106 "B<void FD_SET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
107 "B<void FD_ZERO(fd_set *>I<set>B<);>\n"
108 msgstr ""
109
110 #. type: Plain text
111 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
112 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
113 #, no-wrap
114 msgid ""
115 "B<int pselect(int >I<nfds>B<, fd_set *_Nullable restrict >I<readfds>B<,>\n"
116 "B< fd_set *_Nullable restrict >I<writefds>B<,>\n"
117 "B< fd_set *_Nullable restrict >I<exceptfds>B<,>\n"
118 "B< const struct timespec *_Nullable restrict >I<timeout>B<,>\n"
119 "B< const sigset_t *_Nullable restrict >I<sigmask>B<);>\n"
120 msgstr ""
121
122 #. type: Plain text
123 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
124 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
125 msgid ""
126 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
127 msgstr ""
128
129 #. type: Plain text
130 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
131 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
132 msgid "B<pselect>():"
133 msgstr ""
134
135 #. type: Plain text
136 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
137 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
138 #, no-wrap
139 msgid " _POSIX_C_SOURCE E<gt>= 200112L\n"
140 msgstr ""
141
142 #. type: SH
143 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
144 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
145 #, no-wrap
146 msgid "DESCRIPTION"
147 msgstr ""
148
149 #. type: Plain text
150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
152 msgid ""
153 "B<WARNING>: B<select>() can monitor only file descriptors numbers that are "
154 "less than B<FD_SETSIZE> (1024)\\[em]an unreasonably low limit for many "
155 "modern applications\\[em]and this limitation will not change. All modern "
156 "applications should instead use B<poll>(2) or B<epoll>(7), which do not "
157 "suffer this limitation."
158 msgstr ""
159
160 #. type: Plain text
161 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
162 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
163 msgid ""
164 "B<select>() allows a program to monitor multiple file descriptors, waiting "
165 "until one or more of the file descriptors become \"ready\" for some class of "
166 "I/O operation (e.g., input possible). A file descriptor is considered ready "
167 "if it is possible to perform a corresponding I/O operation (e.g., "
168 "B<read>(2), or a sufficiently small B<write>(2)) without blocking."
169 msgstr ""
170
171 #. type: SS
172 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
173 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
174 #, no-wrap
175 msgid "fd_set"
176 msgstr ""
177
178 #. type: Plain text
179 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
180 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
181 msgid ""
182 "A structure type that can represent a set of file descriptors. According to "
183 "POSIX, the maximum number of file descriptors in an I<fd_set> structure is "
184 "the value of the macro B<FD_SETSIZE>."
185 msgstr ""
186
187 #. type: SS
188 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
189 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
190 #, no-wrap
191 msgid "File descriptor sets"
192 msgstr ""
193
194 #. type: Plain text
195 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
196 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
197 msgid ""
198 "The principal arguments of B<select>() are three \"sets\" of file "
199 "descriptors (declared with the type I<fd_set>), which allow the caller to "
200 "wait for three classes of events on the specified set of file descriptors. "
201 "Each of the I<fd_set> arguments may be specified as NULL if no file "
202 "descriptors are to be watched for the corresponding class of events."
203 msgstr ""
204
205 #. type: Plain text
206 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
207 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
208 msgid ""
209 "B<Note well>: Upon return, each of the file descriptor sets is modified in "
210 "place to indicate which file descriptors are currently \"ready\". Thus, if "
211 "using B<select>() within a loop, the sets I<must be reinitialized> before "
212 "each call."
213 msgstr ""
214
215 #. type: Plain text
216 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
217 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
218 msgid ""
219 "The contents of a file descriptor set can be manipulated using the following "
220 "macros:"
221 msgstr ""
222
223 #. type: TP
224 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
225 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
226 #, no-wrap
227 msgid "B<FD_ZERO>()"
228 msgstr ""
229
230 #. type: Plain text
231 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
232 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
233 msgid ""
234 "This macro clears (removes all file descriptors from) I<set>. It should be "
235 "employed as the first step in initializing a file descriptor set."
236 msgstr ""
237
238 #. type: TP
239 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
240 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
241 #, no-wrap
242 msgid "B<FD_SET>()"
243 msgstr ""
244
245 #. type: Plain text
246 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
247 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
248 msgid ""
249 "This macro adds the file descriptor I<fd> to I<set>. Adding a file "
250 "descriptor that is already present in the set is a no-op, and does not "
251 "produce an error."
252 msgstr ""
253
254 #. type: TP
255 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
256 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
257 #, no-wrap
258 msgid "B<FD_CLR>()"
259 msgstr ""
260
261 #. type: Plain text
262 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
263 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
264 msgid ""
265 "This macro removes the file descriptor I<fd> from I<set>. Removing a file "
266 "descriptor that is not present in the set is a no-op, and does not produce "
267 "an error."
268 msgstr ""
269
270 #. type: TP
271 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
272 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
273 #, no-wrap
274 msgid "B<FD_ISSET>()"
275 msgstr ""
276
277 #. type: Plain text
278 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
279 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
280 msgid ""
281 "B<select>() modifies the contents of the sets according to the rules "
282 "described below. After calling B<select>(), the B<FD_ISSET>() macro can be "
283 "used to test if a file descriptor is still present in a set. B<FD_ISSET>() "
284 "returns nonzero if the file descriptor I<fd> is present in I<set>, and zero "
285 "if it is not."
286 msgstr ""
287
288 #. type: SS
289 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
290 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
291 #, no-wrap
292 msgid "Arguments"
293 msgstr ""
294
295 #. type: Plain text
296 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
297 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
298 msgid "The arguments of B<select>() are as follows:"
299 msgstr ""
300
301 #. type: TP
302 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
303 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
304 #, no-wrap
305 msgid "I<readfds>"
306 msgstr ""
307
308 #. type: Plain text
309 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
310 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
311 msgid ""
312 "The file descriptors in this set are watched to see if they are ready for "
313 "reading. A file descriptor is ready for reading if a read operation will "
314 "not block; in particular, a file descriptor is also ready on end-of-file."
315 msgstr ""
316
317 #. type: Plain text
318 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
319 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
320 msgid ""
321 "After B<select>() has returned, I<readfds> will be cleared of all file "
322 "descriptors except for those that are ready for reading."
323 msgstr ""
324
325 #. type: TP
326 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
327 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
328 #, no-wrap
329 msgid "I<writefds>"
330 msgstr ""
331
332 #. type: Plain text
333 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
334 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
335 msgid ""
336 "The file descriptors in this set are watched to see if they are ready for "
337 "writing. A file descriptor is ready for writing if a write operation will "
338 "not block. However, even if a file descriptor indicates as writable, a "
339 "large write may still block."
340 msgstr ""
341
342 #. type: Plain text
343 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
344 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
345 msgid ""
346 "After B<select>() has returned, I<writefds> will be cleared of all file "
347 "descriptors except for those that are ready for writing."
348 msgstr ""
349
350 #. type: TP
351 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
352 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
353 #, no-wrap
354 msgid "I<exceptfds>"
355 msgstr ""
356
357 #. type: Plain text
358 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
359 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
360 msgid ""
361 "The file descriptors in this set are watched for \"exceptional "
362 "conditions\". For examples of some exceptional conditions, see the "
363 "discussion of B<POLLPRI> in B<poll>(2)."
364 msgstr ""
365
366 #. type: Plain text
367 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
368 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
369 msgid ""
370 "After B<select>() has returned, I<exceptfds> will be cleared of all file "
371 "descriptors except for those for which an exceptional condition has occurred."
372 msgstr ""
373
374 #. type: TP
375 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
376 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
377 #, no-wrap
378 msgid "I<nfds>"
379 msgstr ""
380
381 #. type: Plain text
382 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
383 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
384 msgid ""
385 "This argument should be set to the highest-numbered file descriptor in any "
386 "of the three sets, plus 1. The indicated file descriptors in each set are "
387 "checked, up to this limit (but see BUGS)."
388 msgstr ""
389
390 #. type: TP
391 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
392 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
393 #, no-wrap
394 msgid "I<timeout>"
395 msgstr ""
396
397 #. type: Plain text
398 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
399 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
400 msgid ""
401 "The I<timeout> argument is a I<timeval> structure (shown below) that "
402 "specifies the interval that B<select>() should block waiting for a file "
403 "descriptor to become ready. The call will block until either:"
404 msgstr ""
405
406 #. type: IP
407 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
408 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
409 #, no-wrap
410 msgid "\\[bu]"
411 msgstr ""
412
413 #. type: Plain text
414 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
415 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
416 msgid "a file descriptor becomes ready;"
417 msgstr ""
418
419 #. type: Plain text
420 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
421 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
422 msgid "the call is interrupted by a signal handler; or"
423 msgstr ""
424
425 #. type: Plain text
426 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
427 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
428 msgid "the timeout expires."
429 msgstr ""
430
431 #. type: Plain text
432 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
433 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
434 msgid ""
435 "Note that the I<timeout> interval will be rounded up to the system clock "
436 "granularity, and kernel scheduling delays mean that the blocking interval "
437 "may overrun by a small amount."
438 msgstr ""
439
440 #. type: Plain text
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 msgid ""
444 "If both fields of the I<timeval> structure are zero, then B<select>() "
445 "returns immediately. (This is useful for polling.)"
446 msgstr ""
447
448 #. type: Plain text
449 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
450 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
451 msgid ""
452 "If I<timeout> is specified as NULL, B<select>() blocks indefinitely waiting "
453 "for a file descriptor to become ready."
454 msgstr ""
455
456 #. type: SS
457 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
458 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
459 #, no-wrap
460 msgid "pselect()"
461 msgstr ""
462
463 #. type: Plain text
464 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
465 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
466 msgid ""
467 "The B<pselect>() system call allows an application to safely wait until "
468 "either a file descriptor becomes ready or until a signal is caught."
469 msgstr ""
470
471 #. type: Plain text
472 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
473 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
474 msgid ""
475 "The operation of B<select>() and B<pselect>() is identical, other than "
476 "these three differences:"
477 msgstr ""
478
479 #. type: Plain text
480 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
481 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
482 msgid ""
483 "B<select>() uses a timeout that is a I<struct timeval> (with seconds and "
484 "microseconds), while B<pselect>() uses a I<struct timespec> (with seconds "
485 "and nanoseconds)."
486 msgstr ""
487
488 #. type: Plain text
489 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
490 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
491 msgid ""
492 "B<select>() may update the I<timeout> argument to indicate how much time "
493 "was left. B<pselect>() does not change this argument."
494 msgstr ""
495
496 #. type: Plain text
497 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
498 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
499 msgid ""
500 "B<select>() has no I<sigmask> argument, and behaves as B<pselect>() called "
501 "with NULL I<sigmask>."
502 msgstr ""
503
504 #. type: Plain text
505 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
506 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
507 msgid ""
508 "I<sigmask> is a pointer to a signal mask (see B<sigprocmask>(2)); if it is "
509 "not NULL, then B<pselect>() first replaces the current signal mask by the "
510 "one pointed to by I<sigmask>, then does the \"select\" function, and then "
511 "restores the original signal mask. (If I<sigmask> is NULL, the signal mask "
512 "is not modified during the B<pselect>() call.)"
513 msgstr ""
514
515 #. type: Plain text
516 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
517 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
518 msgid ""
519 "Other than the difference in the precision of the I<timeout> argument, the "
520 "following B<pselect>() call:"
521 msgstr ""
522
523 #. type: Plain text
524 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
525 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
526 #, no-wrap
527 msgid ""
528 "ready = pselect(nfds, &readfds, &writefds, &exceptfds,\n"
529 " timeout, &sigmask);\n"
530 msgstr ""
531
532 #. type: Plain text
533 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
534 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
535 msgid "is equivalent to I<atomically> executing the following calls:"
536 msgstr ""
537
538 #. type: Plain text
539 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
540 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
541 #, no-wrap
542 msgid ""
543 "sigset_t origmask;\n"
544 "\\&\n"
545 "pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);\n"
546 "ready = select(nfds, &readfds, &writefds, &exceptfds, timeout);\n"
547 "pthread_sigmask(SIG_SETMASK, &origmask, NULL);\n"
548 msgstr ""
549
550 #. type: Plain text
551 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
552 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
553 msgid ""
554 "The reason that B<pselect>() is needed is that if one wants to wait for "
555 "either a signal or for a file descriptor to become ready, then an atomic "
556 "test is needed to prevent race conditions. (Suppose the signal handler sets "
557 "a global flag and returns. Then a test of this global flag followed by a "
558 "call of B<select>() could hang indefinitely if the signal arrived just "
559 "after the test but just before the call. By contrast, B<pselect>() allows "
560 "one to first block signals, handle the signals that have come in, then call "
561 "B<pselect>() with the desired I<sigmask>, avoiding the race.)"
562 msgstr ""
563
564 #. type: SS
565 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
566 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
567 #, no-wrap
568 msgid "The timeout"
569 msgstr ""
570
571 #. type: Plain text
572 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
573 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
574 msgid ""
575 "The I<timeout> argument for B<select>() is a structure of the following "
576 "type:"
577 msgstr ""
578
579 #. type: Plain text
580 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
581 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
582 #, no-wrap
583 msgid ""
584 "struct timeval {\n"
585 " time_t tv_sec; /* seconds */\n"
586 " suseconds_t tv_usec; /* microseconds */\n"
587 "};\n"
588 msgstr ""
589
590 #. type: Plain text
591 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
592 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
593 msgid ""
594 "The corresponding argument for B<pselect>() is a B<timespec>(3) structure."
595 msgstr ""
596
597 #. .P - it is rumored that:
598 #. On BSD, when a timeout occurs, the file descriptor bits are not changed.
599 #. - it is certainly true that:
600 #. Linux follows SUSv2 and sets the bit masks to zero upon a timeout.
601 #. type: Plain text
602 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
603 #: opensuse-tumbleweed
604 msgid ""
605 "On Linux, B<select>() modifies I<timeout> to reflect the amount of time not "
606 "slept; most other implementations do not do this. (POSIX.1 permits either "
607 "behavior.) This causes problems both when Linux code which reads I<timeout> "
608 "is ported to other operating systems, and when code is ported to Linux that "
609 "reuses a I<struct\\ timeval> for multiple B<select>()s in a loop without "
610 "reinitializing it. Consider I<timeout> to be undefined after B<select>() "
611 "returns."
612 msgstr ""
613
614 #. type: SH
615 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
616 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
617 #, no-wrap
618 msgid "RETURN VALUE"
619 msgstr ""
620
621 #. type: Plain text
622 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
623 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
624 msgid ""
625 "On success, B<select>() and B<pselect>() return the number of file "
626 "descriptors contained in the three returned descriptor sets (that is, the "
627 "total number of bits that are set in I<readfds>, I<writefds>, "
628 "I<exceptfds>). The return value may be zero if the timeout expired before "
629 "any file descriptors became ready."
630 msgstr ""
631
632 #. type: Plain text
633 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
634 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
635 msgid ""
636 "On error, -1 is returned, and I<errno> is set to indicate the error; the "
637 "file descriptor sets are unmodified, and I<timeout> becomes undefined."
638 msgstr ""
639
640 #. type: SH
641 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
642 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
643 #, no-wrap
644 msgid "ERRORS"
645 msgstr ""
646
647 #. type: TP
648 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
649 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
650 #, no-wrap
651 msgid "B<EBADF>"
652 msgstr ""
653
654 #. type: Plain text
655 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
656 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
657 msgid ""
658 "An invalid file descriptor was given in one of the sets. (Perhaps a file "
659 "descriptor that was already closed, or one on which an error has occurred.) "
660 "However, see BUGS."
661 msgstr ""
662
663 #. type: TP
664 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
665 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
666 #, no-wrap
667 msgid "B<EINTR>"
668 msgstr ""
669
670 #. type: Plain text
671 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
672 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
673 msgid "A signal was caught; see B<signal>(7)."
674 msgstr ""
675
676 #. type: TP
677 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
678 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
679 #, no-wrap
680 msgid "B<EINVAL>"
681 msgstr ""
682
683 #. type: Plain text
684 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
685 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
686 msgid ""
687 "I<nfds> is negative or exceeds the B<RLIMIT_NOFILE> resource limit (see "
688 "B<getrlimit>(2))."
689 msgstr ""
690
691 #. type: Plain text
692 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
693 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
694 msgid "The value contained within I<timeout> is invalid."
695 msgstr ""
696
697 #. type: TP
698 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
699 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
700 #, no-wrap
701 msgid "B<ENOMEM>"
702 msgstr ""
703
704 #. type: Plain text
705 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
706 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
707 msgid "Unable to allocate memory for internal tables."
708 msgstr ""
709
710 #. type: SH
711 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
712 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
713 #, no-wrap
714 msgid "VERSIONS"
715 msgstr ""
716
717 #. Darwin, according to a report by Jeremy Sequoia, relayed by Josh Triplett
718 #. type: Plain text
719 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
720 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
721 msgid ""
722 "On some other UNIX systems, B<select>() can fail with the error B<EAGAIN> "
723 "if the system fails to allocate kernel-internal resources, rather than "
724 "B<ENOMEM> as Linux does. POSIX specifies this error for B<poll>(2), but not "
725 "for B<select>(). Portable programs may wish to check for B<EAGAIN> and "
726 "loop, just as with B<EINTR>."
727 msgstr ""
728
729 #. type: SH
730 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
731 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
732 #, no-wrap
733 msgid "STANDARDS"
734 msgstr ""
735
736 #. type: Plain text
737 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
738 #: opensuse-tumbleweed
739 msgid "POSIX.1-2024."
740 msgstr ""
741
742 #. type: SH
743 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
744 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
745 #, no-wrap
746 msgid "HISTORY"
747 msgstr ""
748
749 #. type: TP
750 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
751 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
752 #, no-wrap
753 msgid "B<select>()"
754 msgstr ""
755
756 #. type: Plain text
757 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
758 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
759 msgid "POSIX.1-2001, 4.4BSD (first appeared in 4.2BSD)."
760 msgstr ""
761
762 #. type: Plain text
763 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
764 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
765 msgid ""
766 "Generally portable to/from non-BSD systems supporting clones of the BSD "
767 "socket layer (including System\\ V variants). However, note that the "
768 "System\\ V variant typically sets the timeout variable before returning, but "
769 "the BSD variant does not."
770 msgstr ""
771
772 #. type: TP
773 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
774 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
775 #, no-wrap
776 msgid "B<pselect>()"
777 msgstr ""
778
779 #. type: Plain text
780 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
781 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
782 msgid "Linux 2.6.16. POSIX.1g, POSIX.1-2001."
783 msgstr ""
784
785 #. type: Plain text
786 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
787 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
788 msgid "Prior to this, it was emulated in glibc (but see BUGS)."
789 msgstr ""
790
791 #. type: TP
792 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
793 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
794 #, no-wrap
795 msgid "B<fd_set>"
796 msgstr ""
797
798 #. type: Plain text
799 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
800 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
801 msgid "POSIX.1-2001."
802 msgstr ""
803
804 #. type: SH
805 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
806 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
807 #, no-wrap
808 msgid "NOTES"
809 msgstr ""
810
811 #. type: Plain text
812 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
813 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
814 msgid ""
815 "The following header also provides the I<fd_set> type: I<E<lt>sys/"
816 "time.hE<gt>>."
817 msgstr ""
818
819 #. type: Plain text
820 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
821 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
822 msgid ""
823 "An I<fd_set> is a fixed size buffer. Executing B<FD_CLR>() or B<FD_SET>() "
824 "with a value of I<fd> that is negative or is equal to or larger than "
825 "B<FD_SETSIZE> will result in undefined behavior. Moreover, POSIX requires "
826 "I<fd> to be a valid file descriptor."
827 msgstr ""
828
829 #. type: Plain text
830 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
831 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
832 msgid ""
833 "The operation of B<select>() and B<pselect>() is not affected by the "
834 "B<O_NONBLOCK> flag."
835 msgstr ""
836
837 #. type: SS
838 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
839 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
840 #, no-wrap
841 msgid "The self-pipe trick"
842 msgstr ""
843
844 #. type: Plain text
845 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
846 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
847 msgid ""
848 "On systems that lack B<pselect>(), reliable (and more portable) signal "
849 "trapping can be achieved using the self-pipe trick. In this technique, a "
850 "signal handler writes a byte to a pipe whose other end is monitored by "
851 "B<select>() in the main program. (To avoid possibly blocking when writing "
852 "to a pipe that may be full or reading from a pipe that may be empty, "
853 "nonblocking I/O is used when reading from and writing to the pipe.)"
854 msgstr ""
855
856 #. type: SS
857 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
858 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
859 #, no-wrap
860 msgid "Emulating usleep(3)"
861 msgstr ""
862
863 #. type: Plain text
864 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
865 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
866 msgid ""
867 "Before the advent of B<usleep>(3), some code employed a call to B<select>() "
868 "with all three sets empty, I<nfds> zero, and a non-NULL I<timeout> as a "
869 "fairly portable way to sleep with subsecond precision."
870 msgstr ""
871
872 #. type: SS
873 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
874 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
875 #, no-wrap
876 msgid "Correspondence between select() and poll() notifications"
877 msgstr ""
878
879 #. fs/select.c
880 #. type: Plain text
881 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
882 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
883 msgid ""
884 "Within the Linux kernel source, we find the following definitions which show "
885 "the correspondence between the readable, writable, and exceptional condition "
886 "notifications of B<select>() and the event notifications provided by "
887 "B<poll>(2) and B<epoll>(7):"
888 msgstr ""
889
890 #. type: Plain text
891 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
892 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
893 #, no-wrap
894 msgid ""
895 "#define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN |\n"
896 " EPOLLHUP | EPOLLERR)\n"
897 " /* Ready for reading */\n"
898 "#define POLLOUT_SET (EPOLLWRBAND | EPOLLWRNORM | EPOLLOUT |\n"
899 " EPOLLERR)\n"
900 " /* Ready for writing */\n"
901 "#define POLLEX_SET (EPOLLPRI)\n"
902 " /* Exceptional condition */\n"
903 msgstr ""
904
905 #. type: SS
906 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
907 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
908 #, no-wrap
909 msgid "Multithreaded applications"
910 msgstr ""
911
912 #. type: Plain text
913 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
914 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
915 msgid ""
916 "If a file descriptor being monitored by B<select>() is closed in another "
917 "thread, the result is unspecified. On some UNIX systems, B<select>() "
918 "unblocks and returns, with an indication that the file descriptor is ready "
919 "(a subsequent I/O operation will likely fail with an error, unless another "
920 "process reopens the file descriptor between the time B<select>() returned "
921 "and the I/O operation is performed). On Linux (and some other systems), "
922 "closing the file descriptor in another thread has no effect on B<select>(). "
923 "In summary, any application that relies on a particular behavior in this "
924 "scenario must be considered buggy."
925 msgstr ""
926
927 #. type: SS
928 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
929 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
930 #, no-wrap
931 msgid "C library/kernel differences"
932 msgstr ""
933
934 #. type: Plain text
935 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
936 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
937 msgid ""
938 "The Linux kernel allows file descriptor sets of arbitrary size, determining "
939 "the length of the sets to be checked from the value of I<nfds>. However, in "
940 "the glibc implementation, the I<fd_set> type is fixed in size. See also "
941 "BUGS."
942 msgstr ""
943
944 #. type: Plain text
945 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
946 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
947 msgid ""
948 "The B<pselect>() interface described in this page is implemented by glibc. "
949 "The underlying Linux system call is named B<pselect6>(). This system call "
950 "has somewhat different behavior from the glibc wrapper function."
951 msgstr ""
952
953 #. type: Plain text
954 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
955 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
956 msgid ""
957 "The Linux B<pselect6>() system call modifies its I<timeout> argument. "
958 "However, the glibc wrapper function hides this behavior by using a local "
959 "variable for the timeout argument that is passed to the system call. Thus, "
960 "the glibc B<pselect>() function does not modify its I<timeout> argument; "
961 "this is the behavior required by POSIX.1-2001."
962 msgstr ""
963
964 #. type: Plain text
965 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
966 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
967 msgid ""
968 "The final argument of the B<pselect6>() system call is not a I<sigset_t\\ "
969 "*> pointer, but is instead a structure of the form:"
970 msgstr ""
971
972 #. type: Plain text
973 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
974 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
975 #, no-wrap
976 msgid ""
977 "struct {\n"
978 " const kernel_sigset_t *ss; /* Pointer to signal set */\n"
979 " size_t ss_len; /* Size (in bytes) of object\n"
980 " pointed to by \\[aq]ss\\[aq] */\n"
981 "};\n"
982 msgstr ""
983
984 #. type: Plain text
985 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
986 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
987 msgid ""
988 "This allows the system call to obtain both a pointer to the signal set and "
989 "its size, while allowing for the fact that most architectures support a "
990 "maximum of 6 arguments to a system call. See B<sigprocmask>(2) for a "
991 "discussion of the difference between the kernel and libc notion of the "
992 "signal set."
993 msgstr ""
994
995 #. type: SS
996 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
997 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
998 #, no-wrap
999 msgid "Historical glibc details"
1000 msgstr ""
1001
1002 #. type: Plain text
1003 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1004 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1005 msgid ""
1006 "glibc 2.0 provided an incorrect version of B<pselect>() that did not take a "
1007 "I<sigmask> argument."
1008 msgstr ""
1009
1010 #. type: Plain text
1011 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1012 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1013 msgid ""
1014 "From glibc 2.1 to glibc 2.2.1, one must define B<_GNU_SOURCE> in order to "
1015 "obtain the declaration of B<pselect>() from I<E<lt>sys/select.hE<gt>>."
1016 msgstr ""
1017
1018 #. type: SH
1019 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1020 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1021 #, no-wrap
1022 msgid "BUGS"
1023 msgstr ""
1024
1025 #. type: Plain text
1026 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1027 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1028 msgid ""
1029 "POSIX allows an implementation to define an upper limit, advertised via the "
1030 "constant B<FD_SETSIZE>, on the range of file descriptors that can be "
1031 "specified in a file descriptor set. The Linux kernel imposes no fixed "
1032 "limit, but the glibc implementation makes I<fd_set> a fixed-size type, with "
1033 "B<FD_SETSIZE> defined as 1024, and the B<FD_*>() macros operating according "
1034 "to that limit. To monitor file descriptors greater than 1023, use "
1035 "B<poll>(2) or B<epoll>(7) instead."
1036 msgstr ""
1037
1038 #. type: Plain text
1039 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1040 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1041 msgid ""
1042 "The implementation of the I<fd_set> arguments as value-result arguments is a "
1043 "design error that is avoided in B<poll>(2) and B<epoll>(7)."
1044 msgstr ""
1045
1046 #. type: Plain text
1047 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1048 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1049 msgid ""
1050 "According to POSIX, B<select>() should check all specified file descriptors "
1051 "in the three file descriptor sets, up to the limit I<nfds-1>. However, the "
1052 "current implementation ignores any file descriptor in these sets that is "
1053 "greater than the maximum file descriptor number that the process currently "
1054 "has open. According to POSIX, any such file descriptor that is specified in "
1055 "one of the sets should result in the error B<EBADF>."
1056 msgstr ""
1057
1058 #. type: Plain text
1059 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1060 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1061 msgid ""
1062 "Starting with glibc 2.1, glibc provided an emulation of B<pselect>() that "
1063 "was implemented using B<sigprocmask>(2) and B<select>(). This "
1064 "implementation remained vulnerable to the very race condition that "
1065 "B<pselect>() was designed to prevent. Modern versions of glibc use the "
1066 "(race-free) B<pselect>() system call on kernels where it is provided."
1067 msgstr ""
1068
1069 #. Stevens discusses a case where accept can block after select
1070 #. returns successfully because of an intervening RST from the client.
1071 #. Maybe the kernel should have returned EIO in such a situation?
1072 #. type: Plain text
1073 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1074 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1075 msgid ""
1076 "On Linux, B<select>() may report a socket file descriptor as \"ready for "
1077 "reading\", while nevertheless a subsequent read blocks. This could for "
1078 "example happen when data has arrived but upon examination has the wrong "
1079 "checksum and is discarded. There may be other circumstances in which a file "
1080 "descriptor is spuriously reported as ready. Thus it may be safer to use "
1081 "B<O_NONBLOCK> on sockets that should not block."
1082 msgstr ""
1083
1084 #. type: Plain text
1085 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1086 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1087 msgid ""
1088 "On Linux, B<select>() also modifies I<timeout> if the call is interrupted "
1089 "by a signal handler (i.e., the B<EINTR> error return). This is not "
1090 "permitted by POSIX.1. The Linux B<pselect>() system call has the same "
1091 "behavior, but the glibc wrapper hides this behavior by internally copying "
1092 "the I<timeout> to a local variable and passing that variable to the system "
1093 "call."
1094 msgstr ""
1095
1096 #. type: SH
1097 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1098 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1099 #, no-wrap
1100 msgid "EXAMPLES"
1101 msgstr ""
1102
1103 #. type: Plain text
1104 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1105 #: opensuse-tumbleweed
1106 #, no-wrap
1107 msgid ""
1108 "#include E<lt>stdio.hE<gt>\n"
1109 "#include E<lt>stdlib.hE<gt>\n"
1110 "#include E<lt>sys/select.hE<gt>\n"
1111 "#include E<lt>sys/time.hE<gt>\n"
1112 "\\&\n"
1113 "int\n"
1114 "main(void)\n"
1115 "{\n"
1116 " int retval;\n"
1117 " fd_set rfds;\n"
1118 " struct timeval tv;\n"
1119 "\\&\n"
1120 " /* Watch stdin (fd 0) to see when it has input. */\n"
1121 "\\&\n"
1122 " FD_ZERO(&rfds);\n"
1123 " FD_SET(0, &rfds);\n"
1124 "\\&\n"
1125 " /* Wait up to five seconds. */\n"
1126 "\\&\n"
1127 " tv.tv_sec = 5;\n"
1128 " tv.tv_usec = 0;\n"
1129 "\\&\n"
1130 " retval = select(1, &rfds, NULL, NULL, &tv);\n"
1131 " /* Don\\[aq]t rely on the value of tv now! */\n"
1132 "\\&\n"
1133 " if (retval == -1)\n"
1134 " perror(\"select()\");\n"
1135 " else if (retval)\n"
1136 " printf(\"Data is available now.\\[rs]n\");\n"
1137 " /* FD_ISSET(0, &rfds) will be true. */\n"
1138 " else\n"
1139 " printf(\"No data within five seconds.\\[rs]n\");\n"
1140 "\\&\n"
1141 " exit(EXIT_SUCCESS);\n"
1142 "}\n"
1143 msgstr ""
1144
1145 #. SRC END
1146 #. type: SH
1147 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1148 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1149 #, no-wrap
1150 msgid "SEE ALSO"
1151 msgstr ""
1152
1153 #. type: Plain text
1154 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1155 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1156 msgid ""
1157 "B<accept>(2), B<connect>(2), B<poll>(2), B<read>(2), B<recv>(2), "
1158 "B<restart_syscall>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), "
1159 "B<timespec>(3), B<epoll>(7), B<time>(7)"
1160 msgstr ""
1161
1162 #. type: Plain text
1163 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1164 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1165 msgid "For a tutorial with discussion and examples, see B<select_tut>(2)."
1166 msgstr ""
1167
1168 #. type: TH
1169 #: debian-trixie
1170 #, no-wrap
1171 msgid "2024-06-15"
1172 msgstr ""
1173
1174 #. type: TH
1175 #: debian-trixie
1176 #, no-wrap
1177 msgid "Linux man-pages 6.9.1"
1178 msgstr ""
1179
1180 #. type: Plain text
1181 #: debian-trixie
1182 msgid "Standard C library (I<libc>, I<-lc>)"
1183 msgstr ""
1184
1185 #. type: Plain text
1186 #: debian-trixie fedora-44 fedora-rawhide
1187 #, no-wrap
1188 msgid "B<typedef> /* ... */ B<fd_set;>\n"
1189 msgstr ""
1190
1191 #. type: Plain text
1192 #: debian-trixie fedora-44 fedora-rawhide
1193 #, no-wrap
1194 msgid ""
1195 "B<void FD_CLR(int >I<fd>B<, fd_set *>I<set>B<);>\n"
1196 "B<int FD_ISSET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
1197 "B<void FD_SET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
1198 "B<void FD_ZERO(fd_set *>I<set>B<);>\n"
1199 msgstr ""
1200
1201 #. .P - it is rumored that:
1202 #. On BSD, when a timeout occurs, the file descriptor bits are not changed.
1203 #. - it is certainly true that:
1204 #. Linux follows SUSv2 and sets the bit masks to zero upon a timeout.
1205 #. type: Plain text
1206 #: debian-trixie fedora-44 fedora-rawhide
1207 msgid ""
1208 "On Linux, B<select>() modifies I<timeout> to reflect the amount of time not "
1209 "slept; most other implementations do not do this. (POSIX.1 permits either "
1210 "behavior.) This causes problems both when Linux code which reads I<timeout> "
1211 "is ported to other operating systems, and when code is ported to Linux that "
1212 "reuses a I<struct timeval> for multiple B<select>()s in a loop without "
1213 "reinitializing it. Consider I<timeout> to be undefined after B<select>() "
1214 "returns."
1215 msgstr ""
1216
1217 #. type: Plain text
1218 #: debian-trixie fedora-44 fedora-rawhide
1219 msgid "POSIX.1-2008."
1220 msgstr ""
1221
1222 #. type: Plain text
1223 #: debian-trixie
1224 #, no-wrap
1225 msgid ""
1226 "#include E<lt>stdio.hE<gt>\n"
1227 "#include E<lt>stdlib.hE<gt>\n"
1228 "#include E<lt>sys/select.hE<gt>\n"
1229 "\\&\n"
1230 "int\n"
1231 "main(void)\n"
1232 "{\n"
1233 " int retval;\n"
1234 " fd_set rfds;\n"
1235 " struct timeval tv;\n"
1236 "\\&\n"
1237 " /* Watch stdin (fd 0) to see when it has input. */\n"
1238 "\\&\n"
1239 " FD_ZERO(&rfds);\n"
1240 " FD_SET(0, &rfds);\n"
1241 "\\&\n"
1242 " /* Wait up to five seconds. */\n"
1243 "\\&\n"
1244 " tv.tv_sec = 5;\n"
1245 " tv.tv_usec = 0;\n"
1246 "\\&\n"
1247 " retval = select(1, &rfds, NULL, NULL, &tv);\n"
1248 " /* Don\\[aq]t rely on the value of tv now! */\n"
1249 "\\&\n"
1250 " if (retval == -1)\n"
1251 " perror(\"select()\");\n"
1252 " else if (retval)\n"
1253 " printf(\"Data is available now.\\[rs]n\");\n"
1254 " /* FD_ISSET(0, &rfds) will be true. */\n"
1255 " else\n"
1256 " printf(\"No data within five seconds.\\[rs]n\");\n"
1257 "\\&\n"
1258 " exit(EXIT_SUCCESS);\n"
1259 "}\n"
1260 msgstr ""
1261
1262 #. type: TH
1263 #: fedora-44 fedora-rawhide
1264 #, no-wrap
1265 msgid "2024-11-03"
1266 msgstr ""
1267
1268 #. type: TH
1269 #: fedora-44 fedora-rawhide
1270 #, no-wrap
1271 msgid "Linux man-pages 6.13"
1272 msgstr ""
1273
1274 #. type: Plain text
1275 #: fedora-44 fedora-rawhide
1276 #, no-wrap
1277 msgid ""
1278 "#include E<lt>stdio.hE<gt>\n"
1279 "#include E<lt>stdlib.hE<gt>\n"
1280 "#include E<lt>sys/select.hE<gt>\n"
1281 "#include E<lt>sys/time.hE<gt>\n"
1282 "\\&\n"
1283 "int\n"
1284 "main(void)\n"
1285 "{\n"
1286 " int retval;\n"
1287 " fd_set rfds;\n"
1288 " struct timeval tv;\n"
1289 "\\&\n"
1290 " /* Watch stdin (fd 0) to see when it has input. */\n"
1291 "\\&\n"
1292 " FD_ZERO(&rfds);\n"
1293 " FD_SET(0, &rfds);\n"
1294 "\\&\n"
1295 " /* Wait up to five seconds. */\n"
1296 "\\&\n"
1297 " tv.tv_sec = 5;\n"
1298 " tv.tv_usec = 0;\n"
1299 "\\&\n"
1300 " retval = select(1, &rfds, NULL, NULL, &tv);\n"
1301 " /* Don\\[aq]t rely on the value of tv now! */\n"
1302 "\\&\n"
1303 " if (retval == -1)\n"
1304 " perror(\"select()\");\n"
1305 " else if (retval)\n"
1306 " printf(\"Data is available now.\\[rs]n\");\n"
1307 " /* FD_ISSET(0, &rfds) will be true. */\n"
1308 " else\n"
1309 " printf(\"No data within five seconds.\\[rs]n\");\n"
1310 "\\&\n"
1311 " exit(EXIT_SUCCESS);\n"
1312 "}\n"
1313 msgstr ""
1314
1315 #. type: TH
1316 #: mageia-cauldron
1317 #, no-wrap
1318 msgid "Linux man-pages 6.17"
1319 msgstr ""
1320
1321 #. type: TH
1322 #: opensuse-leap-16-1 opensuse-tumbleweed
1323 #, no-wrap
1324 msgid "Linux man-pages (unreleased)"
1325 msgstr ""