Debian Codegraph @

templates/man3/getaddrinfo_a.3.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:25+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 "getaddrinfo_a"
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 "getaddrinfo_a, gai_suspend, gai_error, gai_cancel - asynchronous network "
51 "address and service translation"
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 "Asynchronous name lookup library (I<libanl>,\\ I<-lanl>)"
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 ""
79 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
80 "B<#include E<lt>netdb.hE<gt>>\n"
81 msgstr ""
82
83 #. type: Plain text
84 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
85 #: opensuse-tumbleweed
86 #, no-wrap
87 msgid ""
88 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict >I<n>B<],>\n"
89 "B< int >I<n>B<, struct sigevent *restrict >I<sevp>B<);>\n"
90 "B<int gai_suspend(const struct gaicb *const >I<list>B<[>I<n>B<], int >I<n>B<,>\n"
91 "B< const struct timespec *>I<timeout>B<);>\n"
92 msgstr ""
93
94 #. type: Plain text
95 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
96 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
97 #, no-wrap
98 msgid ""
99 "B<int gai_error(struct gaicb *>I<req>B<);>\n"
100 "B<int gai_cancel(struct gaicb *>I<req>B<);>\n"
101 msgstr ""
102
103 #. type: SH
104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
106 #, no-wrap
107 msgid "DESCRIPTION"
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 "The B<getaddrinfo_a>() function performs the same task as "
115 "B<getaddrinfo>(3), but allows multiple name look-ups to be performed "
116 "asynchronously, with optional notification on completion of look-up "
117 "operations."
118 msgstr ""
119
120 #. type: Plain text
121 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
122 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
123 msgid "The I<mode> argument has one of the following values:"
124 msgstr ""
125
126 #. type: TP
127 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
128 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
129 #, no-wrap
130 msgid "B<GAI_WAIT>"
131 msgstr ""
132
133 #. type: Plain text
134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
136 msgid ""
137 "Perform the look-ups synchronously. The call blocks until the look-ups have "
138 "completed."
139 msgstr ""
140
141 #. type: TP
142 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
143 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
144 #, no-wrap
145 msgid "B<GAI_NOWAIT>"
146 msgstr ""
147
148 #. type: Plain text
149 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
150 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
151 msgid ""
152 "Perform the look-ups asynchronously. The call returns immediately, and the "
153 "requests are resolved in the background. See the discussion of the I<sevp> "
154 "argument below."
155 msgstr ""
156
157 #. type: Plain text
158 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
159 #: opensuse-leap-16-1 opensuse-tumbleweed
160 msgid ""
161 "The array I<list> specifies the look-up requests to process. The I<n> "
162 "argument specifies the number of elements in I<list>. The requested look-up "
163 "operations are started in parallel. NULL elements in I<list> are ignored. "
164 "Each request is described by a I<gaicb> structure, defined as follows:"
165 msgstr ""
166
167 #. type: Plain text
168 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
169 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
170 #, no-wrap
171 msgid ""
172 "struct gaicb {\n"
173 " const char *ar_name;\n"
174 " const char *ar_service;\n"
175 " const struct addrinfo *ar_request;\n"
176 " struct addrinfo *ar_result;\n"
177 "};\n"
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 ""
184 "The elements of this structure correspond to the arguments of "
185 "B<getaddrinfo>(3). Thus, I<ar_name> corresponds to the I<node> argument and "
186 "I<ar_service> to the I<service> argument, identifying an Internet host and a "
187 "service. The I<ar_request> element corresponds to the I<hints> argument, "
188 "specifying the criteria for selecting the returned socket address "
189 "structures. Finally, I<ar_result> corresponds to the I<res> argument; you "
190 "do not need to initialize this element, it will be automatically set when "
191 "the request is resolved. The I<addrinfo> structure referenced by the last "
192 "two elements is described in B<getaddrinfo>(3)."
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 "When I<mode> is specified as B<GAI_NOWAIT>, notifications about resolved "
200 "requests can be obtained by employing the I<sigevent> structure pointed to "
201 "by the I<sevp> argument. For the definition and general details of this "
202 "structure, see B<sigevent>(3type). The I<sevp-E<gt>sigev_notify> field can "
203 "have the following values:"
204 msgstr ""
205
206 #. type: TP
207 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
208 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
209 #, no-wrap
210 msgid "B<SIGEV_NONE>"
211 msgstr ""
212
213 #. type: Plain text
214 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
215 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
216 msgid "Don't provide any notification."
217 msgstr ""
218
219 #. type: TP
220 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
221 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
222 #, no-wrap
223 msgid "B<SIGEV_SIGNAL>"
224 msgstr ""
225
226 #. si_pid and si_uid are also set, to the values of the calling process,
227 #. which doesn't provide useful information, so we'll skip mentioning it.
228 #. type: Plain text
229 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
230 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
231 msgid ""
232 "When a look-up completes, generate the signal I<sigev_signo> for the "
233 "process. See B<sigevent>(3type) for general details. The I<si_code> field "
234 "of the I<siginfo_t> structure will be set to B<SI_ASYNCNL>."
235 msgstr ""
236
237 #. type: TP
238 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
239 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
240 #, no-wrap
241 msgid "B<SIGEV_THREAD>"
242 msgstr ""
243
244 #. type: Plain text
245 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
246 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
247 msgid ""
248 "When a look-up completes, invoke I<sigev_notify_function> as if it were the "
249 "start function of a new thread. See B<sigevent>(3type) for details."
250 msgstr ""
251
252 #. type: Plain text
253 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
254 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
255 msgid ""
256 "For B<SIGEV_SIGNAL> and B<SIGEV_THREAD>, it may be useful to point I<sevp-"
257 "E<gt>sigev_value.sival_ptr> to I<list>."
258 msgstr ""
259
260 #. type: Plain text
261 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
262 #: opensuse-leap-16-1 opensuse-tumbleweed
263 msgid ""
264 "The B<gai_suspend>() function suspends execution of the calling thread, "
265 "waiting for the completion of one or more requests in the array I<list>. "
266 "The I<n> argument specifies the size of the array I<list>. The call blocks "
267 "until one of the following occurs:"
268 msgstr ""
269
270 #. type: IP
271 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
272 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
273 #, no-wrap
274 msgid "\\[bu]"
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 "One or more of the operations in I<list> completes."
281 msgstr ""
282
283 #. type: Plain text
284 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
285 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
286 msgid "The call is interrupted by a signal that is caught."
287 msgstr ""
288
289 #. type: Plain text
290 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
291 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
292 msgid ""
293 "The time interval specified in I<timeout> elapses. This argument specifies "
294 "a timeout in seconds plus nanoseconds (see B<nanosleep>(2) for details of "
295 "the I<timespec> structure). If I<timeout> is NULL, then the call blocks "
296 "indefinitely (until one of the events above occurs)."
297 msgstr ""
298
299 #. type: Plain text
300 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
301 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
302 msgid ""
303 "No explicit indication of which request was completed is given; you must "
304 "determine which request(s) have completed by iterating with B<gai_error>() "
305 "over the list of requests."
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 B<gai_error>() function returns the status of the request I<req>: "
313 "either B<EAI_INPROGRESS> if the request was not completed yet, 0 if it was "
314 "handled successfully, or an error code if the request could not be resolved."
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 "The B<gai_cancel>() function cancels the request I<req>. If the request "
322 "has been canceled successfully, the error status of the request will be set "
323 "to B<EAI_CANCELED> and normal asynchronous notification will be performed. "
324 "The request cannot be canceled if it is currently being processed; in that "
325 "case, it will be handled as if B<gai_cancel>() has never been called. If "
326 "I<req> is NULL, an attempt is made to cancel all outstanding requests that "
327 "the process has made."
328 msgstr ""
329
330 #. type: SH
331 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
332 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
333 #, no-wrap
334 msgid "RETURN VALUE"
335 msgstr ""
336
337 #. type: Plain text
338 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
339 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
340 msgid ""
341 "The B<getaddrinfo_a>() function returns 0 if all of the requests have been "
342 "enqueued successfully, or one of the following nonzero error codes:"
343 msgstr ""
344
345 #. type: TP
346 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
347 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
348 #, no-wrap
349 msgid "B<EAI_AGAIN>"
350 msgstr ""
351
352 #. type: Plain text
353 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
354 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
355 msgid ""
356 "The resources necessary to enqueue the look-up requests were not available. "
357 "The application may check the error status of each request to determine "
358 "which ones failed."
359 msgstr ""
360
361 #. type: TP
362 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
363 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
364 #, no-wrap
365 msgid "B<EAI_MEMORY>"
366 msgstr ""
367
368 #. type: Plain text
369 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
370 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
371 msgid "Out of memory."
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 "B<EAI_SYSTEM>"
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 "I<mode> is invalid."
385 msgstr ""
386
387 #. type: Plain text
388 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
389 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
390 msgid ""
391 "The B<gai_suspend>() function returns 0 if at least one of the listed "
392 "requests has been completed. Otherwise, it returns one of the following "
393 "nonzero error codes:"
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 "The given timeout expired before any of the requests could be completed."
401 msgstr ""
402
403 #. type: TP
404 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
405 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
406 #, no-wrap
407 msgid "B<EAI_ALLDONE>"
408 msgstr ""
409
410 #. type: Plain text
411 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
412 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
413 msgid "There were no actual requests given to the function."
414 msgstr ""
415
416 #. type: TP
417 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
418 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
419 #, no-wrap
420 msgid "B<EAI_INTR>"
421 msgstr ""
422
423 #. type: Plain text
424 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
425 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
426 msgid ""
427 "A signal has interrupted the function. Note that this interruption might "
428 "have been caused by signal notification of some completed look-up request."
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 "The B<gai_error>() function can return B<EAI_INPROGRESS> for an unfinished "
436 "look-up request, 0 for a successfully completed look-up (as described "
437 "above), one of the error codes that could be returned by B<getaddrinfo>(3), "
438 "or the error code B<EAI_CANCELED> if the request has been canceled "
439 "explicitly before it could be finished."
440 msgstr ""
441
442 #. type: Plain text
443 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
444 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
445 msgid "The B<gai_cancel>() function can return one of these values:"
446 msgstr ""
447
448 #. type: TP
449 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
450 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
451 #, no-wrap
452 msgid "B<EAI_CANCELED>"
453 msgstr ""
454
455 #. type: Plain text
456 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
457 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
458 msgid "The request has been canceled successfully."
459 msgstr ""
460
461 #. type: TP
462 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
463 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
464 #, no-wrap
465 msgid "B<EAI_NOTCANCELED>"
466 msgstr ""
467
468 #. type: Plain text
469 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
470 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
471 msgid "The request has not been canceled."
472 msgstr ""
473
474 #. type: Plain text
475 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
476 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
477 msgid "The request has already completed."
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 "The B<gai_strerror>(3) function translates these error codes to a human "
485 "readable string, suitable for error reporting."
486 msgstr ""
487
488 #. type: SH
489 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
490 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
491 #, no-wrap
492 msgid "ATTRIBUTES"
493 msgstr ""
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 ""
499 "For an explanation of the terms used in this section, see B<attributes>(7)."
500 msgstr ""
501
502 #. type: tbl table
503 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
504 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
505 #, no-wrap
506 msgid "Interface"
507 msgstr ""
508
509 #. type: tbl table
510 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
511 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
512 #, no-wrap
513 msgid "Attribute"
514 msgstr ""
515
516 #. type: tbl table
517 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
518 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
519 #, no-wrap
520 msgid "Value"
521 msgstr ""
522
523 #. type: tbl table
524 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
525 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
526 #, no-wrap
527 msgid ".na\n"
528 msgstr ""
529
530 #. type: tbl table
531 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
532 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
533 #, no-wrap
534 msgid ".nh\n"
535 msgstr ""
536
537 #. type: tbl table
538 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
539 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
540 #, no-wrap
541 msgid ""
542 "B<getaddrinfo_a>(),\n"
543 "B<gai_suspend>(),\n"
544 "B<gai_error>(),\n"
545 "B<gai_cancel>()"
546 msgstr ""
547
548 #. type: tbl table
549 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
550 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
551 #, no-wrap
552 msgid "Thread safety"
553 msgstr ""
554
555 #. type: tbl table
556 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
557 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
558 #, no-wrap
559 msgid "MT-Safe"
560 msgstr ""
561
562 #. type: SH
563 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
564 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
565 #, no-wrap
566 msgid "STANDARDS"
567 msgstr ""
568
569 #. type: Plain text
570 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
571 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
572 msgid "GNU."
573 msgstr ""
574
575 #. type: SH
576 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
577 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
578 #, no-wrap
579 msgid "HISTORY"
580 msgstr ""
581
582 #. type: Plain text
583 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
584 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
585 msgid "glibc 2.2.3."
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 msgid ""
592 "The interface of B<getaddrinfo_a>() was modeled after the B<lio_listio>(3) "
593 "interface."
594 msgstr ""
595
596 #. type: SH
597 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
598 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
599 #, no-wrap
600 msgid "EXAMPLES"
601 msgstr ""
602
603 #. type: Plain text
604 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
605 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
606 msgid ""
607 "Two examples are provided: a simple example that resolves several requests "
608 "in parallel synchronously, and a complex example showing some of the "
609 "asynchronous capabilities."
610 msgstr ""
611
612 #. type: SS
613 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
614 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
615 #, no-wrap
616 msgid "Synchronous example"
617 msgstr ""
618
619 #. type: Plain text
620 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
621 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
622 msgid ""
623 "The program below simply resolves several hostnames in parallel, giving a "
624 "speed-up compared to resolving the hostnames sequentially using "
625 "B<getaddrinfo>(3). The program might be used like this:"
626 msgstr ""
627
628 #. type: Plain text
629 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
630 #: opensuse-tumbleweed
631 #, no-wrap
632 msgid ""
633 "$B< ./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>;\n"
634 "mirrors.kernel.org: 139.178.88.99\n"
635 "enoent.linuxfoundation.org: Name or service not known\n"
636 "gnu.org: 209.51.188.116\n"
637 msgstr ""
638
639 #. type: Plain text
640 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
641 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
642 msgid "Here is the program source code"
643 msgstr ""
644
645 #. type: Plain text
646 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
647 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
648 #, no-wrap
649 msgid ""
650 "#define _GNU_SOURCE\n"
651 "#include E<lt>err.hE<gt>\n"
652 "#include E<lt>netdb.hE<gt>\n"
653 "#include E<lt>stdio.hE<gt>\n"
654 "#include E<lt>stdlib.hE<gt>\n"
655 "#include E<lt>string.hE<gt>\n"
656 "\\&\n"
657 "#define MALLOC(n, type) ((type *) reallocarray(NULL, n, sizeof(type)))\n"
658 "\\&\n"
659 "int\n"
660 "main(int argc, char *argv[])\n"
661 "{\n"
662 " int ret;\n"
663 " struct gaicb *reqs[argc - 1];\n"
664 " char host[NI_MAXHOST];\n"
665 " struct addrinfo *res;\n"
666 "\\&\n"
667 " if (argc E<lt> 2) {\n"
668 " fprintf(stderr, \"Usage: %s HOST...\\[rs]n\", argv[0]);\n"
669 " exit(EXIT_FAILURE);\n"
670 " }\n"
671 "\\&\n"
672 " for (size_t i = 0; i E<lt> argc - 1; i++) {\n"
673 " reqs[i] = MALLOC(1, struct gaicb);\n"
674 " if (reqs[i] == NULL)\n"
675 " err(EXIT_FAILURE, \"malloc\");\n"
676 "\\&\n"
677 " memset(reqs[i], 0, sizeof(*reqs[0]));\n"
678 " reqs[i]-E<gt>ar_name = argv[i + 1];\n"
679 " }\n"
680 "\\&\n"
681 " ret = getaddrinfo_a(GAI_WAIT, reqs, argc - 1, NULL);\n"
682 " if (ret != 0) {\n"
683 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
684 " gai_strerror(ret));\n"
685 " exit(EXIT_FAILURE);\n"
686 " }\n"
687 "\\&\n"
688 " for (size_t i = 0; i E<lt> argc - 1; i++) {\n"
689 " printf(\"%s: \", reqs[i]-E<gt>ar_name);\n"
690 " ret = gai_error(reqs[i]);\n"
691 " if (ret == 0) {\n"
692 " res = reqs[i]-E<gt>ar_result;\n"
693 "\\&\n"
694 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
695 " host, sizeof(host),\n"
696 " NULL, 0, NI_NUMERICHOST);\n"
697 " if (ret != 0) {\n"
698 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
699 " gai_strerror(ret));\n"
700 " exit(EXIT_FAILURE);\n"
701 " }\n"
702 " puts(host);\n"
703 "\\&\n"
704 " } else {\n"
705 " puts(gai_strerror(ret));\n"
706 " }\n"
707 " }\n"
708 " exit(EXIT_SUCCESS);\n"
709 "}\n"
710 msgstr ""
711
712 #. SRC END
713 #. type: SS
714 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
715 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
716 #, no-wrap
717 msgid "Asynchronous example"
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 "This example shows a simple interactive B<getaddrinfo_a>() front-end. The "
725 "notification facility is not demonstrated."
726 msgstr ""
727
728 #. type: Plain text
729 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
730 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
731 msgid "An example session might look like this:"
732 msgstr ""
733
734 #. type: Plain text
735 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
736 #: opensuse-tumbleweed
737 #, no-wrap
738 msgid ""
739 "$B< ./a.out>;\n"
740 "E<gt> a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n"
741 "E<gt> c 2\n"
742 "[2] gnu.org: Request not canceled\n"
743 "E<gt> w 0 1\n"
744 "[00] mirrors.kernel.org: Finished\n"
745 "E<gt> l\n"
746 "[00] mirrors.kernel.org: 139.178.88.99\n"
747 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
748 "[02] gnu.org: 209.51.188.116\n"
749 "E<gt> l\n"
750 "[00] mirrors.kernel.org: 139.178.88.99\n"
751 "[01] enoent.linuxfoundation.org: Name or service not known\n"
752 "[02] gnu.org: 209.51.188.116\n"
753 msgstr ""
754
755 #. type: Plain text
756 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
757 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
758 msgid "The program source is as follows:"
759 msgstr ""
760
761 #. type: Plain text
762 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
763 #: opensuse-tumbleweed
764 #, no-wrap
765 msgid ""
766 "#define _GNU_SOURCE\n"
767 "#include E<lt>assert.hE<gt>\n"
768 "#include E<lt>err.hE<gt>\n"
769 "#include E<lt>netdb.hE<gt>\n"
770 "#include E<lt>stdio.hE<gt>\n"
771 "#include E<lt>stdlib.hE<gt>\n"
772 "#include E<lt>string.hE<gt>\n"
773 "\\&\n"
774 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
775 "\\&\n"
776 "#define REALLOCF(ptr, n, type) \\[rs]\n"
777 "({ \\[rs]\n"
778 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); \\[rs]\n"
779 " \\[rs]\n"
780 " (type *) reallocarrayf(ptr, n, sizeof(type)); \\[rs]\n"
781 "})\n"
782 "\\&\n"
783 "static struct gaicb **reqs = NULL;\n"
784 "static size_t nreqs = 0;\n"
785 "\\&\n"
786 "static inline void *\n"
787 "reallocarrayf(void *p, size_t n, size_t size)\n"
788 "{\n"
789 " void *q;\n"
790 "\\&\n"
791 " q = reallocarray(p, n, size);\n"
792 " if (q == NULL && n != 0 && size != 0)\n"
793 " free(p);\n"
794 " return q;\n"
795 "}\n"
796 "\\&\n"
797 "static char *\n"
798 "getcmd(void)\n"
799 "{\n"
800 " static char buf[256];\n"
801 "\\&\n"
802 " fputs(\"E<gt> \", stdout);\n"
803 " fflush(stdout);\n"
804 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
805 " return NULL;\n"
806 "\\&\n"
807 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
808 " buf[strlen(buf) - 1] = 0;\n"
809 "\\&\n"
810 " return buf;\n"
811 "}\n"
812 "\\&\n"
813 "/* Add requests for specified hostnames. */\n"
814 "static void\n"
815 "add_requests(void)\n"
816 "{\n"
817 " size_t nreqs_base = nreqs;\n"
818 " char *host;\n"
819 " int ret;\n"
820 "\\&\n"
821 " while ((host = strtok(NULL, \" \"))) {\n"
822 " nreqs++;\n"
823 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
824 " if (reqs == NULL)\n"
825 " err(EXIT_FAILURE, \"reallocf\");\n"
826 "\\&\n"
827 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
828 " if (reqs[nreqs - 1] == NULL)\n"
829 " err(EXIT_FAILURE, \"calloc\");\n"
830 "\\&\n"
831 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
832 " }\n"
833 "\\&\n"
834 " /* Queue nreqs_base..nreqs requests. */\n"
835 "\\&\n"
836 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
837 " nreqs - nreqs_base, NULL);\n"
838 " if (ret) {\n"
839 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
840 " gai_strerror(ret));\n"
841 " exit(EXIT_FAILURE);\n"
842 " }\n"
843 "}\n"
844 "\\&\n"
845 "/* Wait until at least one of specified requests completes. */\n"
846 "static void\n"
847 "wait_requests(void)\n"
848 "{\n"
849 " char *id;\n"
850 " int ret;\n"
851 " size_t n;\n"
852 " struct gaicb const **wait_reqs;\n"
853 "\\&\n"
854 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
855 " if (wait_reqs == NULL)\n"
856 " err(EXIT_FAILURE, \"calloc\");\n"
857 "\\&\n"
858 " /* NULL elements are ignored by gai_suspend(). */\n"
859 "\\&\n"
860 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
861 " n = atoi(id);\n"
862 "\\&\n"
863 " if (n E<gt>= nreqs) {\n"
864 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
865 " return;\n"
866 " }\n"
867 "\\&\n"
868 " wait_reqs[n] = reqs[n];\n"
869 " }\n"
870 "\\&\n"
871 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
872 " if (ret) {\n"
873 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
874 " return;\n"
875 " }\n"
876 "\\&\n"
877 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
878 " if (wait_reqs[i] == NULL)\n"
879 " continue;\n"
880 "\\&\n"
881 " ret = gai_error(reqs[i]);\n"
882 " if (ret == EAI_INPROGRESS)\n"
883 " continue;\n"
884 "\\&\n"
885 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
886 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
887 " }\n"
888 "}\n"
889 "\\&\n"
890 "/* Cancel specified requests. */\n"
891 "static void\n"
892 "cancel_requests(void)\n"
893 "{\n"
894 " char *id;\n"
895 " int ret;\n"
896 " size_t n;\n"
897 "\\&\n"
898 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
899 " n = atoi(id);\n"
900 "\\&\n"
901 " if (n E<gt>= nreqs) {\n"
902 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
903 " return;\n"
904 " }\n"
905 "\\&\n"
906 " ret = gai_cancel(reqs[n]);\n"
907 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
908 " gai_strerror(ret));\n"
909 " }\n"
910 "}\n"
911 "\\&\n"
912 "/* List all requests. */\n"
913 "static void\n"
914 "list_requests(void)\n"
915 "{\n"
916 " int ret;\n"
917 " char host[NI_MAXHOST];\n"
918 " struct addrinfo *res;\n"
919 "\\&\n"
920 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
921 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
922 " ret = gai_error(reqs[i]);\n"
923 "\\&\n"
924 " if (!ret) {\n"
925 " res = reqs[i]-E<gt>ar_result;\n"
926 "\\&\n"
927 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
928 " host, sizeof(host),\n"
929 " NULL, 0, NI_NUMERICHOST);\n"
930 " if (ret) {\n"
931 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
932 " gai_strerror(ret));\n"
933 " exit(EXIT_FAILURE);\n"
934 " }\n"
935 " puts(host);\n"
936 " } else {\n"
937 " puts(gai_strerror(ret));\n"
938 " }\n"
939 " }\n"
940 "}\n"
941 "\\&\n"
942 "int\n"
943 "main(void)\n"
944 "{\n"
945 " char *cmdline;\n"
946 " char *cmd;\n"
947 "\\&\n"
948 " while ((cmdline = getcmd()) != NULL) {\n"
949 " cmd = strtok(cmdline, \" \");\n"
950 "\\&\n"
951 " if (cmd == NULL) {\n"
952 " list_requests();\n"
953 " } else {\n"
954 " switch (cmd[0]) {\n"
955 " case \\[aq]a\\[aq]:\n"
956 " add_requests();\n"
957 " break;\n"
958 " case \\[aq]w\\[aq]:\n"
959 " wait_requests();\n"
960 " break;\n"
961 " case \\[aq]c\\[aq]:\n"
962 " cancel_requests();\n"
963 " break;\n"
964 " case \\[aq]l\\[aq]:\n"
965 " list_requests();\n"
966 " break;\n"
967 " default:\n"
968 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
969 " break;\n"
970 " }\n"
971 " }\n"
972 " }\n"
973 " exit(EXIT_SUCCESS);\n"
974 "}\n"
975 msgstr ""
976
977 #. SRC END
978 #. type: SH
979 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
980 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
981 #, no-wrap
982 msgid "SEE ALSO"
983 msgstr ""
984
985 #. type: Plain text
986 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
987 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
988 msgid ""
989 "B<getaddrinfo>(3), B<inet>(3), B<lio_listio>(3), B<hostname>(7), B<ip>(7), "
990 "B<sigevent>(3type)"
991 msgstr ""
992
993 #. type: TH
994 #: debian-trixie
995 #, no-wrap
996 msgid "2024-06-15"
997 msgstr ""
998
999 #. type: TH
1000 #: debian-trixie
1001 #, no-wrap
1002 msgid "Linux man-pages 6.9.1"
1003 msgstr ""
1004
1005 #. type: Plain text
1006 #: debian-trixie
1007 msgid "Asynchronous name lookup library (I<libanl>, I<-lanl>)"
1008 msgstr ""
1009
1010 #. type: Plain text
1011 #: debian-trixie
1012 #, no-wrap
1013 msgid ""
1014 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict],>\n"
1015 "B< int >I<nitems>B<, struct sigevent *restrict >I<sevp>B<);>\n"
1016 "B<int gai_suspend(const struct gaicb *const >I<list>B<[], int >I<nitems>B<,>\n"
1017 "B< const struct timespec *>I<timeout>B<);>\n"
1018 msgstr ""
1019
1020 #. type: Plain text
1021 #: debian-trixie
1022 msgid ""
1023 "The array I<list> specifies the look-up requests to process. The I<nitems> "
1024 "argument specifies the number of elements in I<list>. The requested look-up "
1025 "operations are started in parallel. NULL elements in I<list> are ignored. "
1026 "Each request is described by a I<gaicb> structure, defined as follows:"
1027 msgstr ""
1028
1029 #. type: Plain text
1030 #: debian-trixie
1031 msgid ""
1032 "The B<gai_suspend>() function suspends execution of the calling thread, "
1033 "waiting for the completion of one or more requests in the array I<list>. "
1034 "The I<nitems> argument specifies the size of the array I<list>. The call "
1035 "blocks until one of the following occurs:"
1036 msgstr ""
1037
1038 #. type: Plain text
1039 #: debian-trixie fedora-44 fedora-rawhide
1040 #, no-wrap
1041 msgid ""
1042 "$ B<./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>\n"
1043 "mirrors.kernel.org: 139.178.88.99\n"
1044 "enoent.linuxfoundation.org: Name or service not known\n"
1045 "gnu.org: 209.51.188.116\n"
1046 msgstr ""
1047
1048 #. type: Plain text
1049 #: debian-trixie fedora-44 fedora-rawhide
1050 #, no-wrap
1051 msgid ""
1052 "$ B<./a.out>\n"
1053 "E<gt> a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n"
1054 "E<gt> c 2\n"
1055 "[2] gnu.org: Request not canceled\n"
1056 "E<gt> w 0 1\n"
1057 "[00] mirrors.kernel.org: Finished\n"
1058 "E<gt> l\n"
1059 "[00] mirrors.kernel.org: 139.178.88.99\n"
1060 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
1061 "[02] gnu.org: 209.51.188.116\n"
1062 "E<gt> l\n"
1063 "[00] mirrors.kernel.org: 139.178.88.99\n"
1064 "[01] enoent.linuxfoundation.org: Name or service not known\n"
1065 "[02] gnu.org: 209.51.188.116\n"
1066 msgstr ""
1067
1068 #. type: Plain text
1069 #: debian-trixie
1070 #, no-wrap
1071 msgid ""
1072 "#define _GNU_SOURCE\n"
1073 "#include E<lt>assert.hE<gt>\n"
1074 "#include E<lt>err.hE<gt>\n"
1075 "#include E<lt>netdb.hE<gt>\n"
1076 "#include E<lt>stdio.hE<gt>\n"
1077 "#include E<lt>stdlib.hE<gt>\n"
1078 "#include E<lt>string.hE<gt>\n"
1079 "\\&\n"
1080 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
1081 "\\&\n"
1082 "#define REALLOCF(ptr, n, type) \\[rs]\n"
1083 "({ \\[rs]\n"
1084 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); \\[rs]\n"
1085 " \\[rs]\n"
1086 " (type *) reallocarrayf(ptr, n, sizeof(type)); \\[rs]\n"
1087 "})\n"
1088 "\\&\n"
1089 "static struct gaicb **reqs = NULL;\n"
1090 "static size_t nreqs = 0;\n"
1091 "\\&\n"
1092 "static inline void *\n"
1093 "reallocarrayf(void *p, size_t nmemb, size_t size)\n"
1094 "{\n"
1095 " void *q;\n"
1096 "\\&\n"
1097 " q = reallocarray(p, nmemb, size);\n"
1098 " if (q == NULL && nmemb != 0 && size != 0)\n"
1099 " free(p);\n"
1100 " return q;\n"
1101 "}\n"
1102 "\\&\n"
1103 "static char *\n"
1104 "getcmd(void)\n"
1105 "{\n"
1106 " static char buf[256];\n"
1107 "\\&\n"
1108 " fputs(\"E<gt> \", stdout); fflush(stdout);\n"
1109 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
1110 " return NULL;\n"
1111 "\\&\n"
1112 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
1113 " buf[strlen(buf) - 1] = 0;\n"
1114 "\\&\n"
1115 " return buf;\n"
1116 "}\n"
1117 "\\&\n"
1118 "/* Add requests for specified hostnames. */\n"
1119 "static void\n"
1120 "add_requests(void)\n"
1121 "{\n"
1122 " size_t nreqs_base = nreqs;\n"
1123 " char *host;\n"
1124 " int ret;\n"
1125 "\\&\n"
1126 " while ((host = strtok(NULL, \" \"))) {\n"
1127 " nreqs++;\n"
1128 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
1129 " if (reqs == NULL)\n"
1130 " err(EXIT_FAILURE, \"reallocf\");\n"
1131 "\\&\n"
1132 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
1133 " if (reqs[nreqs - 1] == NULL)\n"
1134 " err(EXIT_FAILURE, \"calloc\");\n"
1135 "\\&\n"
1136 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1137 " }\n"
1138 "\\&\n"
1139 " /* Queue nreqs_base..nreqs requests. */\n"
1140 "\\&\n"
1141 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1142 " nreqs - nreqs_base, NULL);\n"
1143 " if (ret) {\n"
1144 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1145 " gai_strerror(ret));\n"
1146 " exit(EXIT_FAILURE);\n"
1147 " }\n"
1148 "}\n"
1149 "\\&\n"
1150 "/* Wait until at least one of specified requests completes. */\n"
1151 "static void\n"
1152 "wait_requests(void)\n"
1153 "{\n"
1154 " char *id;\n"
1155 " int ret;\n"
1156 " size_t n;\n"
1157 " struct gaicb const **wait_reqs;\n"
1158 "\\&\n"
1159 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1160 " if (wait_reqs == NULL)\n"
1161 " err(EXIT_FAILURE, \"calloc\");\n"
1162 "\\&\n"
1163 " /* NULL elements are ignored by gai_suspend(). */\n"
1164 "\\&\n"
1165 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1166 " n = atoi(id);\n"
1167 "\\&\n"
1168 " if (n E<gt>= nreqs) {\n"
1169 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1170 " return;\n"
1171 " }\n"
1172 "\\&\n"
1173 " wait_reqs[n] = reqs[n];\n"
1174 " }\n"
1175 "\\&\n"
1176 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1177 " if (ret) {\n"
1178 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1179 " return;\n"
1180 " }\n"
1181 "\\&\n"
1182 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1183 " if (wait_reqs[i] == NULL)\n"
1184 " continue;\n"
1185 "\\&\n"
1186 " ret = gai_error(reqs[i]);\n"
1187 " if (ret == EAI_INPROGRESS)\n"
1188 " continue;\n"
1189 "\\&\n"
1190 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1191 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1192 " }\n"
1193 "}\n"
1194 "\\&\n"
1195 "/* Cancel specified requests. */\n"
1196 "static void\n"
1197 "cancel_requests(void)\n"
1198 "{\n"
1199 " char *id;\n"
1200 " int ret;\n"
1201 " size_t n;\n"
1202 "\\&\n"
1203 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1204 " n = atoi(id);\n"
1205 "\\&\n"
1206 " if (n E<gt>= nreqs) {\n"
1207 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1208 " return;\n"
1209 " }\n"
1210 "\\&\n"
1211 " ret = gai_cancel(reqs[n]);\n"
1212 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1213 " gai_strerror(ret));\n"
1214 " }\n"
1215 "}\n"
1216 "\\&\n"
1217 "/* List all requests. */\n"
1218 "static void\n"
1219 "list_requests(void)\n"
1220 "{\n"
1221 " int ret;\n"
1222 " char host[NI_MAXHOST];\n"
1223 " struct addrinfo *res;\n"
1224 "\\&\n"
1225 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1226 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1227 " ret = gai_error(reqs[i]);\n"
1228 "\\&\n"
1229 " if (!ret) {\n"
1230 " res = reqs[i]-E<gt>ar_result;\n"
1231 "\\&\n"
1232 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1233 " host, sizeof(host),\n"
1234 " NULL, 0, NI_NUMERICHOST);\n"
1235 " if (ret) {\n"
1236 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1237 " gai_strerror(ret));\n"
1238 " exit(EXIT_FAILURE);\n"
1239 " }\n"
1240 " puts(host);\n"
1241 " } else {\n"
1242 " puts(gai_strerror(ret));\n"
1243 " }\n"
1244 " }\n"
1245 "}\n"
1246 "\\&\n"
1247 "int\n"
1248 "main(void)\n"
1249 "{\n"
1250 " char *cmdline;\n"
1251 " char *cmd;\n"
1252 "\\&\n"
1253 " while ((cmdline = getcmd()) != NULL) {\n"
1254 " cmd = strtok(cmdline, \" \");\n"
1255 "\\&\n"
1256 " if (cmd == NULL) {\n"
1257 " list_requests();\n"
1258 " } else {\n"
1259 " switch (cmd[0]) {\n"
1260 " case \\[aq]a\\[aq]:\n"
1261 " add_requests();\n"
1262 " break;\n"
1263 " case \\[aq]w\\[aq]:\n"
1264 " wait_requests();\n"
1265 " break;\n"
1266 " case \\[aq]c\\[aq]:\n"
1267 " cancel_requests();\n"
1268 " break;\n"
1269 " case \\[aq]l\\[aq]:\n"
1270 " list_requests();\n"
1271 " break;\n"
1272 " default:\n"
1273 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1274 " break;\n"
1275 " }\n"
1276 " }\n"
1277 " }\n"
1278 " exit(EXIT_SUCCESS);\n"
1279 "}\n"
1280 msgstr ""
1281
1282 #. type: TH
1283 #: fedora-44 fedora-rawhide
1284 #, no-wrap
1285 msgid "2024-11-17"
1286 msgstr ""
1287
1288 #. type: TH
1289 #: fedora-44 fedora-rawhide
1290 #, no-wrap
1291 msgid "Linux man-pages 6.13"
1292 msgstr ""
1293
1294 #. type: Plain text
1295 #: fedora-44 fedora-rawhide
1296 #, no-wrap
1297 msgid ""
1298 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict],>\n"
1299 "B< int >I<n>B<, struct sigevent *restrict >I<sevp>B<);>\n"
1300 "B<int gai_suspend(const struct gaicb *const >I<list>B<[], int >I<n>B<,>\n"
1301 "B< const struct timespec *>I<timeout>B<);>\n"
1302 msgstr ""
1303
1304 #. type: Plain text
1305 #: fedora-44 fedora-rawhide
1306 #, no-wrap
1307 msgid ""
1308 "#define _GNU_SOURCE\n"
1309 "#include E<lt>assert.hE<gt>\n"
1310 "#include E<lt>err.hE<gt>\n"
1311 "#include E<lt>netdb.hE<gt>\n"
1312 "#include E<lt>stdio.hE<gt>\n"
1313 "#include E<lt>stdlib.hE<gt>\n"
1314 "#include E<lt>string.hE<gt>\n"
1315 "\\&\n"
1316 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
1317 "\\&\n"
1318 "#define REALLOCF(ptr, n, type) \\[rs]\n"
1319 "({ \\[rs]\n"
1320 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); \\[rs]\n"
1321 " \\[rs]\n"
1322 " (type *) reallocarrayf(ptr, n, sizeof(type)); \\[rs]\n"
1323 "})\n"
1324 "\\&\n"
1325 "static struct gaicb **reqs = NULL;\n"
1326 "static size_t nreqs = 0;\n"
1327 "\\&\n"
1328 "static inline void *\n"
1329 "reallocarrayf(void *p, size_t n, size_t size)\n"
1330 "{\n"
1331 " void *q;\n"
1332 "\\&\n"
1333 " q = reallocarray(p, n, size);\n"
1334 " if (q == NULL && n != 0 && size != 0)\n"
1335 " free(p);\n"
1336 " return q;\n"
1337 "}\n"
1338 "\\&\n"
1339 "static char *\n"
1340 "getcmd(void)\n"
1341 "{\n"
1342 " static char buf[256];\n"
1343 "\\&\n"
1344 " fputs(\"E<gt> \", stdout); fflush(stdout);\n"
1345 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
1346 " return NULL;\n"
1347 "\\&\n"
1348 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
1349 " buf[strlen(buf) - 1] = 0;\n"
1350 "\\&\n"
1351 " return buf;\n"
1352 "}\n"
1353 "\\&\n"
1354 "/* Add requests for specified hostnames. */\n"
1355 "static void\n"
1356 "add_requests(void)\n"
1357 "{\n"
1358 " size_t nreqs_base = nreqs;\n"
1359 " char *host;\n"
1360 " int ret;\n"
1361 "\\&\n"
1362 " while ((host = strtok(NULL, \" \"))) {\n"
1363 " nreqs++;\n"
1364 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
1365 " if (reqs == NULL)\n"
1366 " err(EXIT_FAILURE, \"reallocf\");\n"
1367 "\\&\n"
1368 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
1369 " if (reqs[nreqs - 1] == NULL)\n"
1370 " err(EXIT_FAILURE, \"calloc\");\n"
1371 "\\&\n"
1372 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1373 " }\n"
1374 "\\&\n"
1375 " /* Queue nreqs_base..nreqs requests. */\n"
1376 "\\&\n"
1377 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1378 " nreqs - nreqs_base, NULL);\n"
1379 " if (ret) {\n"
1380 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1381 " gai_strerror(ret));\n"
1382 " exit(EXIT_FAILURE);\n"
1383 " }\n"
1384 "}\n"
1385 "\\&\n"
1386 "/* Wait until at least one of specified requests completes. */\n"
1387 "static void\n"
1388 "wait_requests(void)\n"
1389 "{\n"
1390 " char *id;\n"
1391 " int ret;\n"
1392 " size_t n;\n"
1393 " struct gaicb const **wait_reqs;\n"
1394 "\\&\n"
1395 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1396 " if (wait_reqs == NULL)\n"
1397 " err(EXIT_FAILURE, \"calloc\");\n"
1398 "\\&\n"
1399 " /* NULL elements are ignored by gai_suspend(). */\n"
1400 "\\&\n"
1401 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1402 " n = atoi(id);\n"
1403 "\\&\n"
1404 " if (n E<gt>= nreqs) {\n"
1405 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1406 " return;\n"
1407 " }\n"
1408 "\\&\n"
1409 " wait_reqs[n] = reqs[n];\n"
1410 " }\n"
1411 "\\&\n"
1412 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1413 " if (ret) {\n"
1414 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1415 " return;\n"
1416 " }\n"
1417 "\\&\n"
1418 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1419 " if (wait_reqs[i] == NULL)\n"
1420 " continue;\n"
1421 "\\&\n"
1422 " ret = gai_error(reqs[i]);\n"
1423 " if (ret == EAI_INPROGRESS)\n"
1424 " continue;\n"
1425 "\\&\n"
1426 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1427 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1428 " }\n"
1429 "}\n"
1430 "\\&\n"
1431 "/* Cancel specified requests. */\n"
1432 "static void\n"
1433 "cancel_requests(void)\n"
1434 "{\n"
1435 " char *id;\n"
1436 " int ret;\n"
1437 " size_t n;\n"
1438 "\\&\n"
1439 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1440 " n = atoi(id);\n"
1441 "\\&\n"
1442 " if (n E<gt>= nreqs) {\n"
1443 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1444 " return;\n"
1445 " }\n"
1446 "\\&\n"
1447 " ret = gai_cancel(reqs[n]);\n"
1448 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1449 " gai_strerror(ret));\n"
1450 " }\n"
1451 "}\n"
1452 "\\&\n"
1453 "/* List all requests. */\n"
1454 "static void\n"
1455 "list_requests(void)\n"
1456 "{\n"
1457 " int ret;\n"
1458 " char host[NI_MAXHOST];\n"
1459 " struct addrinfo *res;\n"
1460 "\\&\n"
1461 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1462 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1463 " ret = gai_error(reqs[i]);\n"
1464 "\\&\n"
1465 " if (!ret) {\n"
1466 " res = reqs[i]-E<gt>ar_result;\n"
1467 "\\&\n"
1468 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1469 " host, sizeof(host),\n"
1470 " NULL, 0, NI_NUMERICHOST);\n"
1471 " if (ret) {\n"
1472 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1473 " gai_strerror(ret));\n"
1474 " exit(EXIT_FAILURE);\n"
1475 " }\n"
1476 " puts(host);\n"
1477 " } else {\n"
1478 " puts(gai_strerror(ret));\n"
1479 " }\n"
1480 " }\n"
1481 "}\n"
1482 "\\&\n"
1483 "int\n"
1484 "main(void)\n"
1485 "{\n"
1486 " char *cmdline;\n"
1487 " char *cmd;\n"
1488 "\\&\n"
1489 " while ((cmdline = getcmd()) != NULL) {\n"
1490 " cmd = strtok(cmdline, \" \");\n"
1491 "\\&\n"
1492 " if (cmd == NULL) {\n"
1493 " list_requests();\n"
1494 " } else {\n"
1495 " switch (cmd[0]) {\n"
1496 " case \\[aq]a\\[aq]:\n"
1497 " add_requests();\n"
1498 " break;\n"
1499 " case \\[aq]w\\[aq]:\n"
1500 " wait_requests();\n"
1501 " break;\n"
1502 " case \\[aq]c\\[aq]:\n"
1503 " cancel_requests();\n"
1504 " break;\n"
1505 " case \\[aq]l\\[aq]:\n"
1506 " list_requests();\n"
1507 " break;\n"
1508 " default:\n"
1509 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1510 " break;\n"
1511 " }\n"
1512 " }\n"
1513 " }\n"
1514 " exit(EXIT_SUCCESS);\n"
1515 "}\n"
1516 msgstr ""
1517
1518 #. type: TH
1519 #: mageia-cauldron
1520 #, no-wrap
1521 msgid "Linux man-pages 6.17"
1522 msgstr ""
1523
1524 #. type: TH
1525 #: opensuse-leap-16-1 opensuse-tumbleweed
1526 #, no-wrap
1527 msgid "Linux man-pages (unreleased)"
1528 msgstr ""