Debian Codegraph @

templates/man7/aio.7.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:17+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 "AIO"
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 "aio - POSIX asynchronous I/O overview"
50 msgstr ""
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "DESCRIPTION"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
61 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
62 msgid ""
63 "The POSIX asynchronous I/O (AIO) interface allows applications to initiate "
64 "one or more I/O operations that are performed asynchronously (i.e., in the "
65 "background). The application can elect to be notified of completion of the "
66 "I/O operation in a variety of ways: by delivery of a signal, by "
67 "instantiation of a thread, or no notification at all."
68 msgstr ""
69
70 #. type: Plain text
71 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
72 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
73 msgid "The POSIX AIO interface consists of the following functions:"
74 msgstr ""
75
76 #. type: TP
77 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
78 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
79 #, no-wrap
80 msgid "B<aio_read>(3)"
81 msgstr ""
82
83 #. type: Plain text
84 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
85 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
86 msgid "Enqueue a read request. This is the asynchronous analog of B<read>(2)."
87 msgstr ""
88
89 #. type: TP
90 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
91 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
92 #, no-wrap
93 msgid "B<aio_write>(3)"
94 msgstr ""
95
96 #. type: Plain text
97 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
98 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
99 msgid ""
100 "Enqueue a write request. This is the asynchronous analog of B<write>(2)."
101 msgstr ""
102
103 #. type: TP
104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
106 #, no-wrap
107 msgid "B<aio_fsync>(3)"
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 msgid ""
114 "Enqueue a sync request for the I/O operations on a file descriptor. This is "
115 "the asynchronous analog of B<fsync>(2) and B<fdatasync>(2)."
116 msgstr ""
117
118 #. type: TP
119 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
120 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
121 #, no-wrap
122 msgid "B<aio_error>(3)"
123 msgstr ""
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 "Obtain the error status of an enqueued I/O request."
129 msgstr ""
130
131 #. type: TP
132 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
133 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
134 #, no-wrap
135 msgid "B<aio_return>(3)"
136 msgstr ""
137
138 #. type: Plain text
139 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
140 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
141 msgid "Obtain the return status of a completed I/O request."
142 msgstr ""
143
144 #. type: TP
145 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
146 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
147 #, no-wrap
148 msgid "B<aio_suspend>(3)"
149 msgstr ""
150
151 #. type: Plain text
152 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
153 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
154 msgid ""
155 "Suspend the caller until one or more of a specified set of I/O requests "
156 "completes."
157 msgstr ""
158
159 #. type: TP
160 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
161 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
162 #, no-wrap
163 msgid "B<aio_cancel>(3)"
164 msgstr ""
165
166 #. type: Plain text
167 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
168 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
169 msgid ""
170 "Attempt to cancel outstanding I/O requests on a specified file descriptor."
171 msgstr ""
172
173 #. type: TP
174 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
175 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
176 #, no-wrap
177 msgid "B<lio_listio>(3)"
178 msgstr ""
179
180 #. type: Plain text
181 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
182 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
183 msgid "Enqueue multiple I/O requests using a single function call."
184 msgstr ""
185
186 #. type: Plain text
187 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
188 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
189 msgid ""
190 "The I<aiocb> (\"asynchronous I/O control block\") structure defines "
191 "parameters that control an I/O operation. An argument of this type is "
192 "employed with all of the functions listed above. This structure has the "
193 "following form:"
194 msgstr ""
195
196 #. type: Plain text
197 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
198 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
199 #, no-wrap
200 msgid ""
201 "#include E<lt>aiocb.hE<gt>\n"
202 "\\&\n"
203 "struct aiocb {\n"
204 " /* The order of these fields is implementation-dependent */\n"
205 "\\&\n"
206 " int aio_fildes; /* File descriptor */\n"
207 " off_t aio_offset; /* File offset */\n"
208 " volatile void *aio_buf; /* Location of buffer */\n"
209 " size_t aio_nbytes; /* Length of transfer */\n"
210 " int aio_reqprio; /* Request priority */\n"
211 " struct sigevent aio_sigevent; /* Notification method */\n"
212 " int aio_lio_opcode; /* Operation to be performed;\n"
213 " lio_listio() only */\n"
214 "\\&\n"
215 " /* Various implementation-internal fields not shown */\n"
216 "};\n"
217 "\\&\n"
218 "/* Operation codes for \\[aq]aio_lio_opcode\\[aq]: */\n"
219 "\\&\n"
220 "enum { LIO_READ, LIO_WRITE, LIO_NOP };\n"
221 msgstr ""
222
223 #. type: Plain text
224 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
225 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
226 msgid "The fields of this structure are as follows:"
227 msgstr ""
228
229 #. type: TP
230 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
231 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
232 #, no-wrap
233 msgid "I<aio_fildes>"
234 msgstr ""
235
236 #. type: Plain text
237 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
238 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
239 msgid "The file descriptor on which the I/O operation is to be performed."
240 msgstr ""
241
242 #. type: TP
243 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
244 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
245 #, no-wrap
246 msgid "I<aio_offset>"
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 "This is the file offset at which the I/O operation is to be performed."
253 msgstr ""
254
255 #. type: TP
256 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
257 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
258 #, no-wrap
259 msgid "I<aio_buf>"
260 msgstr ""
261
262 #. type: Plain text
263 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
264 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
265 msgid "This is the buffer used to transfer data for a read or write operation."
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 "I<aio_nbytes>"
273 msgstr ""
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 "This is the size of the buffer pointed to by I<aio_buf>."
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 "I<aio_reqprio>"
286 msgstr ""
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 "This field specifies a value that is subtracted from the calling thread's "
293 "real-time priority in order to determine the priority for execution of this "
294 "I/O request (see B<pthread_setschedparam>(3)). The specified value must be "
295 "between 0 and the value returned by I<sysconf(_SC_AIO_PRIO_DELTA_MAX)>. "
296 "This field is ignored for file synchronization operations."
297 msgstr ""
298
299 #. type: TP
300 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
301 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
302 #, no-wrap
303 msgid "I<aio_sigevent>"
304 msgstr ""
305
306 #. type: Plain text
307 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
308 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
309 msgid ""
310 "This field is a structure that specifies how the caller is to be notified "
311 "when the asynchronous I/O operation completes. Possible values for "
312 "I<aio_sigevent.sigev_notify> are B<SIGEV_NONE>, B<SIGEV_SIGNAL>, and "
313 "B<SIGEV_THREAD>. See B<sigevent>(3type) for further details."
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 "I<aio_lio_opcode>"
321 msgstr ""
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 "The type of operation to be performed; used only for B<lio_listio>(3)."
327 msgstr ""
328
329 #. type: Plain text
330 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
331 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
332 msgid ""
333 "In addition to the standard functions listed above, the GNU C library "
334 "provides the following extension to the POSIX AIO API:"
335 msgstr ""
336
337 #. type: TP
338 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
339 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
340 #, no-wrap
341 msgid "B<aio_init>(3)"
342 msgstr ""
343
344 #. type: Plain text
345 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
346 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
347 msgid ""
348 "Set parameters for tuning the behavior of the glibc POSIX AIO implementation."
349 msgstr ""
350
351 #. type: SH
352 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
353 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
354 #, no-wrap
355 msgid "ERRORS"
356 msgstr ""
357
358 #. type: TP
359 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
360 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
361 #, no-wrap
362 msgid "B<EINVAL>"
363 msgstr ""
364
365 #. type: Plain text
366 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
367 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
368 msgid ""
369 "The I<aio_reqprio> field of the I<aiocb> structure was less than 0, or was "
370 "greater than the limit returned by the call "
371 "I<sysconf(_SC_AIO_PRIO_DELTA_MAX)>."
372 msgstr ""
373
374 #. type: SH
375 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
376 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
377 #, no-wrap
378 msgid "STANDARDS"
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 "POSIX.1-2008."
385 msgstr ""
386
387 #. type: SH
388 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
389 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
390 #, no-wrap
391 msgid "HISTORY"
392 msgstr ""
393
394 #. type: Plain text
395 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
396 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
397 msgid "POSIX.1-2001. glibc 2.1."
398 msgstr ""
399
400 #. type: SH
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 #, no-wrap
404 msgid "NOTES"
405 msgstr ""
406
407 #. type: Plain text
408 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
409 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
410 msgid ""
411 "It is a good idea to zero out the control block buffer before use (see "
412 "B<memset>(3)). The control block buffer and the buffer pointed to by "
413 "I<aio_buf> must not be changed while the I/O operation is in progress. "
414 "These buffers must remain valid until the I/O operation completes."
415 msgstr ""
416
417 #. type: Plain text
418 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
419 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
420 msgid ""
421 "Simultaneous asynchronous read or write operations using the same I<aiocb> "
422 "structure yield undefined results."
423 msgstr ""
424
425 #. http://lse.sourceforge.net/io/aio.html
426 #. http://lse.sourceforge.net/io/aionotes.txt
427 #. http://lwn.net/Articles/148755/
428 #. type: Plain text
429 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
430 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
431 msgid ""
432 "The current Linux POSIX AIO implementation is provided in user space by "
433 "glibc. This has a number of limitations, most notably that maintaining "
434 "multiple threads to perform I/O operations is expensive and scales poorly. "
435 "Work has been in progress for some time on a kernel state-machine-based "
436 "implementation of asynchronous I/O (see B<io_submit>(2), B<io_setup>(2), "
437 "B<io_cancel>(2), B<io_destroy>(2), B<io_getevents>(2)), but this "
438 "implementation hasn't yet matured to the point where the POSIX AIO "
439 "implementation can be completely reimplemented using the kernel system calls."
440 msgstr ""
441
442 #. type: SH
443 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
444 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
445 #, no-wrap
446 msgid "EXAMPLES"
447 msgstr ""
448
449 #. type: Plain text
450 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
451 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
452 msgid ""
453 "The program below opens each of the files named in its command-line "
454 "arguments and queues a request on the resulting file descriptor using "
455 "B<aio_read>(3). The program then loops, periodically monitoring each of the "
456 "I/O operations that is still in progress using B<aio_error>(3). Each of the "
457 "I/O requests is set up to provide notification by delivery of a signal. "
458 "After all I/O requests have completed, the program retrieves their status "
459 "using B<aio_return>(3)."
460 msgstr ""
461
462 #. type: Plain text
463 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
464 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
465 msgid ""
466 "The B<SIGQUIT> signal (generated by typing control-\\[rs]) causes the "
467 "program to request cancelation of each of the outstanding requests using "
468 "B<aio_cancel>(3)."
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 "Here is an example of what we might see when running this program. In this "
476 "example, the program queues two requests to standard input, and these are "
477 "satisfied by two lines of input containing \"abc\" and \"x\"."
478 msgstr ""
479
480 #. type: Plain text
481 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
482 #: opensuse-tumbleweed
483 #, no-wrap
484 msgid ""
485 "$B< ./a.out /dev/stdin /dev/stdin>;\n"
486 "opened /dev/stdin on descriptor 3\n"
487 "opened /dev/stdin on descriptor 4\n"
488 "aio_error():\n"
489 " for request 0 (descriptor 3): In progress\n"
490 " for request 1 (descriptor 4): In progress\n"
491 "B<abc>\n"
492 "I/O completion signal received\n"
493 "aio_error():\n"
494 " for request 0 (descriptor 3): I/O succeeded\n"
495 " for request 1 (descriptor 4): In progress\n"
496 "aio_error():\n"
497 " for request 1 (descriptor 4): In progress\n"
498 "B<x>\n"
499 "I/O completion signal received\n"
500 "aio_error():\n"
501 " for request 1 (descriptor 4): I/O succeeded\n"
502 "All I/O requests completed\n"
503 "aio_return():\n"
504 " for request 0 (descriptor 3): 4\n"
505 " for request 1 (descriptor 4): 2\n"
506 msgstr ""
507
508 #. type: SS
509 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
510 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
511 #, no-wrap
512 msgid "Program source"
513 msgstr ""
514
515 #. type: Plain text
516 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
517 #: opensuse-tumbleweed
518 #, no-wrap
519 msgid ""
520 "#include E<lt>err.hE<gt>\n"
521 "#include E<lt>fcntl.hE<gt>\n"
522 "#include E<lt>stdlib.hE<gt>\n"
523 "#include E<lt>unistd.hE<gt>\n"
524 "#include E<lt>stdio.hE<gt>\n"
525 "#include E<lt>errno.hE<gt>\n"
526 "#include E<lt>aio.hE<gt>\n"
527 "#include E<lt>signal.hE<gt>\n"
528 "\\&\n"
529 "#define BUF_SIZE 20 /* Size of buffers for read operations */\n"
530 "\\&\n"
531 "struct ioRequest { /* Application-defined structure for tracking\n"
532 " I/O requests */\n"
533 " int reqNum;\n"
534 " int status;\n"
535 " struct aiocb *aiocbp;\n"
536 "};\n"
537 "\\&\n"
538 "static volatile sig_atomic_t gotSIGQUIT = 0;\n"
539 " /* On delivery of SIGQUIT, we attempt to\n"
540 " cancel all outstanding I/O requests */\n"
541 "\\&\n"
542 "static void /* Handler for SIGQUIT */\n"
543 "quitHandler(int sig)\n"
544 "{\n"
545 " gotSIGQUIT = 1;\n"
546 "}\n"
547 "\\&\n"
548 "#define IO_SIGNAL SIGUSR1 /* Signal used to notify I/O completion */\n"
549 "\\&\n"
550 "static void /* Handler for I/O completion signal */\n"
551 "aioSigHandler(int sig, siginfo_t *si, void *ucontext)\n"
552 "{\n"
553 " if (si-E<gt>si_code == SI_ASYNCIO) {\n"
554 " write(STDOUT_FILENO, \"I/O completion signal received\\[rs]n\", 31);\n"
555 "\\&\n"
556 " /* The corresponding ioRequest structure would be available as\n"
557 " struct ioRequest *ioReq = si-E<gt>si_value.sival_ptr;\n"
558 " and the file descriptor would then be available via\n"
559 " ioReq-E<gt>aiocbp-E<gt>aio_fildes */\n"
560 " }\n"
561 "}\n"
562 "\\&\n"
563 "int\n"
564 "main(int argc, char *argv[])\n"
565 "{\n"
566 " struct sigaction sa;\n"
567 " int s;\n"
568 " int numReqs; /* Total number of queued I/O requests */\n"
569 " int openReqs; /* Number of I/O requests still in progress */\n"
570 "\\&\n"
571 " if (argc E<lt> 2) {\n"
572 " fprintf(stderr, \"Usage: %s E<lt>pathnameE<gt> E<lt>pathnameE<gt>...\\[rs]n\",\n"
573 " argv[0]);\n"
574 " exit(EXIT_FAILURE);\n"
575 " }\n"
576 "\\&\n"
577 " numReqs = argc - 1;\n"
578 "\\&\n"
579 " /* Allocate our arrays. */\n"
580 "\\&\n"
581 " struct ioRequest *ioList = calloc(numReqs, sizeof(*ioList));\n"
582 " if (ioList == NULL)\n"
583 " err(EXIT_FAILURE, \"calloc\");\n"
584 "\\&\n"
585 " struct aiocb *aiocbList = calloc(numReqs, sizeof(*aiocbList));\n"
586 " if (aiocbList == NULL)\n"
587 " err(EXIT_FAILURE, \"calloc\");\n"
588 "\\&\n"
589 " /* Establish handlers for SIGQUIT and the I/O completion signal. */\n"
590 "\\&\n"
591 " sa.sa_flags = SA_RESTART;\n"
592 " sigemptyset(&sa.sa_mask);\n"
593 "\\&\n"
594 " sa.sa_handler = quitHandler;\n"
595 " if (sigaction(SIGQUIT, &sa, NULL) == -1)\n"
596 " err(EXIT_FAILURE, \"sigaction\");\n"
597 "\\&\n"
598 " sa.sa_flags = SA_RESTART | SA_SIGINFO;\n"
599 " sa.sa_sigaction = aioSigHandler;\n"
600 " if (sigaction(IO_SIGNAL, &sa, NULL) == -1)\n"
601 " err(EXIT_FAILURE, \"sigaction\");\n"
602 "\\&\n"
603 " /* Open each file specified on the command line, and queue\n"
604 " a read request on the resulting file descriptor. */\n"
605 "\\&\n"
606 " for (size_t j = 0; j E<lt> numReqs; j++) {\n"
607 " ioList[j].reqNum = j;\n"
608 " ioList[j].status = EINPROGRESS;\n"
609 " ioList[j].aiocbp = &aiocbList[j];\n"
610 "\\&\n"
611 " ioList[j].aiocbp-E<gt>aio_fildes = open(argv[j + 1], O_RDONLY);\n"
612 " if (ioList[j].aiocbp-E<gt>aio_fildes == -1)\n"
613 " err(EXIT_FAILURE, \"open\");\n"
614 " printf(\"opened %s on descriptor %d\\[rs]n\", argv[j + 1],\n"
615 " ioList[j].aiocbp-E<gt>aio_fildes);\n"
616 "\\&\n"
617 " ioList[j].aiocbp-E<gt>aio_buf = malloc(BUF_SIZE);\n"
618 " if (ioList[j].aiocbp-E<gt>aio_buf == NULL)\n"
619 " err(EXIT_FAILURE, \"malloc\");\n"
620 "\\&\n"
621 " ioList[j].aiocbp-E<gt>aio_nbytes = BUF_SIZE;\n"
622 " ioList[j].aiocbp-E<gt>aio_reqprio = 0;\n"
623 " ioList[j].aiocbp-E<gt>aio_offset = 0;\n"
624 " ioList[j].aiocbp-E<gt>aio_sigevent.sigev_notify = SIGEV_SIGNAL;\n"
625 " ioList[j].aiocbp-E<gt>aio_sigevent.sigev_signo = IO_SIGNAL;\n"
626 " ioList[j].aiocbp-E<gt>aio_sigevent.sigev_value.sival_ptr =\n"
627 " &ioList[j];\n"
628 "\\&\n"
629 " s = aio_read(ioList[j].aiocbp);\n"
630 " if (s == -1)\n"
631 " err(EXIT_FAILURE, \"aio_read\");\n"
632 " }\n"
633 "\\&\n"
634 " openReqs = numReqs;\n"
635 "\\&\n"
636 " /* Loop, monitoring status of I/O requests. */\n"
637 "\\&\n"
638 " while (openReqs E<gt> 0) {\n"
639 " sleep(3); /* Delay between each monitoring step */\n"
640 "\\&\n"
641 " if (gotSIGQUIT) {\n"
642 "\\&\n"
643 " /* On receipt of SIGQUIT, attempt to cancel each of the\n"
644 " outstanding I/O requests, and display status returned\n"
645 " from the cancelation requests. */\n"
646 "\\&\n"
647 " printf(\"got SIGQUIT; canceling I/O requests: \\[rs]n\");\n"
648 "\\&\n"
649 " for (size_t j = 0; j E<lt> numReqs; j++) {\n"
650 " if (ioList[j].status == EINPROGRESS) {\n"
651 " printf(\" Request %zu on descriptor %d:\", j,\n"
652 " ioList[j].aiocbp-E<gt>aio_fildes);\n"
653 " s = aio_cancel(ioList[j].aiocbp-E<gt>aio_fildes,\n"
654 " ioList[j].aiocbp);\n"
655 " if (s == AIO_CANCELED)\n"
656 " printf(\"I/O canceled\\[rs]n\");\n"
657 " else if (s == AIO_NOTCANCELED)\n"
658 " printf(\"I/O not canceled\\[rs]n\");\n"
659 " else if (s == AIO_ALLDONE)\n"
660 " printf(\"I/O all done\\[rs]n\");\n"
661 " else\n"
662 " perror(\"aio_cancel\");\n"
663 " }\n"
664 " }\n"
665 "\\&\n"
666 " gotSIGQUIT = 0;\n"
667 " }\n"
668 "\\&\n"
669 " /* Check the status of each I/O request that is still\n"
670 " in progress. */\n"
671 "\\&\n"
672 " printf(\"aio_error():\\[rs]n\");\n"
673 " for (size_t j = 0; j E<lt> numReqs; j++) {\n"
674 " if (ioList[j].status == EINPROGRESS) {\n"
675 " printf(\" for request %zu (descriptor %d): \",\n"
676 " j, ioList[j].aiocbp-E<gt>aio_fildes);\n"
677 " ioList[j].status = aio_error(ioList[j].aiocbp);\n"
678 "\\&\n"
679 " switch (ioList[j].status) {\n"
680 " case 0:\n"
681 " printf(\"I/O succeeded\\[rs]n\");\n"
682 " break;\n"
683 " case EINPROGRESS:\n"
684 " printf(\"In progress\\[rs]n\");\n"
685 " break;\n"
686 " case ECANCELED:\n"
687 " printf(\"Canceled\\[rs]n\");\n"
688 " break;\n"
689 " default:\n"
690 " perror(\"aio_error\");\n"
691 " break;\n"
692 " }\n"
693 "\\&\n"
694 " if (ioList[j].status != EINPROGRESS)\n"
695 " openReqs--;\n"
696 " }\n"
697 " }\n"
698 " }\n"
699 "\\&\n"
700 " printf(\"All I/O requests completed\\[rs]n\");\n"
701 "\\&\n"
702 " /* Check status return of all I/O requests. */\n"
703 "\\&\n"
704 " printf(\"aio_return():\\[rs]n\");\n"
705 " for (size_t j = 0; j E<lt> numReqs; j++) {\n"
706 " ssize_t s;\n"
707 "\\&\n"
708 " s = aio_return(ioList[j].aiocbp);\n"
709 " printf(\" for request %zu (descriptor %d): %zd\\[rs]n\",\n"
710 " j, ioList[j].aiocbp-E<gt>aio_fildes, s);\n"
711 " }\n"
712 "\\&\n"
713 " exit(EXIT_SUCCESS);\n"
714 "}\n"
715 msgstr ""
716
717 #. type: SH
718 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
719 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
720 #, no-wrap
721 msgid "SEE ALSO"
722 msgstr ""
723
724 #. type: Plain text
725 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
726 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
727 msgid ""
728 "B<io_cancel>(2), B<io_destroy>(2), B<io_getevents>(2), B<io_setup>(2), "
729 "B<io_submit>(2), B<aio_cancel>(3), B<aio_error>(3), B<aio_init>(3), "
730 "B<aio_read>(3), B<aio_return>(3), B<aio_write>(3), B<lio_listio>(3)"
731 msgstr ""
732
733 #. type: Plain text
734 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
735 #: opensuse-tumbleweed
736 msgid ""
737 "\"Asynchronous I/O Support in Linux 2.5\", Bhattacharya, Pratt, Pulavarty, "
738 "and Morgan, Proceedings of the Linux Symposium, 2003, E<.UR https:\\://"
739 "www.kernel.org/doc/ols/2003/ols2003-pages-351-366.pdf> E<.UE>"
740 msgstr ""
741
742 #. type: TH
743 #: debian-trixie fedora-44 fedora-rawhide
744 #, no-wrap
745 msgid "2024-06-15"
746 msgstr ""
747
748 #. type: TH
749 #: debian-trixie
750 #, no-wrap
751 msgid "Linux man-pages 6.9.1"
752 msgstr ""
753
754 #. type: Plain text
755 #: debian-trixie fedora-44 fedora-rawhide
756 #, no-wrap
757 msgid ""
758 "$ B<./a.out /dev/stdin /dev/stdin>\n"
759 "opened /dev/stdin on descriptor 3\n"
760 "opened /dev/stdin on descriptor 4\n"
761 "aio_error():\n"
762 " for request 0 (descriptor 3): In progress\n"
763 " for request 1 (descriptor 4): In progress\n"
764 "B<abc>\n"
765 "I/O completion signal received\n"
766 "aio_error():\n"
767 " for request 0 (descriptor 3): I/O succeeded\n"
768 " for request 1 (descriptor 4): In progress\n"
769 "aio_error():\n"
770 " for request 1 (descriptor 4): In progress\n"
771 "B<x>\n"
772 "I/O completion signal received\n"
773 "aio_error():\n"
774 " for request 1 (descriptor 4): I/O succeeded\n"
775 "All I/O requests completed\n"
776 "aio_return():\n"
777 " for request 0 (descriptor 3): 4\n"
778 " for request 1 (descriptor 4): 2\n"
779 msgstr ""
780
781 #. type: Plain text
782 #: debian-trixie fedora-44 fedora-rawhide
783 #, no-wrap
784 msgid ""
785 "#include E<lt>fcntl.hE<gt>\n"
786 "#include E<lt>stdlib.hE<gt>\n"
787 "#include E<lt>unistd.hE<gt>\n"
788 "#include E<lt>stdio.hE<gt>\n"
789 "#include E<lt>errno.hE<gt>\n"
790 "#include E<lt>aio.hE<gt>\n"
791 "#include E<lt>signal.hE<gt>\n"
792 "\\&\n"
793 "#define BUF_SIZE 20 /* Size of buffers for read operations */\n"
794 "\\&\n"
795 "#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
796 "\\&\n"
797 "struct ioRequest { /* Application-defined structure for tracking\n"
798 " I/O requests */\n"
799 " int reqNum;\n"
800 " int status;\n"
801 " struct aiocb *aiocbp;\n"
802 "};\n"
803 "\\&\n"
804 "static volatile sig_atomic_t gotSIGQUIT = 0;\n"
805 " /* On delivery of SIGQUIT, we attempt to\n"
806 " cancel all outstanding I/O requests */\n"
807 "\\&\n"
808 "static void /* Handler for SIGQUIT */\n"
809 "quitHandler(int sig)\n"
810 "{\n"
811 " gotSIGQUIT = 1;\n"
812 "}\n"
813 "\\&\n"
814 "#define IO_SIGNAL SIGUSR1 /* Signal used to notify I/O completion */\n"
815 "\\&\n"
816 "static void /* Handler for I/O completion signal */\n"
817 "aioSigHandler(int sig, siginfo_t *si, void *ucontext)\n"
818 "{\n"
819 " if (si-E<gt>si_code == SI_ASYNCIO) {\n"
820 " write(STDOUT_FILENO, \"I/O completion signal received\\[rs]n\", 31);\n"
821 "\\&\n"
822 " /* The corresponding ioRequest structure would be available as\n"
823 " struct ioRequest *ioReq = si-E<gt>si_value.sival_ptr;\n"
824 " and the file descriptor would then be available via\n"
825 " ioReq-E<gt>aiocbp-E<gt>aio_fildes */\n"
826 " }\n"
827 "}\n"
828 "\\&\n"
829 "int\n"
830 "main(int argc, char *argv[])\n"
831 "{\n"
832 " struct sigaction sa;\n"
833 " int s;\n"
834 " int numReqs; /* Total number of queued I/O requests */\n"
835 " int openReqs; /* Number of I/O requests still in progress */\n"
836 "\\&\n"
837 " if (argc E<lt> 2) {\n"
838 " fprintf(stderr, \"Usage: %s E<lt>pathnameE<gt> E<lt>pathnameE<gt>...\\[rs]n\",\n"
839 " argv[0]);\n"
840 " exit(EXIT_FAILURE);\n"
841 " }\n"
842 "\\&\n"
843 " numReqs = argc - 1;\n"
844 "\\&\n"
845 " /* Allocate our arrays. */\n"
846 "\\&\n"
847 " struct ioRequest *ioList = calloc(numReqs, sizeof(*ioList));\n"
848 " if (ioList == NULL)\n"
849 " errExit(\"calloc\");\n"
850 "\\&\n"
851 " struct aiocb *aiocbList = calloc(numReqs, sizeof(*aiocbList));\n"
852 " if (aiocbList == NULL)\n"
853 " errExit(\"calloc\");\n"
854 "\\&\n"
855 " /* Establish handlers for SIGQUIT and the I/O completion signal. */\n"
856 "\\&\n"
857 " sa.sa_flags = SA_RESTART;\n"
858 " sigemptyset(&sa.sa_mask);\n"
859 "\\&\n"
860 " sa.sa_handler = quitHandler;\n"
861 " if (sigaction(SIGQUIT, &sa, NULL) == -1)\n"
862 " errExit(\"sigaction\");\n"
863 "\\&\n"
864 " sa.sa_flags = SA_RESTART | SA_SIGINFO;\n"
865 " sa.sa_sigaction = aioSigHandler;\n"
866 " if (sigaction(IO_SIGNAL, &sa, NULL) == -1)\n"
867 " errExit(\"sigaction\");\n"
868 "\\&\n"
869 " /* Open each file specified on the command line, and queue\n"
870 " a read request on the resulting file descriptor. */\n"
871 "\\&\n"
872 " for (size_t j = 0; j E<lt> numReqs; j++) {\n"
873 " ioList[j].reqNum = j;\n"
874 " ioList[j].status = EINPROGRESS;\n"
875 " ioList[j].aiocbp = &aiocbList[j];\n"
876 "\\&\n"
877 " ioList[j].aiocbp-E<gt>aio_fildes = open(argv[j + 1], O_RDONLY);\n"
878 " if (ioList[j].aiocbp-E<gt>aio_fildes == -1)\n"
879 " errExit(\"open\");\n"
880 " printf(\"opened %s on descriptor %d\\[rs]n\", argv[j + 1],\n"
881 " ioList[j].aiocbp-E<gt>aio_fildes);\n"
882 "\\&\n"
883 " ioList[j].aiocbp-E<gt>aio_buf = malloc(BUF_SIZE);\n"
884 " if (ioList[j].aiocbp-E<gt>aio_buf == NULL)\n"
885 " errExit(\"malloc\");\n"
886 "\\&\n"
887 " ioList[j].aiocbp-E<gt>aio_nbytes = BUF_SIZE;\n"
888 " ioList[j].aiocbp-E<gt>aio_reqprio = 0;\n"
889 " ioList[j].aiocbp-E<gt>aio_offset = 0;\n"
890 " ioList[j].aiocbp-E<gt>aio_sigevent.sigev_notify = SIGEV_SIGNAL;\n"
891 " ioList[j].aiocbp-E<gt>aio_sigevent.sigev_signo = IO_SIGNAL;\n"
892 " ioList[j].aiocbp-E<gt>aio_sigevent.sigev_value.sival_ptr =\n"
893 " &ioList[j];\n"
894 "\\&\n"
895 " s = aio_read(ioList[j].aiocbp);\n"
896 " if (s == -1)\n"
897 " errExit(\"aio_read\");\n"
898 " }\n"
899 "\\&\n"
900 " openReqs = numReqs;\n"
901 "\\&\n"
902 " /* Loop, monitoring status of I/O requests. */\n"
903 "\\&\n"
904 " while (openReqs E<gt> 0) {\n"
905 " sleep(3); /* Delay between each monitoring step */\n"
906 "\\&\n"
907 " if (gotSIGQUIT) {\n"
908 "\\&\n"
909 " /* On receipt of SIGQUIT, attempt to cancel each of the\n"
910 " outstanding I/O requests, and display status returned\n"
911 " from the cancelation requests. */\n"
912 "\\&\n"
913 " printf(\"got SIGQUIT; canceling I/O requests: \\[rs]n\");\n"
914 "\\&\n"
915 " for (size_t j = 0; j E<lt> numReqs; j++) {\n"
916 " if (ioList[j].status == EINPROGRESS) {\n"
917 " printf(\" Request %zu on descriptor %d:\", j,\n"
918 " ioList[j].aiocbp-E<gt>aio_fildes);\n"
919 " s = aio_cancel(ioList[j].aiocbp-E<gt>aio_fildes,\n"
920 " ioList[j].aiocbp);\n"
921 " if (s == AIO_CANCELED)\n"
922 " printf(\"I/O canceled\\[rs]n\");\n"
923 " else if (s == AIO_NOTCANCELED)\n"
924 " printf(\"I/O not canceled\\[rs]n\");\n"
925 " else if (s == AIO_ALLDONE)\n"
926 " printf(\"I/O all done\\[rs]n\");\n"
927 " else\n"
928 " perror(\"aio_cancel\");\n"
929 " }\n"
930 " }\n"
931 "\\&\n"
932 " gotSIGQUIT = 0;\n"
933 " }\n"
934 "\\&\n"
935 " /* Check the status of each I/O request that is still\n"
936 " in progress. */\n"
937 "\\&\n"
938 " printf(\"aio_error():\\[rs]n\");\n"
939 " for (size_t j = 0; j E<lt> numReqs; j++) {\n"
940 " if (ioList[j].status == EINPROGRESS) {\n"
941 " printf(\" for request %zu (descriptor %d): \",\n"
942 " j, ioList[j].aiocbp-E<gt>aio_fildes);\n"
943 " ioList[j].status = aio_error(ioList[j].aiocbp);\n"
944 "\\&\n"
945 " switch (ioList[j].status) {\n"
946 " case 0:\n"
947 " printf(\"I/O succeeded\\[rs]n\");\n"
948 " break;\n"
949 " case EINPROGRESS:\n"
950 " printf(\"In progress\\[rs]n\");\n"
951 " break;\n"
952 " case ECANCELED:\n"
953 " printf(\"Canceled\\[rs]n\");\n"
954 " break;\n"
955 " default:\n"
956 " perror(\"aio_error\");\n"
957 " break;\n"
958 " }\n"
959 "\\&\n"
960 " if (ioList[j].status != EINPROGRESS)\n"
961 " openReqs--;\n"
962 " }\n"
963 " }\n"
964 " }\n"
965 "\\&\n"
966 " printf(\"All I/O requests completed\\[rs]n\");\n"
967 "\\&\n"
968 " /* Check status return of all I/O requests. */\n"
969 "\\&\n"
970 " printf(\"aio_return():\\[rs]n\");\n"
971 " for (size_t j = 0; j E<lt> numReqs; j++) {\n"
972 " ssize_t s;\n"
973 "\\&\n"
974 " s = aio_return(ioList[j].aiocbp);\n"
975 " printf(\" for request %zu (descriptor %d): %zd\\[rs]n\",\n"
976 " j, ioList[j].aiocbp-E<gt>aio_fildes, s);\n"
977 " }\n"
978 "\\&\n"
979 " exit(EXIT_SUCCESS);\n"
980 "}\n"
981 msgstr ""
982
983 #. type: Plain text
984 #: debian-trixie fedora-44 fedora-rawhide
985 msgid ""
986 "\"Asynchronous I/O Support in Linux 2.5\", Bhattacharya, Pratt, Pulavarty, "
987 "and Morgan, Proceedings of the Linux Symposium, 2003, E<.UR https://"
988 "www.kernel.org/doc/ols/2003/ols2003-pages-351-366.pdf> E<.UE>"
989 msgstr ""
990
991 #. type: TH
992 #: fedora-44 fedora-rawhide
993 #, no-wrap
994 msgid "Linux man-pages 6.13"
995 msgstr ""
996
997 #. type: TH
998 #: mageia-cauldron
999 #, no-wrap
1000 msgid "Linux man-pages 6.17"
1001 msgstr ""
1002
1003 #. type: TH
1004 #: opensuse-leap-16-1 opensuse-tumbleweed
1005 #, no-wrap
1006 msgid "Linux man-pages (unreleased)"
1007 msgstr ""