Debian Codegraph @

po/pt_BR/man2/poll.2.po

raw
1 # Brazilian Portuguese translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # André Luiz Fassone <[email protected]>, 2001.
5 # Ricardo C.O.Freitas <[email protected]>, 2001.
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: manpages-l10n\n"
9 "POT-Creation-Date: 2026-06-05 06:35+0200\n"
10 "PO-Revision-Date: 2001-06-02 19:20-0300\n"
11 "Last-Translator: Ricardo C.O.Freitas <[email protected]>\n"
12 "Language-Team: Brazilian Portuguese <debian-l10n-"
13 "[email protected]>\n"
14 "Language: pt_BR\n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
19 "X-Generator: Virtaal 1.0.0-beta1\n"
20
21 #. type: TH
22 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
23 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
24 #, no-wrap
25 msgid "poll"
26 msgstr "poll"
27
28 #. type: TH
29 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
30 #: opensuse-tumbleweed
31 #, no-wrap
32 msgid "2026-02-08"
33 msgstr "8 fevereiro 2026"
34
35 #. type: TH
36 #: archlinux debian-unstable
37 #, fuzzy, no-wrap
38 #| msgid "Linux man-pages 6.17"
39 msgid "Linux man-pages 6.18"
40 msgstr "Linux man-pages 6.17"
41
42 #. type: SH
43 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
44 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
45 #, no-wrap
46 msgid "NAME"
47 msgstr "NOME"
48
49 #. type: Plain text
50 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
51 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
52 msgid "poll, ppoll - wait for some event on a file descriptor"
53 msgstr "poll, ppoll - espera por algum evento em um descriptor de arquivo"
54
55 #. type: SH
56 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
57 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
58 #, no-wrap
59 msgid "LIBRARY"
60 msgstr "BIBLIOTECA"
61
62 #. type: Plain text
63 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
64 #: opensuse-leap-16-1 opensuse-tumbleweed
65 msgid "Standard C library (I<libc>,\\ I<-lc>)"
66 msgstr "Biblioteca C Padrão (I<libc>,\\ I<-lc>)"
67
68 #. type: SH
69 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
70 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
71 #, no-wrap
72 msgid "SYNOPSIS"
73 msgstr "SINOPSE"
74
75 #. type: Plain text
76 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
77 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
78 #, no-wrap
79 msgid "B<#include E<lt>poll.hE<gt>>\n"
80 msgstr "B<#include E<lt>poll.hE<gt>>\n"
81
82 #. type: Plain text
83 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
84 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
85 #, no-wrap
86 msgid "B<int poll(struct pollfd *>I<fds>B<, nfds_t >I<nfds>B<, int >I<timeout>B<);>\n"
87 msgstr "B<int poll(struct pollfd *>I<fds>B<, nfds_t >I<nfds>B<, int >I<timeout>B<);>\n"
88
89 #. type: Plain text
90 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
91 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
92 #, fuzzy, no-wrap
93 #| msgid ""
94 #| "B<#define _GNU_SOURCE>\n"
95 #| "B<#include E<lt>sched.hE<gt>>\n"
96 msgid ""
97 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
98 "B<#include E<lt>poll.hE<gt>>\n"
99 msgstr ""
100 "B<#define _GNU_SOURCE>\n"
101 "B<#include E<lt>sched.hE<gt>>\n"
102
103 #. type: Plain text
104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
106 #, fuzzy, no-wrap
107 #| msgid ""
108 #| "B<int ppoll(struct pollfd *>I<fds>B<, nfds_t >I<nfds>B<, >\n"
109 #| "B< const struct timespec *>I<tmo_p>B<, const sigset_t *>I<sigmask>B<);>\n"
110 msgid ""
111 "B<int ppoll(struct pollfd *>I<fds>B<, nfds_t >I<nfds>B<,>\n"
112 "B< const struct timespec *_Nullable >I<tmo_p>B<,>\n"
113 "B< const sigset_t *_Nullable >I<sigmask>B<);>\n"
114 msgstr ""
115 "B<int ppoll(struct pollfd *>I<fds>B<, nfds_t >I<nfds>B<, >\n"
116 "B< const struct timespec *>I<tmo_p>B<, const sigset_t *>I<sigmask>B<);>\n"
117
118 #. type: SH
119 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
120 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
121 #, no-wrap
122 msgid "DESCRIPTION"
123 msgstr "DESCRIÇÃO"
124
125 #. type: Plain text
126 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
127 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
128 msgid ""
129 "B<poll>() performs a similar task to B<select>(2): it waits for one of a "
130 "set of file descriptors to become ready to perform I/O. The Linux-specific "
131 "B<epoll>(7) API performs a similar task, but offers features beyond those "
132 "found in B<poll>()."
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 msgid ""
139 "The set of file descriptors to be monitored is specified in the I<fds> "
140 "argument, which is an array of structures of the following form:"
141 msgstr ""
142
143 #. type: Plain text
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 #, no-wrap
147 msgid ""
148 "struct pollfd {\n"
149 " int fd; /* file descriptor */\n"
150 " short events; /* requested events */\n"
151 " short revents; /* returned events */\n"
152 "};\n"
153 msgstr ""
154
155 #. type: Plain text
156 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
157 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
158 msgid ""
159 "The caller should specify the number of items in the I<fds> array in I<nfds>."
160 msgstr ""
161
162 #. type: Plain text
163 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
164 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
165 msgid ""
166 "The field I<fd> contains a file descriptor for an open file. If this field "
167 "is negative, then the corresponding I<events> field is ignored and the "
168 "I<revents> field returns zero. (This provides an easy way of ignoring a "
169 "file descriptor for a single B<poll>() call: simply set the I<fd> field to "
170 "its bitwise complement.)"
171 msgstr ""
172
173 #. type: Plain text
174 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
175 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
176 msgid ""
177 "The field I<events> is an input parameter, a bit mask specifying the events "
178 "the application is interested in for the file descriptor I<fd>. This field "
179 "may be specified as zero, in which case the only events that can be returned "
180 "in I<revents> are B<POLLHUP>, B<POLLERR>, and B<POLLNVAL> (see below)."
181 msgstr ""
182
183 #. type: Plain text
184 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
185 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
186 msgid ""
187 "The field I<revents> is an output parameter, filled by the kernel with the "
188 "events that actually occurred. The bits returned in I<revents> can include "
189 "any of those specified in I<events>, or one of the values B<POLLERR>, "
190 "B<POLLHUP>, or B<POLLNVAL>. (These three bits are meaningless in the "
191 "I<events> field, and will be set in the I<revents> field whenever the "
192 "corresponding condition is true.)"
193 msgstr ""
194
195 #. type: Plain text
196 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
197 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
198 msgid ""
199 "If none of the events requested (and no error) has occurred for any of the "
200 "file descriptors, then B<poll>() blocks until one of the events occurs."
201 msgstr ""
202
203 #. type: Plain text
204 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
205 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
206 msgid ""
207 "The I<timeout> argument specifies the number of milliseconds that B<poll>() "
208 "should block waiting for a file descriptor to become ready. The call will "
209 "block until either:"
210 msgstr ""
211
212 #. type: IP
213 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
214 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
215 #, no-wrap
216 msgid "\\[bu]"
217 msgstr "\\[bu]"
218
219 #. type: Plain text
220 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
221 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
222 #, fuzzy
223 #| msgid "The field descriptions are:"
224 msgid "a file descriptor becomes ready;"
225 msgstr "As descrições dos campos são:"
226
227 #. type: Plain text
228 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
229 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
230 msgid "the call is interrupted by a signal handler; or"
231 msgstr ""
232
233 #. type: Plain text
234 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
235 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
236 msgid "the timeout expires."
237 msgstr ""
238
239 #. type: Plain text
240 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
241 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
242 msgid ""
243 "Being \"ready\" means that the requested operation will not block; thus, "
244 "B<poll>()ing regular files, block devices, and other files with no "
245 "reasonable polling semantic I<always> returns instantly as ready to read and "
246 "write."
247 msgstr ""
248
249 #. type: Plain text
250 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
251 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
252 msgid ""
253 "Note that the I<timeout> interval will be rounded up to the system clock "
254 "granularity, and kernel scheduling delays mean that the blocking interval "
255 "may overrun by a small amount. Specifying a negative value in I<timeout> "
256 "means an infinite timeout. Specifying a I<timeout> of zero causes "
257 "B<poll>() to return immediately, even if no file descriptors are ready."
258 msgstr ""
259
260 #. type: Plain text
261 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
262 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
263 msgid ""
264 "The bits that may be set/returned in I<events> and I<revents> are defined in "
265 "I<E<lt>poll.hE<gt>>:"
266 msgstr ""
267
268 #. type: TP
269 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
270 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
271 #, no-wrap
272 msgid "B<POLLIN>"
273 msgstr "B<POLLIN>"
274
275 #. type: Plain text
276 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
277 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
278 msgid "There is data to read."
279 msgstr ""
280
281 #. type: TP
282 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
283 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
284 #, no-wrap
285 msgid "B<POLLPRI>"
286 msgstr "B<POLLPRI>"
287
288 #. type: Plain text
289 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
290 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
291 msgid ""
292 "There is some exceptional condition on the file descriptor. Possibilities "
293 "include:"
294 msgstr ""
295
296 #. type: Plain text
297 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
298 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
299 msgid "There is out-of-band data on a TCP socket (see B<tcp>(7))."
300 msgstr ""
301
302 #. type: Plain text
303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
305 msgid ""
306 "A pseudoterminal master in packet mode has seen a state change on the slave "
307 "(see B<ioctl_tty>(2))."
308 msgstr ""
309
310 #. type: Plain text
311 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
312 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
313 msgid "A I<cgroup.events> file has been modified (see B<cgroups>(7))."
314 msgstr ""
315
316 #. type: TP
317 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
318 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
319 #, no-wrap
320 msgid "B<POLLOUT>"
321 msgstr "B<POLLOUT>"
322
323 #. type: Plain text
324 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
325 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
326 msgid ""
327 "Writing is now possible, though a write larger than the available space in a "
328 "socket or pipe will still block (unless B<O_NONBLOCK> is set)."
329 msgstr ""
330
331 #. type: TP
332 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
333 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
334 #, no-wrap
335 msgid "B<POLLRDHUP> (since Linux 2.6.17)"
336 msgstr ""
337
338 #. type: Plain text
339 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
340 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
341 msgid ""
342 "Stream socket peer closed connection, or shut down writing half of "
343 "connection. The B<_GNU_SOURCE> feature test macro must be defined (before "
344 "including I<any> header files) in order to obtain this definition."
345 msgstr ""
346
347 #. type: TP
348 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
349 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
350 #, no-wrap
351 msgid "B<POLLERR>"
352 msgstr "B<POLLERR>"
353
354 #. type: Plain text
355 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
356 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
357 msgid ""
358 "Error condition (only returned in I<revents>; ignored in I<events>). This "
359 "bit is also set for a file descriptor referring to the write end of a pipe "
360 "when the read end has been closed."
361 msgstr ""
362
363 #. type: TP
364 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
365 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
366 #, no-wrap
367 msgid "B<POLLHUP>"
368 msgstr "B<POLLHUP>"
369
370 #. type: Plain text
371 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
372 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
373 msgid ""
374 "Hang up (only returned in I<revents>; ignored in I<events>). Note that when "
375 "reading from a channel such as a pipe or a stream socket, this event merely "
376 "indicates that the peer closed its end of the channel. Subsequent reads "
377 "from the channel will return 0 (end of file) only after all outstanding "
378 "data in the channel has been consumed."
379 msgstr ""
380
381 #. type: TP
382 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
383 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
384 #, no-wrap
385 msgid "B<POLLNVAL>"
386 msgstr "B<POLLNVAL>"
387
388 #. type: Plain text
389 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
390 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
391 msgid ""
392 "Invalid request: I<fd> not open (only returned in I<revents>; ignored in "
393 "I<events>)."
394 msgstr ""
395
396 #. type: Plain text
397 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
398 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
399 msgid ""
400 "When compiling with B<_XOPEN_SOURCE> defined, one also has the following, "
401 "which convey no further information beyond the bits listed above:"
402 msgstr ""
403
404 #. type: TP
405 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
406 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
407 #, no-wrap
408 msgid "B<POLLRDNORM>"
409 msgstr "B<POLLRDNORM>"
410
411 #. type: Plain text
412 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
413 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
414 msgid "Equivalent to B<POLLIN>."
415 msgstr ""
416
417 #. type: TP
418 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
419 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
420 #, no-wrap
421 msgid "B<POLLRDBAND>"
422 msgstr "B<POLLRDBAND>"
423
424 #. POLLRDBAND is used in the DECnet protocol.
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 "Priority band data can be read (generally unused on Linux)."
429 msgstr ""
430
431 #. type: TP
432 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
433 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
434 #, no-wrap
435 msgid "B<POLLWRNORM>"
436 msgstr "B<POLLWRNORM>"
437
438 #. type: Plain text
439 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
440 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
441 msgid "Equivalent to B<POLLOUT>."
442 msgstr ""
443
444 #. type: TP
445 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
446 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
447 #, no-wrap
448 msgid "B<POLLWRBAND>"
449 msgstr "B<POLLWRBAND>"
450
451 #. type: Plain text
452 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
453 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
454 msgid "Priority data may be written."
455 msgstr ""
456
457 #. type: Plain text
458 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
459 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
460 msgid "Linux also knows about, but does not use B<POLLMSG>."
461 msgstr ""
462
463 #. type: SS
464 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
465 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
466 #, no-wrap
467 msgid "ppoll()"
468 msgstr "ppoll()"
469
470 #. type: Plain text
471 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
472 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
473 msgid ""
474 "The relationship between B<poll>() and B<ppoll>() is analogous to the "
475 "relationship between B<select>(2) and B<pselect>(2): like B<pselect>(2), "
476 "B<ppoll>() allows an application to safely wait until either a file "
477 "descriptor becomes ready or until a signal is caught."
478 msgstr ""
479
480 #. type: Plain text
481 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
482 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
483 msgid ""
484 "Other than the difference in the precision of the I<timeout> argument, the "
485 "following B<ppoll>() call:"
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 #, no-wrap
492 msgid "ready = ppoll(&fds, nfds, tmo_p, &sigmask);\n"
493 msgstr "ready = ppoll(&fds, nfds, tmo_p, &sigmask);\n"
494
495 #. type: Plain text
496 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
497 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
498 msgid "is nearly equivalent to I<atomically> executing the following calls:"
499 msgstr ""
500
501 #. type: Plain text
502 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
503 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
504 #, fuzzy, no-wrap
505 #| msgid ""
506 #| "timeout = (tmo_p == NULL) ? -1 :\n"
507 #| " (tmo_p-E<gt>tv_sec * 1000 + tmo_p-E<gt>tv_nsec / 1000000);\n"
508 #| "pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);\n"
509 #| "ready = poll(&fds, nfds, timeout);\n"
510 #| "pthread_sigmask(SIG_SETMASK, &origmask, NULL);\n"
511 msgid ""
512 "sigset_t origmask;\n"
513 "int timeout;\n"
514 "\\&\n"
515 "timeout = (tmo_p == NULL) ? -1 :\n"
516 " (tmo_p-E<gt>tv_sec * 1000 + tmo_p-E<gt>tv_nsec / 1000000);\n"
517 "pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);\n"
518 "ready = poll(&fds, nfds, timeout);\n"
519 "pthread_sigmask(SIG_SETMASK, &origmask, NULL);\n"
520 msgstr ""
521 "timeout = (tmo_p == NULL) ? -1 :\n"
522 " (tmo_p-E<gt>tv_sec * 1000 + tmo_p-E<gt>tv_nsec / 1000000);\n"
523 "pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);\n"
524 "ready = poll(&fds, nfds, timeout);\n"
525 "pthread_sigmask(SIG_SETMASK, &origmask, NULL);\n"
526
527 #. type: Plain text
528 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
529 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
530 msgid ""
531 "The above code segment is described as I<nearly> equivalent because whereas "
532 "a negative I<timeout> value for B<poll>() is interpreted as an infinite "
533 "timeout, a negative value expressed in I<*tmo_p> results in an error from "
534 "B<ppoll>()."
535 msgstr ""
536
537 #. type: Plain text
538 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
539 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
540 msgid ""
541 "See the description of B<pselect>(2) for an explanation of why B<ppoll>() "
542 "is necessary."
543 msgstr ""
544
545 #. type: Plain text
546 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
547 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
548 msgid ""
549 "If the I<sigmask> argument is specified as NULL, then no signal mask "
550 "manipulation is performed (and thus B<ppoll>() differs from B<poll>() only "
551 "in the precision of the I<timeout> argument)."
552 msgstr ""
553
554 #. type: Plain text
555 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
556 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
557 msgid ""
558 "The I<tmo_p> argument specifies an upper limit on the amount of time that "
559 "B<ppoll>() will block. This argument is a pointer to a B<timespec>(3) "
560 "structure."
561 msgstr ""
562
563 #. type: Plain text
564 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
565 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
566 msgid ""
567 "If I<tmo_p> is specified as NULL, then B<ppoll>() can block indefinitely."
568 msgstr ""
569
570 #. type: SH
571 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
572 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
573 #, no-wrap
574 msgid "RETURN VALUE"
575 msgstr "VALOR DE RETORNO"
576
577 #. type: Plain text
578 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
579 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
580 msgid ""
581 "On success, B<poll>() returns a nonnegative value which is the number of "
582 "elements in the I<pollfds> whose I<revents> fields have been set to a "
583 "nonzero value (indicating an event or an error). A return value of zero "
584 "indicates that the system call timed out before any file descriptors became "
585 "ready."
586 msgstr ""
587
588 #. type: Plain text
589 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
590 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
591 #, fuzzy
592 #| msgid ""
593 #| "On success, zero is returned. On error, -1 is returned, and I<errno> is "
594 #| "set appropriately."
595 msgid "On error, -1 is returned, and I<errno> is set to indicate the error."
596 msgstr ""
597 "Em caso de sucesso, zero é retornado. Caso contrário, -1 é retornado, e "
598 "I<errno> é selecionado adequadamente."
599
600 #. type: SH
601 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
602 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
603 #, no-wrap
604 msgid "ERRORS"
605 msgstr "ERROS"
606
607 #. type: TP
608 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
609 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
610 #, no-wrap
611 msgid "B<EFAULT>"
612 msgstr "B<EFAULT>"
613
614 #. type: Plain text
615 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
616 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
617 #, fuzzy
618 #| msgid ""
619 #| "The array given as argument was not contained in the calling program's "
620 #| "address space."
621 msgid ""
622 "I<fds> points outside the process's accessible address space. The array "
623 "given as argument was not contained in the calling program's address space."
624 msgstr ""
625 "O array fornecido com argumento não foi contida no espaço de endereços do "
626 "programa solicitante."
627
628 #. type: TP
629 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
630 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
631 #, no-wrap
632 msgid "B<EINTR>"
633 msgstr "B<EINTR>"
634
635 #. type: Plain text
636 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
637 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
638 #, fuzzy
639 #| msgid "A signal occurred before any requested event."
640 msgid "A signal occurred before any requested event; see B<signal>(7)."
641 msgstr "Um sinal ocorreu antes de qualquer evento requisitado."
642
643 #. type: TP
644 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
645 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
646 #, no-wrap
647 msgid "B<EINVAL>"
648 msgstr "B<EINVAL>"
649
650 #. type: Plain text
651 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
652 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
653 msgid "The I<nfds> value exceeds the B<RLIMIT_NOFILE> value."
654 msgstr ""
655
656 #. type: Plain text
657 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
658 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
659 msgid ""
660 "(B<ppoll>()) The timeout value expressed in I<*tmo_p> is invalid (negative)."
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<ENOMEM>"
668 msgstr "B<ENOMEM>"
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 "Unable to allocate memory for kernel data structures."
674 msgstr ""
675
676 #. type: SH
677 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
678 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
679 #, no-wrap
680 msgid "VERSIONS"
681 msgstr "VERSÕES"
682
683 #. Darwin, according to a report by Jeremy Sequoia, relayed by Josh Triplett
684 #. type: Plain text
685 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
686 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
687 msgid ""
688 "On some other UNIX systems, B<poll>() can fail with the error B<EAGAIN> if "
689 "the system fails to allocate kernel-internal resources, rather than "
690 "B<ENOMEM> as Linux does. POSIX permits this behavior. Portable programs "
691 "may wish to check for B<EAGAIN> and loop, just as with B<EINTR>."
692 msgstr ""
693
694 #. type: Plain text
695 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
696 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
697 msgid ""
698 "Some implementations define the nonstandard constant B<INFTIM> with the "
699 "value -1 for use as a I<timeout> for B<poll>(). This constant is not "
700 "provided in glibc."
701 msgstr ""
702
703 #. type: SS
704 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
705 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
706 #, no-wrap
707 msgid "C library/kernel differences"
708 msgstr "Diferenças entre kernel/biblioteca C"
709
710 #. type: Plain text
711 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
712 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
713 msgid ""
714 "The Linux B<ppoll>() system call modifies its I<tmo_p> argument. However, "
715 "the glibc wrapper function hides this behavior by using a local variable for "
716 "the timeout argument that is passed to the system call. Thus, the glibc "
717 "B<ppoll>() function does not modify its I<tmo_p> argument."
718 msgstr ""
719
720 #. type: Plain text
721 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
722 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
723 msgid ""
724 "The raw B<ppoll>() system call has a fifth argument, I<size_t sigsetsize>, "
725 "which specifies the size in bytes of the I<sigmask> argument. The glibc "
726 "B<ppoll>() wrapper function specifies this argument as a fixed value (equal "
727 "to I<sizeof(kernel_sigset_t)>). See B<sigprocmask>(2) for a discussion on "
728 "the differences between the kernel and the libc notion of the sigset."
729 msgstr ""
730
731 #. type: SH
732 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
733 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
734 #, no-wrap
735 msgid "STANDARDS"
736 msgstr "PADRÕES"
737
738 #. type: Plain text
739 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
740 #: opensuse-tumbleweed
741 msgid "POSIX.1-2024."
742 msgstr "POSIX.1-2024."
743
744 #. type: SH
745 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
746 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
747 #, no-wrap
748 msgid "HISTORY"
749 msgstr "HISTÓRICO"
750
751 #. type: TP
752 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
753 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
754 #, fuzzy, no-wrap
755 #| msgid "B<poll>(2)"
756 msgid "B<poll>()"
757 msgstr "B<poll>(2)"
758
759 #. type: Plain text
760 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
761 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
762 #, fuzzy
763 #| msgid "POSIX.1-2001."
764 msgid "POSIX.1-2001. Linux 2.1.23."
765 msgstr "POSIX.1-2001."
766
767 #. type: Plain text
768 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
769 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
770 #, fuzzy
771 #| msgid ""
772 #| "The poll() systemcall was introduced in Linux 2.1.23. The poll() library "
773 #| "call was introduced in libc 5.4.28 (and provides emulation using select "
774 #| "if your kernel does not have a poll syscall)."
775 msgid ""
776 "On older kernels that lack this system call, the glibc B<poll>() wrapper "
777 "function provides emulation using B<select>(2)."
778 msgstr ""
779 "Esta chamada de sistema foi introduzida no Linux 2.1.23. E a biblioteca foi "
780 "introduzida na libc 5.4.28 (e fornecida emulação usando-se select se o seu "
781 "kernel não tinha a chamada de sistema poll)."
782
783 #. type: TP
784 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
785 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
786 #, fuzzy, no-wrap
787 #| msgid "B<poll>(2)"
788 msgid "B<ppoll>()"
789 msgstr "B<poll>(2)"
790
791 #. type: Plain text
792 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
793 #: opensuse-tumbleweed
794 #, fuzzy
795 #| msgid "POSIX.1-2001."
796 msgid "POSIX.1-2024. Linux 2.6.16, glibc 2.4."
797 msgstr "POSIX.1-2001."
798
799 #. type: SH
800 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
801 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
802 #, no-wrap
803 msgid "NOTES"
804 msgstr "NOTAS"
805
806 #. type: Plain text
807 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
808 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
809 msgid ""
810 "The operation of B<poll>() and B<ppoll>() is not affected by the "
811 "B<O_NONBLOCK> flag."
812 msgstr ""
813
814 #. type: Plain text
815 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
816 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
817 msgid ""
818 "For a discussion of what may happen if a file descriptor being monitored by "
819 "B<poll>() is closed in another thread, see B<select>(2)."
820 msgstr ""
821
822 #. type: SH
823 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
824 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
825 #, no-wrap
826 msgid "BUGS"
827 msgstr "BUGS"
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 "See the discussion of spurious readiness notifications under the BUGS "
834 "section of B<select>(2)."
835 msgstr ""
836
837 #. type: SH
838 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
839 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
840 #, no-wrap
841 msgid "EXAMPLES"
842 msgstr "EXEMPLOS"
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 "The program below opens each of the files named in its command-line "
849 "arguments and monitors the resulting file descriptors for readiness to read "
850 "(B<POLLIN>). The program loops, repeatedly using B<poll>() to monitor the "
851 "file descriptors, printing the number of ready file descriptors on return. "
852 "For each ready file descriptor, the program:"
853 msgstr ""
854
855 #. type: Plain text
856 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
857 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
858 msgid "displays the returned I<revents> field in a human-readable form;"
859 msgstr ""
860
861 #. type: Plain text
862 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
863 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
864 msgid ""
865 "if the file descriptor is readable, reads some data from it, and displays "
866 "that data on standard output; and"
867 msgstr ""
868
869 #. type: Plain text
870 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
871 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
872 msgid ""
873 "if the file descriptor was not readable, but some other event occurred "
874 "(presumably B<POLLHUP>), closes the file descriptor."
875 msgstr ""
876
877 #. type: Plain text
878 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
879 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
880 msgid "Suppose we run the program in one terminal, asking it to open a FIFO:"
881 msgstr ""
882
883 #. type: Plain text
884 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
885 #: opensuse-tumbleweed
886 #, fuzzy, no-wrap
887 #| msgid ""
888 #| "$ B<mkfifo myfifo>\n"
889 #| "$ B<./poll_input myfifo>\n"
890 msgid ""
891 "$B< mkfifo myfifo>;\n"
892 "$B< ./poll_input myfifo>;\n"
893 msgstr ""
894 "$ B<mkfifo myfifo>\n"
895 "$ B<./poll_input myfifo>\n"
896
897 #. type: Plain text
898 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
899 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
900 msgid ""
901 "In a second terminal window, we then open the FIFO for writing, write some "
902 "data to it, and close the FIFO:"
903 msgstr ""
904
905 #. type: Plain text
906 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
907 #: opensuse-tumbleweed
908 #, fuzzy, no-wrap
909 #| msgid "$ B<echo aaaaabbbbbccccc E<gt> myfifo>\n"
910 msgid "$B< echo aaaaabbbbbccccc E<gt> myfifo>;\n"
911 msgstr "$ B<echo aaaaabbbbbccccc E<gt> myfifo>\n"
912
913 #. type: Plain text
914 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
915 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
916 msgid "In the terminal where we are running the program, we would then see:"
917 msgstr ""
918
919 #. type: Plain text
920 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
921 #: opensuse-tumbleweed
922 #, no-wrap
923 msgid ""
924 "Opened \"myfifo\" on fd 3\n"
925 "About to poll()\n"
926 "Ready: 1\n"
927 " fd=3; events: POLLIN POLLHUP\n"
928 " read 10 bytes: aaaaabbbbb\n"
929 "About to poll()\n"
930 "Ready: 1\n"
931 " fd=3; events: POLLIN POLLHUP\n"
932 " read 6 bytes: ccccc\n"
933 "\\&\n"
934 "About to poll()\n"
935 "Ready: 1\n"
936 " fd=3; events: POLLHUP\n"
937 " closing fd 3\n"
938 "All file descriptors closed. Bye.\n"
939 msgstr ""
940
941 #. type: Plain text
942 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
943 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
944 msgid "In the above output, we see that B<poll>() returned three times:"
945 msgstr ""
946
947 #. type: Plain text
948 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
949 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
950 msgid ""
951 "On the first return, the bits returned in the I<revents> field were "
952 "B<POLLIN>, indicating that the file descriptor is readable, and B<POLLHUP>, "
953 "indicating that the other end of the FIFO has been closed. The program then "
954 "consumed some of the available input."
955 msgstr ""
956
957 #. type: Plain text
958 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
959 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
960 msgid ""
961 "The second return from B<poll>() also indicated B<POLLIN> and B<POLLHUP>; "
962 "the program then consumed the last of the available input."
963 msgstr ""
964
965 #. type: Plain text
966 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
967 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
968 msgid ""
969 "On the final return, B<poll>() indicated only B<POLLHUP> on the FIFO, at "
970 "which point the file descriptor was closed and the program terminated."
971 msgstr ""
972
973 #. type: SS
974 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
975 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
976 #, no-wrap
977 msgid "Program source"
978 msgstr "Fonte do programa"
979
980 #. type: Plain text
981 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
982 #: opensuse-tumbleweed
983 #, no-wrap
984 msgid ""
985 "/* poll_input.c\n"
986 "\\&\n"
987 " Licensed under GNU General Public License v2 or later.\n"
988 "*/\n"
989 "#include E<lt>err.hE<gt>\n"
990 "#include E<lt>fcntl.hE<gt>\n"
991 "#include E<lt>poll.hE<gt>\n"
992 "#include E<lt>stdio.hE<gt>\n"
993 "#include E<lt>stdlib.hE<gt>\n"
994 "#include E<lt>sys/types.hE<gt>\n"
995 "#include E<lt>unistd.hE<gt>\n"
996 "\\&\n"
997 "int\n"
998 "main(int argc, char *argv[])\n"
999 "{\n"
1000 " int ready;\n"
1001 " char buf[10];\n"
1002 " nfds_t num_open_fds, nfds;\n"
1003 " ssize_t s;\n"
1004 " struct pollfd *pfds;\n"
1005 "\\&\n"
1006 " if (argc E<lt> 2) {\n"
1007 " fprintf(stderr, \"Usage: %s file...\\[rs]n\", argv[0]);\n"
1008 " exit(EXIT_FAILURE);\n"
1009 " }\n"
1010 "\\&\n"
1011 " num_open_fds = nfds = argc - 1;\n"
1012 " pfds = calloc(nfds, sizeof(struct pollfd));\n"
1013 " if (pfds == NULL)\n"
1014 " err(EXIT_FAILURE, \"malloc\");\n"
1015 "\\&\n"
1016 " /* Open each file on command line, and add it to \\[aq]pfds\\[aq] array. */\n"
1017 "\\&\n"
1018 " for (nfds_t j = 0; j E<lt> nfds; j++) {\n"
1019 " pfds[j].fd = open(argv[j + 1], O_RDONLY);\n"
1020 " if (pfds[j].fd == -1)\n"
1021 " err(EXIT_FAILURE, \"open\");\n"
1022 "\\&\n"
1023 " printf(\"Opened \\[rs]\"%s\\[rs]\" on fd %d\\[rs]n\", argv[j + 1], pfds[j].fd);\n"
1024 "\\&\n"
1025 " pfds[j].events = POLLIN;\n"
1026 " }\n"
1027 "\\&\n"
1028 " /* Keep calling poll() as long as at least one file descriptor is\n"
1029 " open. */\n"
1030 "\\&\n"
1031 " while (num_open_fds E<gt> 0) {\n"
1032 " printf(\"About to poll()\\[rs]n\");\n"
1033 " ready = poll(pfds, nfds, -1);\n"
1034 " if (ready == -1)\n"
1035 " err(EXIT_FAILURE, \"poll\");\n"
1036 "\\&\n"
1037 " printf(\"Ready: %d\\[rs]n\", ready);\n"
1038 "\\&\n"
1039 " /* Deal with array returned by poll(). */\n"
1040 "\\&\n"
1041 " for (nfds_t j = 0; j E<lt> nfds; j++) {\n"
1042 " if (pfds[j].revents != 0) {\n"
1043 " printf(\" fd=%d; events: %s%s%s\\[rs]n\", pfds[j].fd,\n"
1044 " (pfds[j].revents & POLLIN) ? \"POLLIN \" : \"\",\n"
1045 " (pfds[j].revents & POLLHUP) ? \"POLLHUP \" : \"\",\n"
1046 " (pfds[j].revents & POLLERR) ? \"POLLERR \" : \"\");\n"
1047 "\\&\n"
1048 " if (pfds[j].revents & POLLIN) {\n"
1049 " s = read(pfds[j].fd, buf, sizeof(buf));\n"
1050 " if (s == -1)\n"
1051 " err(EXIT_FAILURE, \"read\");\n"
1052 " printf(\" read %zd bytes: %.*s\\[rs]n\",\n"
1053 " s, (int) s, buf);\n"
1054 " } else { /* POLLERR | POLLHUP */\n"
1055 " printf(\" closing fd %d\\[rs]n\", pfds[j].fd);\n"
1056 " if (close(pfds[j].fd) == -1)\n"
1057 " err(EXIT_FAILURE, \"close\");\n"
1058 " num_open_fds--;\n"
1059 " }\n"
1060 " }\n"
1061 " }\n"
1062 " }\n"
1063 "\\&\n"
1064 " printf(\"All file descriptors closed. Bye.\\[rs]n\");\n"
1065 " exit(EXIT_SUCCESS);\n"
1066 "}\n"
1067 msgstr ""
1068
1069 #. SRC END
1070 #. type: SH
1071 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1072 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1073 #, no-wrap
1074 msgid "SEE ALSO"
1075 msgstr "VEJA TAMBÉM"
1076
1077 #. type: Plain text
1078 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1079 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1080 #, fuzzy
1081 #| msgid ""
1082 #| "B<restart_syscall>(2), B<select>(2), B<select_tut>(2), B<epoll>(7), "
1083 #| "B<time>(7)"
1084 msgid ""
1085 "B<restart_syscall>(2), B<select>(2), B<select_tut>(2), B<timespec>(3), "
1086 "B<epoll>(7), B<time>(7)"
1087 msgstr ""
1088 "B<restart_syscall>(2), B<select>(2), B<select_tut>(2), B<epoll>(7), "
1089 "B<time>(7)"
1090
1091 #. type: TH
1092 #: debian-trixie
1093 #, no-wrap
1094 msgid "2024-06-15"
1095 msgstr "15 junho 2024"
1096
1097 #. type: TH
1098 #: debian-trixie
1099 #, no-wrap
1100 msgid "Linux man-pages 6.9.1"
1101 msgstr "Linux man-pages 6.9.1"
1102
1103 #. type: Plain text
1104 #: debian-trixie
1105 msgid "Standard C library (I<libc>, I<-lc>)"
1106 msgstr "Biblioteca C Padrão (I<libc>, I<-lc>)"
1107
1108 #. type: Plain text
1109 #: debian-trixie fedora-44 fedora-rawhide
1110 msgid "POSIX.1-2008."
1111 msgstr "POSIX.1-2008."
1112
1113 #. FIXME .
1114 #. ppoll() is proposed for inclusion in POSIX:
1115 #. https://www.austingroupbugs.net/view.php?id=1263
1116 #. NetBSD 3.0 has a pollts() which is like Linux ppoll().
1117 #. type: Plain text
1118 #: debian-trixie fedora-44 fedora-rawhide
1119 msgid "Linux."
1120 msgstr "Linux."
1121
1122 #. type: Plain text
1123 #: debian-trixie fedora-44 fedora-rawhide
1124 msgid "Linux 2.6.16, glibc 2.4."
1125 msgstr "Linux 2.6.16, glibc 2.4."
1126
1127 #. type: Plain text
1128 #: debian-trixie fedora-44 fedora-rawhide
1129 #, no-wrap
1130 msgid ""
1131 "$ B<mkfifo myfifo>\n"
1132 "$ B<./poll_input myfifo>\n"
1133 msgstr ""
1134 "$ B<mkfifo myfifo>\n"
1135 "$ B<./poll_input myfifo>\n"
1136
1137 #. type: Plain text
1138 #: debian-trixie fedora-44 fedora-rawhide
1139 #, no-wrap
1140 msgid "$ B<echo aaaaabbbbbccccc E<gt> myfifo>\n"
1141 msgstr "$ B<echo aaaaabbbbbccccc E<gt> myfifo>\n"
1142
1143 #. type: Plain text
1144 #: debian-trixie fedora-44 fedora-rawhide
1145 #, no-wrap
1146 msgid ""
1147 "Opened \"myfifo\" on fd 3\n"
1148 "About to poll()\n"
1149 "Ready: 1\n"
1150 " fd=3; events: POLLIN POLLHUP\n"
1151 " read 10 bytes: aaaaabbbbb\n"
1152 "About to poll()\n"
1153 "Ready: 1\n"
1154 " fd=3; events: POLLIN POLLHUP\n"
1155 " read 6 bytes: ccccc\n"
1156 "\\&\n"
1157 "About to poll()\n"
1158 "Ready: 1\n"
1159 " fd=3; events: POLLHUP\n"
1160 " closing fd 3\n"
1161 "All file descriptors closed; bye\n"
1162 msgstr ""
1163
1164 #. type: Plain text
1165 #: debian-trixie fedora-44 fedora-rawhide
1166 #, no-wrap
1167 msgid ""
1168 "/* poll_input.c\n"
1169 "\\&\n"
1170 " Licensed under GNU General Public License v2 or later.\n"
1171 "*/\n"
1172 "#include E<lt>fcntl.hE<gt>\n"
1173 "#include E<lt>poll.hE<gt>\n"
1174 "#include E<lt>stdio.hE<gt>\n"
1175 "#include E<lt>stdlib.hE<gt>\n"
1176 "#include E<lt>sys/types.hE<gt>\n"
1177 "#include E<lt>unistd.hE<gt>\n"
1178 "\\&\n"
1179 "#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\[rs]\n"
1180 " } while (0)\n"
1181 "\\&\n"
1182 "int\n"
1183 "main(int argc, char *argv[])\n"
1184 "{\n"
1185 " int ready;\n"
1186 " char buf[10];\n"
1187 " nfds_t num_open_fds, nfds;\n"
1188 " ssize_t s;\n"
1189 " struct pollfd *pfds;\n"
1190 "\\&\n"
1191 " if (argc E<lt> 2) {\n"
1192 " fprintf(stderr, \"Usage: %s file...\\[rs]n\", argv[0]);\n"
1193 " exit(EXIT_FAILURE);\n"
1194 " }\n"
1195 "\\&\n"
1196 " num_open_fds = nfds = argc - 1;\n"
1197 " pfds = calloc(nfds, sizeof(struct pollfd));\n"
1198 " if (pfds == NULL)\n"
1199 " errExit(\"malloc\");\n"
1200 "\\&\n"
1201 " /* Open each file on command line, and add it to \\[aq]pfds\\[aq] array. */\n"
1202 "\\&\n"
1203 " for (nfds_t j = 0; j E<lt> nfds; j++) {\n"
1204 " pfds[j].fd = open(argv[j + 1], O_RDONLY);\n"
1205 " if (pfds[j].fd == -1)\n"
1206 " errExit(\"open\");\n"
1207 "\\&\n"
1208 " printf(\"Opened \\[rs]\"%s\\[rs]\" on fd %d\\[rs]n\", argv[j + 1], pfds[j].fd);\n"
1209 "\\&\n"
1210 " pfds[j].events = POLLIN;\n"
1211 " }\n"
1212 "\\&\n"
1213 " /* Keep calling poll() as long as at least one file descriptor is\n"
1214 " open. */\n"
1215 "\\&\n"
1216 " while (num_open_fds E<gt> 0) {\n"
1217 " printf(\"About to poll()\\[rs]n\");\n"
1218 " ready = poll(pfds, nfds, -1);\n"
1219 " if (ready == -1)\n"
1220 " errExit(\"poll\");\n"
1221 "\\&\n"
1222 " printf(\"Ready: %d\\[rs]n\", ready);\n"
1223 "\\&\n"
1224 " /* Deal with array returned by poll(). */\n"
1225 "\\&\n"
1226 " for (nfds_t j = 0; j E<lt> nfds; j++) {\n"
1227 " if (pfds[j].revents != 0) {\n"
1228 " printf(\" fd=%d; events: %s%s%s\\[rs]n\", pfds[j].fd,\n"
1229 " (pfds[j].revents & POLLIN) ? \"POLLIN \" : \"\",\n"
1230 " (pfds[j].revents & POLLHUP) ? \"POLLHUP \" : \"\",\n"
1231 " (pfds[j].revents & POLLERR) ? \"POLLERR \" : \"\");\n"
1232 "\\&\n"
1233 " if (pfds[j].revents & POLLIN) {\n"
1234 " s = read(pfds[j].fd, buf, sizeof(buf));\n"
1235 " if (s == -1)\n"
1236 " errExit(\"read\");\n"
1237 " printf(\" read %zd bytes: %.*s\\[rs]n\",\n"
1238 " s, (int) s, buf);\n"
1239 " } else { /* POLLERR | POLLHUP */\n"
1240 " printf(\" closing fd %d\\[rs]n\", pfds[j].fd);\n"
1241 " if (close(pfds[j].fd) == -1)\n"
1242 " errExit(\"close\");\n"
1243 " num_open_fds--;\n"
1244 " }\n"
1245 " }\n"
1246 " }\n"
1247 " }\n"
1248 "\\&\n"
1249 " printf(\"All file descriptors closed; bye\\[rs]n\");\n"
1250 " exit(EXIT_SUCCESS);\n"
1251 "}\n"
1252 msgstr ""
1253
1254 #. type: TH
1255 #: fedora-44 fedora-rawhide
1256 #, no-wrap
1257 msgid "2024-07-23"
1258 msgstr "23 julho 2024"
1259
1260 #. type: TH
1261 #: fedora-44 fedora-rawhide
1262 #, no-wrap
1263 msgid "Linux man-pages 6.13"
1264 msgstr "Linux man-pages 6.13"
1265
1266 #. type: TH
1267 #: mageia-cauldron
1268 #, no-wrap
1269 msgid "Linux man-pages 6.17"
1270 msgstr "Linux man-pages 6.17"
1271
1272 #. type: TH
1273 #: opensuse-leap-16-1 opensuse-tumbleweed
1274 #, no-wrap
1275 msgid "Linux man-pages (unreleased)"
1276 msgstr "Linux man-pages (não lançado)"