Debian Codegraph @

po/ru/man3/getaddrinfo_a.3.po

raw
1 # Russian translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Azamat Hackimov <[email protected]>, 2013-2014, 2017.
5 # Dmitry Bolkhovskikh <[email protected]>, 2017.
6 # Vladislav <[email protected]>, 2015.
7 # Yuri Kozlov <[email protected]>, 2011-2019.
8 # Иван Павлов <[email protected]>, 2017, 2019.
9 msgid ""
10 msgstr ""
11 "Project-Id-Version: manpages-l10n\n"
12 "POT-Creation-Date: 2026-06-05 06:25+0200\n"
13 "PO-Revision-Date: 2024-12-21 19:50+0300\n"
14 "Last-Translator: Yuri Kozlov <[email protected]>\n"
15 "Language-Team: Russian <[email protected]>\n"
16 "Language: ru\n"
17 "MIME-Version: 1.0\n"
18 "Content-Type: text/plain; charset=UTF-8\n"
19 "Content-Transfer-Encoding: 8bit\n"
20 "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
21 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
22 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
23 "X-Generator: Lokalize 2.0\n"
24
25 #. type: TH
26 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
27 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
28 #, no-wrap
29 msgid "getaddrinfo_a"
30 msgstr ""
31
32 #. type: TH
33 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
34 #: opensuse-tumbleweed
35 #, no-wrap
36 msgid "2026-02-08"
37 msgstr "8 февраля 2026 г."
38
39 #. type: TH
40 #: archlinux debian-unstable
41 #, fuzzy, no-wrap
42 #| msgid "Linux man-pages 6.17"
43 msgid "Linux man-pages 6.18"
44 msgstr "Справочные страницы Linux 6.17"
45
46 #. type: SH
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 #, no-wrap
50 msgid "NAME"
51 msgstr "НАИМЕНОВАНИЕ"
52
53 #. type: Plain text
54 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
55 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
56 msgid ""
57 "getaddrinfo_a, gai_suspend, gai_error, gai_cancel - asynchronous network "
58 "address and service translation"
59 msgstr ""
60 "getaddrinfo_a, gai_suspend, gai_error, gai_cancel - асинхронная трансляция "
61 "сетевого адреса и службы"
62
63 #. type: SH
64 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
65 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
66 #, no-wrap
67 msgid "LIBRARY"
68 msgstr "БИБЛИОТЕКА"
69
70 #. type: Plain text
71 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
72 #: opensuse-leap-16-1 opensuse-tumbleweed
73 msgid "Asynchronous name lookup library (I<libanl>,\\ I<-lanl>)"
74 msgstr ""
75
76 #. type: SH
77 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
78 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
79 #, no-wrap
80 msgid "SYNOPSIS"
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 #, no-wrap
87 msgid ""
88 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
89 "B<#include E<lt>netdb.hE<gt>>\n"
90 msgstr ""
91 "B<#define _GNU_SOURCE> /* См. feature_test_macros(7) */\n"
92 "B<#include E<lt>netdb.hE<gt>>\n"
93
94 #. type: Plain text
95 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
96 #: opensuse-tumbleweed
97 #, fuzzy, no-wrap
98 #| msgid ""
99 #| "B<int gai_suspend(const struct gaicb * const >I<list[]>B<, int >I<nitems>B<,>\n"
100 #| "B< const struct timespec *>I<timeout>B<);>\n"
101 msgid ""
102 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict >I<n>B<],>\n"
103 "B< int >I<n>B<, struct sigevent *restrict >I<sevp>B<);>\n"
104 "B<int gai_suspend(const struct gaicb *const >I<list>B<[>I<n>B<], int >I<n>B<,>\n"
105 "B< const struct timespec *>I<timeout>B<);>\n"
106 msgstr ""
107 "B<int gai_suspend(const struct gaicb * const >I<list[]>B<, int >I<nitems>B<,>\n"
108 "B< const struct timespec *>I<timeout>B<);>\n"
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 #, fuzzy, no-wrap
114 #| msgid "B<int gai_cancel(struct gaicb *>I<req>B<);>\n"
115 msgid ""
116 "B<int gai_error(struct gaicb *>I<req>B<);>\n"
117 "B<int gai_cancel(struct gaicb *>I<req>B<);>\n"
118 msgstr "B<int gai_cancel(struct gaicb *>I<req>B<);>\n"
119
120 #. type: SH
121 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
122 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
123 #, no-wrap
124 msgid "DESCRIPTION"
125 msgstr "ОПИСАНИЕ"
126
127 #. type: Plain text
128 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
129 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
130 msgid ""
131 "The B<getaddrinfo_a>() function performs the same task as "
132 "B<getaddrinfo>(3), but allows multiple name look-ups to be performed "
133 "asynchronously, with optional notification on completion of look-up "
134 "operations."
135 msgstr ""
136 "Функция B<getaddrinfo_a>() выполняет ту же задачу что и B<getaddrinfo>(3), "
137 "но позволяет выполнять поиск нескольких имён асинхронно, с дополнительным "
138 "уведомлением о завершении операций поиска."
139
140 #. type: Plain text
141 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
142 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
143 msgid "The I<mode> argument has one of the following values:"
144 msgstr "В аргументе I<mode> указывается одно из следующих значений:"
145
146 #. type: TP
147 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
148 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
149 #, no-wrap
150 msgid "B<GAI_WAIT>"
151 msgstr "B<GAI_WAIT>"
152
153 #. type: Plain text
154 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
155 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
156 msgid ""
157 "Perform the look-ups synchronously. The call blocks until the look-ups have "
158 "completed."
159 msgstr ""
160 "Выполнять поиск синхронно. Вызов блокирует выполнение пока поиск не "
161 "завершится."
162
163 #. type: TP
164 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
165 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
166 #, no-wrap
167 msgid "B<GAI_NOWAIT>"
168 msgstr "B<GAI_NOWAIT>"
169
170 #. type: Plain text
171 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
172 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
173 msgid ""
174 "Perform the look-ups asynchronously. The call returns immediately, and the "
175 "requests are resolved in the background. See the discussion of the I<sevp> "
176 "argument below."
177 msgstr ""
178 "Выполнять поиск асинхронно. Вызов сразу завершается и запросы обрабатываются "
179 "в фоновом режиме. Смотрите далее описание параметра I<sevp>."
180
181 #. type: Plain text
182 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
183 #: opensuse-leap-16-1 opensuse-tumbleweed
184 #, fuzzy
185 #| msgid ""
186 #| "The array I<list> specifies the look-up requests to process. The "
187 #| "I<nitems> argument specifies the number of elements in I<list>. The "
188 #| "requested look-up operations are started in parallel. NULL elements in "
189 #| "I<list> are ignored. Each request is described by a I<gaicb> structure, "
190 #| "defined as follows:"
191 msgid ""
192 "The array I<list> specifies the look-up requests to process. The I<n> "
193 "argument specifies the number of elements in I<list>. The requested look-up "
194 "operations are started in parallel. NULL elements in I<list> are ignored. "
195 "Each request is described by a I<gaicb> structure, defined as follows:"
196 msgstr ""
197 "В массиве I<list> задаются запросы на обработку. В аргументе I<nitems> "
198 "задаётся количество элементов в I<list>. Запрашиваемые операции поиска "
199 "начинаются параллельно. Элементы NULL в списке I<list> игнорируются. Каждый "
200 "запрос описывается структурой I<gaicb>, которая определена следующим образом:"
201
202 #. type: Plain text
203 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
204 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
205 #, no-wrap
206 msgid ""
207 "struct gaicb {\n"
208 " const char *ar_name;\n"
209 " const char *ar_service;\n"
210 " const struct addrinfo *ar_request;\n"
211 " struct addrinfo *ar_result;\n"
212 "};\n"
213 msgstr ""
214 "struct gaicb {\n"
215 " const char *ar_name;\n"
216 " const char *ar_service;\n"
217 " const struct addrinfo *ar_request;\n"
218 " struct addrinfo *ar_result;\n"
219 "};\n"
220
221 #. type: Plain text
222 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
223 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
224 msgid ""
225 "The elements of this structure correspond to the arguments of "
226 "B<getaddrinfo>(3). Thus, I<ar_name> corresponds to the I<node> argument and "
227 "I<ar_service> to the I<service> argument, identifying an Internet host and a "
228 "service. The I<ar_request> element corresponds to the I<hints> argument, "
229 "specifying the criteria for selecting the returned socket address "
230 "structures. Finally, I<ar_result> corresponds to the I<res> argument; you "
231 "do not need to initialize this element, it will be automatically set when "
232 "the request is resolved. The I<addrinfo> structure referenced by the last "
233 "two elements is described in B<getaddrinfo>(3)."
234 msgstr ""
235 "Элементы данной структуры совпадают с аргументами B<getaddrinfo>(3). То есть "
236 "I<ar_name> соответствует аргументу I<node>, а I<ar_service> аргументу "
237 "I<service> (определяют узел Интернета и службу). Элемент I<ar_request> "
238 "соответствует аргументу I<hints>; им задаётся критерий выбора структуры "
239 "возвращаемого адреса сокета. И, наконец, I<ar_result> соответствует "
240 "аргументу I<res>; вам не нужно инициализировать этот элемент, он будет "
241 "заполнен автоматически в результате запроса. Структура I<addrinfo>, на "
242 "которую ссылаются последние два элемента, описана в B<getaddrinfo>(3)."
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 #, fuzzy
248 #| msgid ""
249 #| "When I<mode> is specified as B<GAI_NOWAIT>, notifications about resolved "
250 #| "requests can be obtained by employing the I<sigevent> structure pointed "
251 #| "to by the I<sevp> argument. For the definition and general details of "
252 #| "this structure, see B<sigevent>(7). The I<sevp-E<gt>sigev_notify> field "
253 #| "can have the following values:"
254 msgid ""
255 "When I<mode> is specified as B<GAI_NOWAIT>, notifications about resolved "
256 "requests can be obtained by employing the I<sigevent> structure pointed to "
257 "by the I<sevp> argument. For the definition and general details of this "
258 "structure, see B<sigevent>(3type). The I<sevp-E<gt>sigev_notify> field can "
259 "have the following values:"
260 msgstr ""
261 "Если значение I<mode> равно B<GAI_NOWAIT>, то уведомления о обработанных "
262 "запросах можно получить из структуры I<sigevent>, на которую указывает "
263 "аргумент I<sevp>. Определение и описание данной структуры приведено в "
264 "B<sigevent>(7). Поле I<sevp-E<gt>sigev_notify> может иметь следующие "
265 "значения:"
266
267 #. type: TP
268 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
269 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
270 #, no-wrap
271 msgid "B<SIGEV_NONE>"
272 msgstr "B<SIGEV_NONE>"
273
274 #. type: Plain text
275 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
276 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
277 msgid "Don't provide any notification."
278 msgstr "Отключить уведомление."
279
280 #. type: TP
281 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
282 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
283 #, no-wrap
284 msgid "B<SIGEV_SIGNAL>"
285 msgstr "B<SIGEV_SIGNAL>"
286
287 #. si_pid and si_uid are also set, to the values of the calling process,
288 #. which doesn't provide useful information, so we'll skip mentioning it.
289 #. type: Plain text
290 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
291 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
292 #, fuzzy
293 #| msgid ""
294 #| "When a look-up completes, generate the signal I<sigev_signo> for the "
295 #| "process. See B<sigevent>(7) for general details. The I<si_code> field "
296 #| "of the I<siginfo_t> structure will be set to B<SI_ASYNCNL>."
297 msgid ""
298 "When a look-up completes, generate the signal I<sigev_signo> for the "
299 "process. See B<sigevent>(3type) for general details. The I<si_code> field "
300 "of the I<siginfo_t> structure will be set to B<SI_ASYNCNL>."
301 msgstr ""
302 "При завершении поиска послать процессу сигнал I<sigev_signo>. Подробности "
303 "смотрите в B<sigevent>(7). Полю I<si_code> структуры I<siginfo_t> "
304 "присваивается значение B<SI_ASYNCNL>."
305
306 #. type: TP
307 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
308 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
309 #, no-wrap
310 msgid "B<SIGEV_THREAD>"
311 msgstr "B<SIGEV_THREAD>"
312
313 #. type: Plain text
314 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
315 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
316 #, fuzzy
317 #| msgid ""
318 #| "When a look-up completes, invoke I<sigev_notify_function> as if it were "
319 #| "the start function of a new thread. See B<sigevent>(7) for details."
320 msgid ""
321 "When a look-up completes, invoke I<sigev_notify_function> as if it were the "
322 "start function of a new thread. See B<sigevent>(3type) for details."
323 msgstr ""
324 "При завершении поиска вызвать I<sigev_notify_function>, как если бы с этой "
325 "функции начиналась бы новая нить. Подробности смотрите в B<sigevent>(7)."
326
327 #. type: Plain text
328 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
329 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
330 msgid ""
331 "For B<SIGEV_SIGNAL> and B<SIGEV_THREAD>, it may be useful to point I<sevp-"
332 "E<gt>sigev_value.sival_ptr> to I<list>."
333 msgstr ""
334 "При B<SIGEV_SIGNAL> и B<SIGEV_THREAD>, может быть полезно, чтобы I<sevp-"
335 "E<gt>sigev_value.sival_ptr> указывала на I<list>."
336
337 #. type: Plain text
338 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
339 #: opensuse-leap-16-1 opensuse-tumbleweed
340 #, fuzzy
341 #| msgid ""
342 #| "The B<gai_suspend>() function suspends execution of the calling thread, "
343 #| "waiting for the completion of one or more requests in the array I<list>. "
344 #| "The I<nitems> argument specifies the size of the array I<list>. The call "
345 #| "blocks until one of the following occurs:"
346 msgid ""
347 "The B<gai_suspend>() function suspends execution of the calling thread, "
348 "waiting for the completion of one or more requests in the array I<list>. "
349 "The I<n> argument specifies the size of the array I<list>. The call blocks "
350 "until one of the following occurs:"
351 msgstr ""
352 "Функция B<gai_suspend>() приостанавливает выполнение вызывающей нити, ожидая "
353 "завершения поиска одного или более запросов из массива I<list>. В аргументе "
354 "I<nitems> задаётся размер массива I<list>. Вызов блокирует выполнение пока "
355 "не произойдёт одно из следующего:"
356
357 #. type: IP
358 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
359 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
360 #, no-wrap
361 msgid "\\[bu]"
362 msgstr "\\[bu]"
363
364 #. type: Plain text
365 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
366 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
367 msgid "One or more of the operations in I<list> completes."
368 msgstr "Завершится операция для одного или более запросов из I<list>."
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 "The call is interrupted by a signal that is caught."
374 msgstr "Вызов прервётся пойманным сигналом."
375
376 #. type: Plain text
377 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
378 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
379 msgid ""
380 "The time interval specified in I<timeout> elapses. This argument specifies "
381 "a timeout in seconds plus nanoseconds (see B<nanosleep>(2) for details of "
382 "the I<timespec> structure). If I<timeout> is NULL, then the call blocks "
383 "indefinitely (until one of the events above occurs)."
384 msgstr ""
385 "Временной интервал ожидания задаётся в I<timeout>. В данном аргумента "
386 "указывается промежуток в секундах плюс наносекундах (о структуре "
387 "I<timespec> смотрите B<nanosleep>(2)). Если I<timeout> равно NULL, то вызов "
388 "блокирует выполнение навсегда (пока не произойдёт одно из событий выше)."
389
390 #. type: Plain text
391 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
392 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
393 msgid ""
394 "No explicit indication of which request was completed is given; you must "
395 "determine which request(s) have completed by iterating with B<gai_error>() "
396 "over the list of requests."
397 msgstr ""
398 "При выполнении явно не указывается какие запросы завершены; для определения "
399 "вам нужно обойти весь список запросов с помощью B<gai_error>()."
400
401 #. type: Plain text
402 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
403 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
404 msgid ""
405 "The B<gai_error>() function returns the status of the request I<req>: "
406 "either B<EAI_INPROGRESS> if the request was not completed yet, 0 if it was "
407 "handled successfully, or an error code if the request could not be resolved."
408 msgstr ""
409 "Функция B<gai_error>() возвращает состояние запроса I<req>: "
410 "B<EAI_INPROGRESS> — запрос пока не выполнен, 0 — обработан успешно, код "
411 "ошибки — запрос невозможно обработать."
412
413 #. type: Plain text
414 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
415 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
416 msgid ""
417 "The B<gai_cancel>() function cancels the request I<req>. If the request "
418 "has been canceled successfully, the error status of the request will be set "
419 "to B<EAI_CANCELED> and normal asynchronous notification will be performed. "
420 "The request cannot be canceled if it is currently being processed; in that "
421 "case, it will be handled as if B<gai_cancel>() has never been called. If "
422 "I<req> is NULL, an attempt is made to cancel all outstanding requests that "
423 "the process has made."
424 msgstr ""
425 "Функция B<gai_cancel>() отменяет запрос I<req>. При успешной отмене "
426 "состояние ошибки устанавливается в B<EAI_CANCELED> и выполняется обычное "
427 "асинхронное уведомление. Запрос не может быть отменён, если он начал "
428 "обрабатываться; в этом случае действие будет доведено до конца, как если бы "
429 "вызова B<gai_cancel>() не происходило. Если I<req> равно NULL, то будет "
430 "предпринята попытка отменить все имеющиеся запросы."
431
432 #. type: SH
433 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
434 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
435 #, no-wrap
436 msgid "RETURN VALUE"
437 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
438
439 #. type: Plain text
440 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
441 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
442 msgid ""
443 "The B<getaddrinfo_a>() function returns 0 if all of the requests have been "
444 "enqueued successfully, or one of the following nonzero error codes:"
445 msgstr ""
446 "Функция B<getaddrinfo_a>() возвращает 0, если все запросы были успешно "
447 "обработаны или один из следующих ненулевых кодов ошибки:"
448
449 #. type: TP
450 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
451 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
452 #, no-wrap
453 msgid "B<EAI_AGAIN>"
454 msgstr "B<EAI_AGAIN>"
455
456 #. type: Plain text
457 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
458 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
459 msgid ""
460 "The resources necessary to enqueue the look-up requests were not available. "
461 "The application may check the error status of each request to determine "
462 "which ones failed."
463 msgstr ""
464 "Недоступны ресурсы, необходимые, чтобы постановки запросов поиска в очередь. "
465 "Для нахождения проблемного приложение может проверить состояние ошибки "
466 "каждого запроса."
467
468 #. type: TP
469 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
470 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
471 #, no-wrap
472 msgid "B<EAI_MEMORY>"
473 msgstr "B<EAI_MEMORY>"
474
475 #. type: Plain text
476 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
477 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
478 msgid "Out of memory."
479 msgstr "Не хватает памяти."
480
481 #. type: TP
482 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
483 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
484 #, no-wrap
485 msgid "B<EAI_SYSTEM>"
486 msgstr "B<EAI_SYSTEM>"
487
488 #. type: Plain text
489 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
490 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
491 msgid "I<mode> is invalid."
492 msgstr "Неверное значение I<mode>."
493
494 #. type: Plain text
495 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
496 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
497 msgid ""
498 "The B<gai_suspend>() function returns 0 if at least one of the listed "
499 "requests has been completed. Otherwise, it returns one of the following "
500 "nonzero error codes:"
501 msgstr ""
502 "Функция B<gai_suspend>() возвращает 0, если завершён хотя бы один из "
503 "запросов. В противном случае возвращается один из следующих ненулевых кодов "
504 "ошибки:"
505
506 #. type: Plain text
507 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
508 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
509 msgid ""
510 "The given timeout expired before any of the requests could be completed."
511 msgstr "Указанный интервал истёк до завершения хотят бы одного из запросов."
512
513 #. type: TP
514 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
515 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
516 #, no-wrap
517 msgid "B<EAI_ALLDONE>"
518 msgstr "B<EAI_ALLDONE>"
519
520 #. type: Plain text
521 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
522 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
523 msgid "There were no actual requests given to the function."
524 msgstr "В функцию не было передано никаких фактических запросов."
525
526 #. type: TP
527 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
528 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
529 #, no-wrap
530 msgid "B<EAI_INTR>"
531 msgstr "B<EAI_INTR>"
532
533 #. type: Plain text
534 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
535 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
536 msgid ""
537 "A signal has interrupted the function. Note that this interruption might "
538 "have been caused by signal notification of some completed look-up request."
539 msgstr ""
540 "Функция прервана сигналом. Заметим, что такое прерывание может быть вызвано "
541 "сигналом уведомления о каком-то выполненном запросе."
542
543 #. type: Plain text
544 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
545 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
546 msgid ""
547 "The B<gai_error>() function can return B<EAI_INPROGRESS> for an unfinished "
548 "look-up request, 0 for a successfully completed look-up (as described "
549 "above), one of the error codes that could be returned by B<getaddrinfo>(3), "
550 "or the error code B<EAI_CANCELED> if the request has been canceled "
551 "explicitly before it could be finished."
552 msgstr ""
553 "Функция B<gai_error>() может вернуть B<EAI_INPROGRESS> для незаконченных "
554 "запросов поиска, 0 при успешном поиске (как описано выше), один из кодов "
555 "ошибок, которые может вернуть B<getaddrinfo>(3) или код ошибки "
556 "B<EAI_CANCELED>, если запрос был отменён явно до завершения."
557
558 #. type: Plain text
559 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
560 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
561 msgid "The B<gai_cancel>() function can return one of these values:"
562 msgstr "Функция B<gai_cancel>() может вернуть одно из следующих значений:"
563
564 #. type: TP
565 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
566 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
567 #, no-wrap
568 msgid "B<EAI_CANCELED>"
569 msgstr "B<EAI_CANCELED>"
570
571 #. type: Plain text
572 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
573 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
574 msgid "The request has been canceled successfully."
575 msgstr "Запрос успешно отменён."
576
577 #. type: TP
578 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
579 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
580 #, no-wrap
581 msgid "B<EAI_NOTCANCELED>"
582 msgstr "B<EAI_NOTCANCELED>"
583
584 #. type: Plain text
585 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
586 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
587 msgid "The request has not been canceled."
588 msgstr "Запрос не был отменён."
589
590 #. type: Plain text
591 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
592 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
593 msgid "The request has already completed."
594 msgstr "Запрос уже выполнен."
595
596 #. type: Plain text
597 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
598 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
599 msgid ""
600 "The B<gai_strerror>(3) function translates these error codes to a human "
601 "readable string, suitable for error reporting."
602 msgstr ""
603 "Функция B<gai_strerror>(3) транслирует эти коды ошибок в читаемый формат, "
604 "подходящий для сообщений об ошибке."
605
606 #. type: SH
607 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
608 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
609 #, no-wrap
610 msgid "ATTRIBUTES"
611 msgstr "АТРИБУТЫ"
612
613 #. type: Plain text
614 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
615 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
616 msgid ""
617 "For an explanation of the terms used in this section, see B<attributes>(7)."
618 msgstr "Описание терминов данного раздела смотрите в B<attributes>(7)."
619
620 #. type: tbl table
621 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
622 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
623 #, no-wrap
624 msgid "Interface"
625 msgstr "Интерфейс"
626
627 #. type: tbl table
628 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
629 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
630 #, no-wrap
631 msgid "Attribute"
632 msgstr "Атрибут"
633
634 #. type: tbl table
635 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
636 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
637 #, no-wrap
638 msgid "Value"
639 msgstr "Значение"
640
641 #. type: tbl table
642 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
643 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
644 #, no-wrap
645 msgid ".na\n"
646 msgstr ".na\n"
647
648 #. type: tbl table
649 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
650 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
651 #, no-wrap
652 msgid ".nh\n"
653 msgstr ".nh\n"
654
655 #. type: tbl table
656 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
657 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
658 #, no-wrap
659 msgid ""
660 "B<getaddrinfo_a>(),\n"
661 "B<gai_suspend>(),\n"
662 "B<gai_error>(),\n"
663 "B<gai_cancel>()"
664 msgstr ""
665 "B<getaddrinfo_a>(),\n"
666 "B<gai_suspend>(),\n"
667 "B<gai_error>(),\n"
668 "B<gai_cancel>()"
669
670 #. type: tbl table
671 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
672 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
673 #, no-wrap
674 msgid "Thread safety"
675 msgstr "Безвредность в нитях"
676
677 #. type: tbl table
678 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
679 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
680 #, no-wrap
681 msgid "MT-Safe"
682 msgstr "MT-Safe"
683
684 #. type: SH
685 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
686 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
687 #, no-wrap
688 msgid "STANDARDS"
689 msgstr "СТАНДАРТЫ"
690
691 #. type: Plain text
692 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
693 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
694 msgid "GNU."
695 msgstr "GNU."
696
697 #. type: SH
698 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
699 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
700 #, no-wrap
701 msgid "HISTORY"
702 msgstr "ИСТОРИЯ"
703
704 #. type: Plain text
705 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
706 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
707 msgid "glibc 2.2.3."
708 msgstr "glibc 2.2.3."
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 interface of B<getaddrinfo_a>() was modeled after the B<lio_listio>(3) "
715 "interface."
716 msgstr ""
717 "Интерфейс B<getaddrinfo_a>() был создан после интерфейса B<lio_listio>(3)."
718
719 #. type: SH
720 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
721 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
722 #, no-wrap
723 msgid "EXAMPLES"
724 msgstr "ПРИМЕРЫ"
725
726 #. type: Plain text
727 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
728 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
729 msgid ""
730 "Two examples are provided: a simple example that resolves several requests "
731 "in parallel synchronously, and a complex example showing some of the "
732 "asynchronous capabilities."
733 msgstr ""
734 "Вот два примера: простой пример выполнения нескольких запросов синхронно "
735 "одновременно, и сложный пример, показывающий асинхронные возможности."
736
737 #. type: SS
738 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
739 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
740 #, no-wrap
741 msgid "Synchronous example"
742 msgstr "Синхронный пример"
743
744 #. type: Plain text
745 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
746 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
747 msgid ""
748 "The program below simply resolves several hostnames in parallel, giving a "
749 "speed-up compared to resolving the hostnames sequentially using "
750 "B<getaddrinfo>(3). The program might be used like this:"
751 msgstr ""
752 "Эта программа определяет несколько имён узлов параллельно, что быстрее по "
753 "сравнению с определением имён последовательно с помощью B<getaddrinfo>(3). "
754 "Результат работы программы:"
755
756 #. type: Plain text
757 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
758 #: opensuse-tumbleweed
759 #, fuzzy, no-wrap
760 #| msgid ""
761 #| "$ B<./a.out ftp.us.kernel.org enoent.linuxfoundation.org gnu.cz>\n"
762 #| "ftp.us.kernel.org: 128.30.2.36\n"
763 #| "enoent.linuxfoundation.org: Name or service not known\n"
764 #| "gnu.cz: 87.236.197.13\n"
765 msgid ""
766 "$B< ./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>;\n"
767 "mirrors.kernel.org: 139.178.88.99\n"
768 "enoent.linuxfoundation.org: Name or service not known\n"
769 "gnu.org: 209.51.188.116\n"
770 msgstr ""
771 "$ B<./a.out ftp.us.kernel.org enoent.linuxfoundation.org gnu.cz>\n"
772 "ftp.us.kernel.org: 128.30.2.36\n"
773 "enoent.linuxfoundation.org: Name or service not known\n"
774 "gnu.cz: 87.236.197.13\n"
775
776 #. type: Plain text
777 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
778 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
779 msgid "Here is the program source code"
780 msgstr "Исходный код программы"
781
782 #. type: Plain text
783 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
784 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
785 #, no-wrap
786 msgid ""
787 "#define _GNU_SOURCE\n"
788 "#include E<lt>err.hE<gt>\n"
789 "#include E<lt>netdb.hE<gt>\n"
790 "#include E<lt>stdio.hE<gt>\n"
791 "#include E<lt>stdlib.hE<gt>\n"
792 "#include E<lt>string.hE<gt>\n"
793 "\\&\n"
794 "#define MALLOC(n, type) ((type *) reallocarray(NULL, n, sizeof(type)))\n"
795 "\\&\n"
796 "int\n"
797 "main(int argc, char *argv[])\n"
798 "{\n"
799 " int ret;\n"
800 " struct gaicb *reqs[argc - 1];\n"
801 " char host[NI_MAXHOST];\n"
802 " struct addrinfo *res;\n"
803 "\\&\n"
804 " if (argc E<lt> 2) {\n"
805 " fprintf(stderr, \"Usage: %s HOST...\\[rs]n\", argv[0]);\n"
806 " exit(EXIT_FAILURE);\n"
807 " }\n"
808 "\\&\n"
809 " for (size_t i = 0; i E<lt> argc - 1; i++) {\n"
810 " reqs[i] = MALLOC(1, struct gaicb);\n"
811 " if (reqs[i] == NULL)\n"
812 " err(EXIT_FAILURE, \"malloc\");\n"
813 "\\&\n"
814 " memset(reqs[i], 0, sizeof(*reqs[0]));\n"
815 " reqs[i]-E<gt>ar_name = argv[i + 1];\n"
816 " }\n"
817 "\\&\n"
818 " ret = getaddrinfo_a(GAI_WAIT, reqs, argc - 1, NULL);\n"
819 " if (ret != 0) {\n"
820 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
821 " gai_strerror(ret));\n"
822 " exit(EXIT_FAILURE);\n"
823 " }\n"
824 "\\&\n"
825 " for (size_t i = 0; i E<lt> argc - 1; i++) {\n"
826 " printf(\"%s: \", reqs[i]-E<gt>ar_name);\n"
827 " ret = gai_error(reqs[i]);\n"
828 " if (ret == 0) {\n"
829 " res = reqs[i]-E<gt>ar_result;\n"
830 "\\&\n"
831 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
832 " host, sizeof(host),\n"
833 " NULL, 0, NI_NUMERICHOST);\n"
834 " if (ret != 0) {\n"
835 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
836 " gai_strerror(ret));\n"
837 " exit(EXIT_FAILURE);\n"
838 " }\n"
839 " puts(host);\n"
840 "\\&\n"
841 " } else {\n"
842 " puts(gai_strerror(ret));\n"
843 " }\n"
844 " }\n"
845 " exit(EXIT_SUCCESS);\n"
846 "}\n"
847 msgstr ""
848
849 #. SRC END
850 #. type: SS
851 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
852 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
853 #, no-wrap
854 msgid "Asynchronous example"
855 msgstr "Асинхронный пример"
856
857 #. type: Plain text
858 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
859 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
860 msgid ""
861 "This example shows a simple interactive B<getaddrinfo_a>() front-end. The "
862 "notification facility is not demonstrated."
863 msgstr ""
864 "Данный пример — простая интерактивная оболочка к B<getaddrinfo_a>(). "
865 "Возможности уведомления не используются."
866
867 #. type: Plain text
868 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
869 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
870 msgid "An example session might look like this:"
871 msgstr "Результат работы программы:"
872
873 #. type: Plain text
874 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
875 #: opensuse-tumbleweed
876 #, fuzzy, no-wrap
877 #| msgid ""
878 #| "$ B<./a.out>\n"
879 #| "E<gt> a ftp.us.kernel.org enoent.linuxfoundation.org gnu.cz\n"
880 #| "E<gt> c 2\n"
881 #| "[2] gnu.cz: Request not canceled\n"
882 #| "E<gt> w 0 1\n"
883 #| "[00] ftp.us.kernel.org: Finished\n"
884 #| "E<gt> l\n"
885 #| "[00] ftp.us.kernel.org: 216.165.129.139\n"
886 #| "[01] enoent.linuxfoundation.org: Processing request in progress\n"
887 #| "[02] gnu.cz: 87.236.197.13\n"
888 #| "E<gt> l\n"
889 #| "[00] ftp.us.kernel.org: 216.165.129.139\n"
890 #| "[01] enoent.linuxfoundation.org: Name or service not known\n"
891 #| "[02] gnu.cz: 87.236.197.13\n"
892 msgid ""
893 "$B< ./a.out>;\n"
894 "E<gt> a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n"
895 "E<gt> c 2\n"
896 "[2] gnu.org: Request not canceled\n"
897 "E<gt> w 0 1\n"
898 "[00] mirrors.kernel.org: Finished\n"
899 "E<gt> l\n"
900 "[00] mirrors.kernel.org: 139.178.88.99\n"
901 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
902 "[02] gnu.org: 209.51.188.116\n"
903 "E<gt> l\n"
904 "[00] mirrors.kernel.org: 139.178.88.99\n"
905 "[01] enoent.linuxfoundation.org: Name or service not known\n"
906 "[02] gnu.org: 209.51.188.116\n"
907 msgstr ""
908 "$ B<./a.out>\n"
909 "E<gt> a ftp.us.kernel.org enoent.linuxfoundation.org gnu.cz\n"
910 "E<gt> c 2\n"
911 "[2] gnu.cz: Request not canceled\n"
912 "E<gt> w 0 1\n"
913 "[00] ftp.us.kernel.org: Выполнено\n"
914 "E<gt> l\n"
915 "[00] ftp.us.kernel.org: 216.165.129.139\n"
916 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
917 "[02] gnu.cz: 87.236.197.13\n"
918 "E<gt> l\n"
919 "[00] ftp.us.kernel.org: 216.165.129.139\n"
920 "[01] enoent.linuxfoundation.org: Name or service not known\n"
921 "[02] gnu.cz: 87.236.197.13\n"
922
923 #. type: Plain text
924 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
925 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
926 msgid "The program source is as follows:"
927 msgstr "Исходный код программы:"
928
929 #. type: Plain text
930 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
931 #: opensuse-tumbleweed
932 #, no-wrap
933 msgid ""
934 "#define _GNU_SOURCE\n"
935 "#include E<lt>assert.hE<gt>\n"
936 "#include E<lt>err.hE<gt>\n"
937 "#include E<lt>netdb.hE<gt>\n"
938 "#include E<lt>stdio.hE<gt>\n"
939 "#include E<lt>stdlib.hE<gt>\n"
940 "#include E<lt>string.hE<gt>\n"
941 "\\&\n"
942 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
943 "\\&\n"
944 "#define REALLOCF(ptr, n, type) \\[rs]\n"
945 "({ \\[rs]\n"
946 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); \\[rs]\n"
947 " \\[rs]\n"
948 " (type *) reallocarrayf(ptr, n, sizeof(type)); \\[rs]\n"
949 "})\n"
950 "\\&\n"
951 "static struct gaicb **reqs = NULL;\n"
952 "static size_t nreqs = 0;\n"
953 "\\&\n"
954 "static inline void *\n"
955 "reallocarrayf(void *p, size_t n, size_t size)\n"
956 "{\n"
957 " void *q;\n"
958 "\\&\n"
959 " q = reallocarray(p, n, size);\n"
960 " if (q == NULL && n != 0 && size != 0)\n"
961 " free(p);\n"
962 " return q;\n"
963 "}\n"
964 "\\&\n"
965 "static char *\n"
966 "getcmd(void)\n"
967 "{\n"
968 " static char buf[256];\n"
969 "\\&\n"
970 " fputs(\"E<gt> \", stdout);\n"
971 " fflush(stdout);\n"
972 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
973 " return NULL;\n"
974 "\\&\n"
975 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
976 " buf[strlen(buf) - 1] = 0;\n"
977 "\\&\n"
978 " return buf;\n"
979 "}\n"
980 "\\&\n"
981 "/* Add requests for specified hostnames. */\n"
982 "static void\n"
983 "add_requests(void)\n"
984 "{\n"
985 " size_t nreqs_base = nreqs;\n"
986 " char *host;\n"
987 " int ret;\n"
988 "\\&\n"
989 " while ((host = strtok(NULL, \" \"))) {\n"
990 " nreqs++;\n"
991 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
992 " if (reqs == NULL)\n"
993 " err(EXIT_FAILURE, \"reallocf\");\n"
994 "\\&\n"
995 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
996 " if (reqs[nreqs - 1] == NULL)\n"
997 " err(EXIT_FAILURE, \"calloc\");\n"
998 "\\&\n"
999 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1000 " }\n"
1001 "\\&\n"
1002 " /* Queue nreqs_base..nreqs requests. */\n"
1003 "\\&\n"
1004 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1005 " nreqs - nreqs_base, NULL);\n"
1006 " if (ret) {\n"
1007 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1008 " gai_strerror(ret));\n"
1009 " exit(EXIT_FAILURE);\n"
1010 " }\n"
1011 "}\n"
1012 "\\&\n"
1013 "/* Wait until at least one of specified requests completes. */\n"
1014 "static void\n"
1015 "wait_requests(void)\n"
1016 "{\n"
1017 " char *id;\n"
1018 " int ret;\n"
1019 " size_t n;\n"
1020 " struct gaicb const **wait_reqs;\n"
1021 "\\&\n"
1022 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1023 " if (wait_reqs == NULL)\n"
1024 " err(EXIT_FAILURE, \"calloc\");\n"
1025 "\\&\n"
1026 " /* NULL elements are ignored by gai_suspend(). */\n"
1027 "\\&\n"
1028 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1029 " n = atoi(id);\n"
1030 "\\&\n"
1031 " if (n E<gt>= nreqs) {\n"
1032 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1033 " return;\n"
1034 " }\n"
1035 "\\&\n"
1036 " wait_reqs[n] = reqs[n];\n"
1037 " }\n"
1038 "\\&\n"
1039 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1040 " if (ret) {\n"
1041 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1042 " return;\n"
1043 " }\n"
1044 "\\&\n"
1045 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1046 " if (wait_reqs[i] == NULL)\n"
1047 " continue;\n"
1048 "\\&\n"
1049 " ret = gai_error(reqs[i]);\n"
1050 " if (ret == EAI_INPROGRESS)\n"
1051 " continue;\n"
1052 "\\&\n"
1053 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1054 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1055 " }\n"
1056 "}\n"
1057 "\\&\n"
1058 "/* Cancel specified requests. */\n"
1059 "static void\n"
1060 "cancel_requests(void)\n"
1061 "{\n"
1062 " char *id;\n"
1063 " int ret;\n"
1064 " size_t n;\n"
1065 "\\&\n"
1066 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1067 " n = atoi(id);\n"
1068 "\\&\n"
1069 " if (n E<gt>= nreqs) {\n"
1070 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1071 " return;\n"
1072 " }\n"
1073 "\\&\n"
1074 " ret = gai_cancel(reqs[n]);\n"
1075 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1076 " gai_strerror(ret));\n"
1077 " }\n"
1078 "}\n"
1079 "\\&\n"
1080 "/* List all requests. */\n"
1081 "static void\n"
1082 "list_requests(void)\n"
1083 "{\n"
1084 " int ret;\n"
1085 " char host[NI_MAXHOST];\n"
1086 " struct addrinfo *res;\n"
1087 "\\&\n"
1088 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1089 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1090 " ret = gai_error(reqs[i]);\n"
1091 "\\&\n"
1092 " if (!ret) {\n"
1093 " res = reqs[i]-E<gt>ar_result;\n"
1094 "\\&\n"
1095 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1096 " host, sizeof(host),\n"
1097 " NULL, 0, NI_NUMERICHOST);\n"
1098 " if (ret) {\n"
1099 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1100 " gai_strerror(ret));\n"
1101 " exit(EXIT_FAILURE);\n"
1102 " }\n"
1103 " puts(host);\n"
1104 " } else {\n"
1105 " puts(gai_strerror(ret));\n"
1106 " }\n"
1107 " }\n"
1108 "}\n"
1109 "\\&\n"
1110 "int\n"
1111 "main(void)\n"
1112 "{\n"
1113 " char *cmdline;\n"
1114 " char *cmd;\n"
1115 "\\&\n"
1116 " while ((cmdline = getcmd()) != NULL) {\n"
1117 " cmd = strtok(cmdline, \" \");\n"
1118 "\\&\n"
1119 " if (cmd == NULL) {\n"
1120 " list_requests();\n"
1121 " } else {\n"
1122 " switch (cmd[0]) {\n"
1123 " case \\[aq]a\\[aq]:\n"
1124 " add_requests();\n"
1125 " break;\n"
1126 " case \\[aq]w\\[aq]:\n"
1127 " wait_requests();\n"
1128 " break;\n"
1129 " case \\[aq]c\\[aq]:\n"
1130 " cancel_requests();\n"
1131 " break;\n"
1132 " case \\[aq]l\\[aq]:\n"
1133 " list_requests();\n"
1134 " break;\n"
1135 " default:\n"
1136 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1137 " break;\n"
1138 " }\n"
1139 " }\n"
1140 " }\n"
1141 " exit(EXIT_SUCCESS);\n"
1142 "}\n"
1143 msgstr ""
1144
1145 #. SRC END
1146 #. type: SH
1147 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1148 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1149 #, no-wrap
1150 msgid "SEE ALSO"
1151 msgstr "СМОТРИТЕ ТАКЖЕ"
1152
1153 #. type: Plain text
1154 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1155 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1156 #, fuzzy
1157 #| msgid ""
1158 #| "B<getaddrinfo>(3), B<inet>(3), B<lio_listio>(3), B<hostname>(7), "
1159 #| "B<ip>(7), B<sigevent>(7)"
1160 msgid ""
1161 "B<getaddrinfo>(3), B<inet>(3), B<lio_listio>(3), B<hostname>(7), B<ip>(7), "
1162 "B<sigevent>(3type)"
1163 msgstr ""
1164 "B<getaddrinfo>(3), B<inet>(3), B<lio_listio>(3), B<hostname>(7), B<ip>(7), "
1165 "B<sigevent>(7)"
1166
1167 #. type: TH
1168 #: debian-trixie
1169 #, no-wrap
1170 msgid "2024-06-15"
1171 msgstr "15 июня 2024 г."
1172
1173 #. type: TH
1174 #: debian-trixie
1175 #, no-wrap
1176 msgid "Linux man-pages 6.9.1"
1177 msgstr "Страницы руководства Linux 6.9.1"
1178
1179 #. type: Plain text
1180 #: debian-trixie
1181 msgid "Asynchronous name lookup library (I<libanl>, I<-lanl>)"
1182 msgstr ""
1183
1184 #. type: Plain text
1185 #: debian-trixie
1186 #, fuzzy, no-wrap
1187 #| msgid ""
1188 #| "B<int gai_suspend(const struct gaicb * const >I<list[]>B<, int >I<nitems>B<,>\n"
1189 #| "B< const struct timespec *>I<timeout>B<);>\n"
1190 msgid ""
1191 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict],>\n"
1192 "B< int >I<nitems>B<, struct sigevent *restrict >I<sevp>B<);>\n"
1193 "B<int gai_suspend(const struct gaicb *const >I<list>B<[], int >I<nitems>B<,>\n"
1194 "B< const struct timespec *>I<timeout>B<);>\n"
1195 msgstr ""
1196 "B<int gai_suspend(const struct gaicb * const >I<list[]>B<, int >I<nitems>B<,>\n"
1197 "B< const struct timespec *>I<timeout>B<);>\n"
1198
1199 #. type: Plain text
1200 #: debian-trixie
1201 msgid ""
1202 "The array I<list> specifies the look-up requests to process. The I<nitems> "
1203 "argument specifies the number of elements in I<list>. The requested look-up "
1204 "operations are started in parallel. NULL elements in I<list> are ignored. "
1205 "Each request is described by a I<gaicb> structure, defined as follows:"
1206 msgstr ""
1207 "В массиве I<list> задаются запросы на обработку. В аргументе I<nitems> "
1208 "задаётся количество элементов в I<list>. Запрашиваемые операции поиска "
1209 "начинаются параллельно. Элементы NULL в списке I<list> игнорируются. Каждый "
1210 "запрос описывается структурой I<gaicb>, которая определена следующим образом:"
1211
1212 #. type: Plain text
1213 #: debian-trixie
1214 msgid ""
1215 "The B<gai_suspend>() function suspends execution of the calling thread, "
1216 "waiting for the completion of one or more requests in the array I<list>. "
1217 "The I<nitems> argument specifies the size of the array I<list>. The call "
1218 "blocks until one of the following occurs:"
1219 msgstr ""
1220 "Функция B<gai_suspend>() приостанавливает выполнение вызывающей нити, ожидая "
1221 "завершения поиска одного или более запросов из массива I<list>. В аргументе "
1222 "I<nitems> задаётся размер массива I<list>. Вызов блокирует выполнение пока "
1223 "не произойдёт одно из следующего:"
1224
1225 #. type: Plain text
1226 #: debian-trixie fedora-44 fedora-rawhide
1227 #, fuzzy, no-wrap
1228 #| msgid ""
1229 #| "$ B<./a.out ftp.us.kernel.org enoent.linuxfoundation.org gnu.cz>\n"
1230 #| "ftp.us.kernel.org: 128.30.2.36\n"
1231 #| "enoent.linuxfoundation.org: Name or service not known\n"
1232 #| "gnu.cz: 87.236.197.13\n"
1233 msgid ""
1234 "$ B<./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>\n"
1235 "mirrors.kernel.org: 139.178.88.99\n"
1236 "enoent.linuxfoundation.org: Name or service not known\n"
1237 "gnu.org: 209.51.188.116\n"
1238 msgstr ""
1239 "$ B<./a.out ftp.us.kernel.org enoent.linuxfoundation.org gnu.cz>\n"
1240 "ftp.us.kernel.org: 128.30.2.36\n"
1241 "enoent.linuxfoundation.org: Name or service not known\n"
1242 "gnu.cz: 87.236.197.13\n"
1243
1244 #. type: Plain text
1245 #: debian-trixie fedora-44 fedora-rawhide
1246 #, fuzzy, no-wrap
1247 #| msgid ""
1248 #| "$ B<./a.out>\n"
1249 #| "E<gt> a ftp.us.kernel.org enoent.linuxfoundation.org gnu.cz\n"
1250 #| "E<gt> c 2\n"
1251 #| "[2] gnu.cz: Request not canceled\n"
1252 #| "E<gt> w 0 1\n"
1253 #| "[00] ftp.us.kernel.org: Finished\n"
1254 #| "E<gt> l\n"
1255 #| "[00] ftp.us.kernel.org: 216.165.129.139\n"
1256 #| "[01] enoent.linuxfoundation.org: Processing request in progress\n"
1257 #| "[02] gnu.cz: 87.236.197.13\n"
1258 #| "E<gt> l\n"
1259 #| "[00] ftp.us.kernel.org: 216.165.129.139\n"
1260 #| "[01] enoent.linuxfoundation.org: Name or service not known\n"
1261 #| "[02] gnu.cz: 87.236.197.13\n"
1262 msgid ""
1263 "$ B<./a.out>\n"
1264 "E<gt> a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n"
1265 "E<gt> c 2\n"
1266 "[2] gnu.org: Request not canceled\n"
1267 "E<gt> w 0 1\n"
1268 "[00] mirrors.kernel.org: Finished\n"
1269 "E<gt> l\n"
1270 "[00] mirrors.kernel.org: 139.178.88.99\n"
1271 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
1272 "[02] gnu.org: 209.51.188.116\n"
1273 "E<gt> l\n"
1274 "[00] mirrors.kernel.org: 139.178.88.99\n"
1275 "[01] enoent.linuxfoundation.org: Name or service not known\n"
1276 "[02] gnu.org: 209.51.188.116\n"
1277 msgstr ""
1278 "$ B<./a.out>\n"
1279 "E<gt> a ftp.us.kernel.org enoent.linuxfoundation.org gnu.cz\n"
1280 "E<gt> c 2\n"
1281 "[2] gnu.cz: Request not canceled\n"
1282 "E<gt> w 0 1\n"
1283 "[00] ftp.us.kernel.org: Выполнено\n"
1284 "E<gt> l\n"
1285 "[00] ftp.us.kernel.org: 216.165.129.139\n"
1286 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
1287 "[02] gnu.cz: 87.236.197.13\n"
1288 "E<gt> l\n"
1289 "[00] ftp.us.kernel.org: 216.165.129.139\n"
1290 "[01] enoent.linuxfoundation.org: Name or service not known\n"
1291 "[02] gnu.cz: 87.236.197.13\n"
1292
1293 #. type: Plain text
1294 #: debian-trixie
1295 #, no-wrap
1296 msgid ""
1297 "#define _GNU_SOURCE\n"
1298 "#include E<lt>assert.hE<gt>\n"
1299 "#include E<lt>err.hE<gt>\n"
1300 "#include E<lt>netdb.hE<gt>\n"
1301 "#include E<lt>stdio.hE<gt>\n"
1302 "#include E<lt>stdlib.hE<gt>\n"
1303 "#include E<lt>string.hE<gt>\n"
1304 "\\&\n"
1305 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
1306 "\\&\n"
1307 "#define REALLOCF(ptr, n, type) \\[rs]\n"
1308 "({ \\[rs]\n"
1309 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); \\[rs]\n"
1310 " \\[rs]\n"
1311 " (type *) reallocarrayf(ptr, n, sizeof(type)); \\[rs]\n"
1312 "})\n"
1313 "\\&\n"
1314 "static struct gaicb **reqs = NULL;\n"
1315 "static size_t nreqs = 0;\n"
1316 "\\&\n"
1317 "static inline void *\n"
1318 "reallocarrayf(void *p, size_t nmemb, size_t size)\n"
1319 "{\n"
1320 " void *q;\n"
1321 "\\&\n"
1322 " q = reallocarray(p, nmemb, size);\n"
1323 " if (q == NULL && nmemb != 0 && size != 0)\n"
1324 " free(p);\n"
1325 " return q;\n"
1326 "}\n"
1327 "\\&\n"
1328 "static char *\n"
1329 "getcmd(void)\n"
1330 "{\n"
1331 " static char buf[256];\n"
1332 "\\&\n"
1333 " fputs(\"E<gt> \", stdout); fflush(stdout);\n"
1334 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
1335 " return NULL;\n"
1336 "\\&\n"
1337 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
1338 " buf[strlen(buf) - 1] = 0;\n"
1339 "\\&\n"
1340 " return buf;\n"
1341 "}\n"
1342 "\\&\n"
1343 "/* Add requests for specified hostnames. */\n"
1344 "static void\n"
1345 "add_requests(void)\n"
1346 "{\n"
1347 " size_t nreqs_base = nreqs;\n"
1348 " char *host;\n"
1349 " int ret;\n"
1350 "\\&\n"
1351 " while ((host = strtok(NULL, \" \"))) {\n"
1352 " nreqs++;\n"
1353 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
1354 " if (reqs == NULL)\n"
1355 " err(EXIT_FAILURE, \"reallocf\");\n"
1356 "\\&\n"
1357 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
1358 " if (reqs[nreqs - 1] == NULL)\n"
1359 " err(EXIT_FAILURE, \"calloc\");\n"
1360 "\\&\n"
1361 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1362 " }\n"
1363 "\\&\n"
1364 " /* Queue nreqs_base..nreqs requests. */\n"
1365 "\\&\n"
1366 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1367 " nreqs - nreqs_base, NULL);\n"
1368 " if (ret) {\n"
1369 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1370 " gai_strerror(ret));\n"
1371 " exit(EXIT_FAILURE);\n"
1372 " }\n"
1373 "}\n"
1374 "\\&\n"
1375 "/* Wait until at least one of specified requests completes. */\n"
1376 "static void\n"
1377 "wait_requests(void)\n"
1378 "{\n"
1379 " char *id;\n"
1380 " int ret;\n"
1381 " size_t n;\n"
1382 " struct gaicb const **wait_reqs;\n"
1383 "\\&\n"
1384 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1385 " if (wait_reqs == NULL)\n"
1386 " err(EXIT_FAILURE, \"calloc\");\n"
1387 "\\&\n"
1388 " /* NULL elements are ignored by gai_suspend(). */\n"
1389 "\\&\n"
1390 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1391 " n = atoi(id);\n"
1392 "\\&\n"
1393 " if (n E<gt>= nreqs) {\n"
1394 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1395 " return;\n"
1396 " }\n"
1397 "\\&\n"
1398 " wait_reqs[n] = reqs[n];\n"
1399 " }\n"
1400 "\\&\n"
1401 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1402 " if (ret) {\n"
1403 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1404 " return;\n"
1405 " }\n"
1406 "\\&\n"
1407 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1408 " if (wait_reqs[i] == NULL)\n"
1409 " continue;\n"
1410 "\\&\n"
1411 " ret = gai_error(reqs[i]);\n"
1412 " if (ret == EAI_INPROGRESS)\n"
1413 " continue;\n"
1414 "\\&\n"
1415 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1416 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1417 " }\n"
1418 "}\n"
1419 "\\&\n"
1420 "/* Cancel specified requests. */\n"
1421 "static void\n"
1422 "cancel_requests(void)\n"
1423 "{\n"
1424 " char *id;\n"
1425 " int ret;\n"
1426 " size_t n;\n"
1427 "\\&\n"
1428 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1429 " n = atoi(id);\n"
1430 "\\&\n"
1431 " if (n E<gt>= nreqs) {\n"
1432 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1433 " return;\n"
1434 " }\n"
1435 "\\&\n"
1436 " ret = gai_cancel(reqs[n]);\n"
1437 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1438 " gai_strerror(ret));\n"
1439 " }\n"
1440 "}\n"
1441 "\\&\n"
1442 "/* List all requests. */\n"
1443 "static void\n"
1444 "list_requests(void)\n"
1445 "{\n"
1446 " int ret;\n"
1447 " char host[NI_MAXHOST];\n"
1448 " struct addrinfo *res;\n"
1449 "\\&\n"
1450 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1451 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1452 " ret = gai_error(reqs[i]);\n"
1453 "\\&\n"
1454 " if (!ret) {\n"
1455 " res = reqs[i]-E<gt>ar_result;\n"
1456 "\\&\n"
1457 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1458 " host, sizeof(host),\n"
1459 " NULL, 0, NI_NUMERICHOST);\n"
1460 " if (ret) {\n"
1461 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1462 " gai_strerror(ret));\n"
1463 " exit(EXIT_FAILURE);\n"
1464 " }\n"
1465 " puts(host);\n"
1466 " } else {\n"
1467 " puts(gai_strerror(ret));\n"
1468 " }\n"
1469 " }\n"
1470 "}\n"
1471 "\\&\n"
1472 "int\n"
1473 "main(void)\n"
1474 "{\n"
1475 " char *cmdline;\n"
1476 " char *cmd;\n"
1477 "\\&\n"
1478 " while ((cmdline = getcmd()) != NULL) {\n"
1479 " cmd = strtok(cmdline, \" \");\n"
1480 "\\&\n"
1481 " if (cmd == NULL) {\n"
1482 " list_requests();\n"
1483 " } else {\n"
1484 " switch (cmd[0]) {\n"
1485 " case \\[aq]a\\[aq]:\n"
1486 " add_requests();\n"
1487 " break;\n"
1488 " case \\[aq]w\\[aq]:\n"
1489 " wait_requests();\n"
1490 " break;\n"
1491 " case \\[aq]c\\[aq]:\n"
1492 " cancel_requests();\n"
1493 " break;\n"
1494 " case \\[aq]l\\[aq]:\n"
1495 " list_requests();\n"
1496 " break;\n"
1497 " default:\n"
1498 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1499 " break;\n"
1500 " }\n"
1501 " }\n"
1502 " }\n"
1503 " exit(EXIT_SUCCESS);\n"
1504 "}\n"
1505 msgstr ""
1506
1507 #. type: TH
1508 #: fedora-44 fedora-rawhide
1509 #, no-wrap
1510 msgid "2024-11-17"
1511 msgstr "17 ноября 2024 г."
1512
1513 #. type: TH
1514 #: fedora-44 fedora-rawhide
1515 #, no-wrap
1516 msgid "Linux man-pages 6.13"
1517 msgstr "Страницы руководства Linux 6.13"
1518
1519 #. type: Plain text
1520 #: fedora-44 fedora-rawhide
1521 #, fuzzy, no-wrap
1522 #| msgid ""
1523 #| "B<int gai_suspend(const struct gaicb * const >I<list[]>B<, int >I<nitems>B<,>\n"
1524 #| "B< const struct timespec *>I<timeout>B<);>\n"
1525 msgid ""
1526 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict],>\n"
1527 "B< int >I<n>B<, struct sigevent *restrict >I<sevp>B<);>\n"
1528 "B<int gai_suspend(const struct gaicb *const >I<list>B<[], int >I<n>B<,>\n"
1529 "B< const struct timespec *>I<timeout>B<);>\n"
1530 msgstr ""
1531 "B<int gai_suspend(const struct gaicb * const >I<list[]>B<, int >I<nitems>B<,>\n"
1532 "B< const struct timespec *>I<timeout>B<);>\n"
1533
1534 #. type: Plain text
1535 #: fedora-44 fedora-rawhide
1536 #, no-wrap
1537 msgid ""
1538 "#define _GNU_SOURCE\n"
1539 "#include E<lt>assert.hE<gt>\n"
1540 "#include E<lt>err.hE<gt>\n"
1541 "#include E<lt>netdb.hE<gt>\n"
1542 "#include E<lt>stdio.hE<gt>\n"
1543 "#include E<lt>stdlib.hE<gt>\n"
1544 "#include E<lt>string.hE<gt>\n"
1545 "\\&\n"
1546 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
1547 "\\&\n"
1548 "#define REALLOCF(ptr, n, type) \\[rs]\n"
1549 "({ \\[rs]\n"
1550 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); \\[rs]\n"
1551 " \\[rs]\n"
1552 " (type *) reallocarrayf(ptr, n, sizeof(type)); \\[rs]\n"
1553 "})\n"
1554 "\\&\n"
1555 "static struct gaicb **reqs = NULL;\n"
1556 "static size_t nreqs = 0;\n"
1557 "\\&\n"
1558 "static inline void *\n"
1559 "reallocarrayf(void *p, size_t n, size_t size)\n"
1560 "{\n"
1561 " void *q;\n"
1562 "\\&\n"
1563 " q = reallocarray(p, n, size);\n"
1564 " if (q == NULL && n != 0 && size != 0)\n"
1565 " free(p);\n"
1566 " return q;\n"
1567 "}\n"
1568 "\\&\n"
1569 "static char *\n"
1570 "getcmd(void)\n"
1571 "{\n"
1572 " static char buf[256];\n"
1573 "\\&\n"
1574 " fputs(\"E<gt> \", stdout); fflush(stdout);\n"
1575 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
1576 " return NULL;\n"
1577 "\\&\n"
1578 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
1579 " buf[strlen(buf) - 1] = 0;\n"
1580 "\\&\n"
1581 " return buf;\n"
1582 "}\n"
1583 "\\&\n"
1584 "/* Add requests for specified hostnames. */\n"
1585 "static void\n"
1586 "add_requests(void)\n"
1587 "{\n"
1588 " size_t nreqs_base = nreqs;\n"
1589 " char *host;\n"
1590 " int ret;\n"
1591 "\\&\n"
1592 " while ((host = strtok(NULL, \" \"))) {\n"
1593 " nreqs++;\n"
1594 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
1595 " if (reqs == NULL)\n"
1596 " err(EXIT_FAILURE, \"reallocf\");\n"
1597 "\\&\n"
1598 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
1599 " if (reqs[nreqs - 1] == NULL)\n"
1600 " err(EXIT_FAILURE, \"calloc\");\n"
1601 "\\&\n"
1602 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1603 " }\n"
1604 "\\&\n"
1605 " /* Queue nreqs_base..nreqs requests. */\n"
1606 "\\&\n"
1607 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1608 " nreqs - nreqs_base, NULL);\n"
1609 " if (ret) {\n"
1610 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1611 " gai_strerror(ret));\n"
1612 " exit(EXIT_FAILURE);\n"
1613 " }\n"
1614 "}\n"
1615 "\\&\n"
1616 "/* Wait until at least one of specified requests completes. */\n"
1617 "static void\n"
1618 "wait_requests(void)\n"
1619 "{\n"
1620 " char *id;\n"
1621 " int ret;\n"
1622 " size_t n;\n"
1623 " struct gaicb const **wait_reqs;\n"
1624 "\\&\n"
1625 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1626 " if (wait_reqs == NULL)\n"
1627 " err(EXIT_FAILURE, \"calloc\");\n"
1628 "\\&\n"
1629 " /* NULL elements are ignored by gai_suspend(). */\n"
1630 "\\&\n"
1631 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1632 " n = atoi(id);\n"
1633 "\\&\n"
1634 " if (n E<gt>= nreqs) {\n"
1635 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1636 " return;\n"
1637 " }\n"
1638 "\\&\n"
1639 " wait_reqs[n] = reqs[n];\n"
1640 " }\n"
1641 "\\&\n"
1642 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1643 " if (ret) {\n"
1644 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1645 " return;\n"
1646 " }\n"
1647 "\\&\n"
1648 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1649 " if (wait_reqs[i] == NULL)\n"
1650 " continue;\n"
1651 "\\&\n"
1652 " ret = gai_error(reqs[i]);\n"
1653 " if (ret == EAI_INPROGRESS)\n"
1654 " continue;\n"
1655 "\\&\n"
1656 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1657 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1658 " }\n"
1659 "}\n"
1660 "\\&\n"
1661 "/* Cancel specified requests. */\n"
1662 "static void\n"
1663 "cancel_requests(void)\n"
1664 "{\n"
1665 " char *id;\n"
1666 " int ret;\n"
1667 " size_t n;\n"
1668 "\\&\n"
1669 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1670 " n = atoi(id);\n"
1671 "\\&\n"
1672 " if (n E<gt>= nreqs) {\n"
1673 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1674 " return;\n"
1675 " }\n"
1676 "\\&\n"
1677 " ret = gai_cancel(reqs[n]);\n"
1678 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1679 " gai_strerror(ret));\n"
1680 " }\n"
1681 "}\n"
1682 "\\&\n"
1683 "/* List all requests. */\n"
1684 "static void\n"
1685 "list_requests(void)\n"
1686 "{\n"
1687 " int ret;\n"
1688 " char host[NI_MAXHOST];\n"
1689 " struct addrinfo *res;\n"
1690 "\\&\n"
1691 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1692 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1693 " ret = gai_error(reqs[i]);\n"
1694 "\\&\n"
1695 " if (!ret) {\n"
1696 " res = reqs[i]-E<gt>ar_result;\n"
1697 "\\&\n"
1698 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1699 " host, sizeof(host),\n"
1700 " NULL, 0, NI_NUMERICHOST);\n"
1701 " if (ret) {\n"
1702 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1703 " gai_strerror(ret));\n"
1704 " exit(EXIT_FAILURE);\n"
1705 " }\n"
1706 " puts(host);\n"
1707 " } else {\n"
1708 " puts(gai_strerror(ret));\n"
1709 " }\n"
1710 " }\n"
1711 "}\n"
1712 "\\&\n"
1713 "int\n"
1714 "main(void)\n"
1715 "{\n"
1716 " char *cmdline;\n"
1717 " char *cmd;\n"
1718 "\\&\n"
1719 " while ((cmdline = getcmd()) != NULL) {\n"
1720 " cmd = strtok(cmdline, \" \");\n"
1721 "\\&\n"
1722 " if (cmd == NULL) {\n"
1723 " list_requests();\n"
1724 " } else {\n"
1725 " switch (cmd[0]) {\n"
1726 " case \\[aq]a\\[aq]:\n"
1727 " add_requests();\n"
1728 " break;\n"
1729 " case \\[aq]w\\[aq]:\n"
1730 " wait_requests();\n"
1731 " break;\n"
1732 " case \\[aq]c\\[aq]:\n"
1733 " cancel_requests();\n"
1734 " break;\n"
1735 " case \\[aq]l\\[aq]:\n"
1736 " list_requests();\n"
1737 " break;\n"
1738 " default:\n"
1739 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1740 " break;\n"
1741 " }\n"
1742 " }\n"
1743 " }\n"
1744 " exit(EXIT_SUCCESS);\n"
1745 "}\n"
1746 msgstr ""
1747
1748 #. type: TH
1749 #: mageia-cauldron
1750 #, no-wrap
1751 msgid "Linux man-pages 6.17"
1752 msgstr "Страницы руководства Linux 6.17"
1753
1754 #. type: TH
1755 #: opensuse-leap-16-1 opensuse-tumbleweed
1756 #, no-wrap
1757 msgid "Linux man-pages (unreleased)"
1758 msgstr "Страницы руководства Linux (не выпущены)"