Debian Codegraph @

po/ar/man3/getaddrinfo_a.3.po

raw
1 # Arabic translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # زايد السعيدي <[email protected]>, 2026.
5
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: manpages-l10n 4.30.2\n"
9 "POT-Creation-Date: 2026-06-05 06:25+0200\n"
10 "PO-Revision-Date: 2026-06-06 08:53+0400\n"
11 "Last-Translator: Zayed Al-Saidi <[email protected]>\n"
12 "Language-Team: Arabic <[email protected]>\n"
13 "Language: ar\n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17 "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 &&"
18 " n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
19 "X-Generator: Lokalize 23.08.5\n"
20
21 #. type: TH
22 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
23 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
24 #, no-wrap
25 msgid "getaddrinfo_a"
26 msgstr "getaddrinfo_a"
27
28 #. type: TH
29 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
30 #: opensuse-tumbleweed
31 #, no-wrap
32 msgid "2026-02-08"
33 msgstr "8 فبراير 2026"
34
35 #. type: TH
36 #: archlinux debian-unstable
37 #, no-wrap
38 msgid "Linux man-pages 6.18"
39 msgstr "صفحات دليل لينكس 6.18"
40
41 #. type: SH
42 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
43 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
44 #, no-wrap
45 msgid "NAME"
46 msgstr "الاسم"
47
48 #. type: Plain text
49 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
50 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
51 msgid ""
52 "getaddrinfo_a, gai_suspend, gai_error, gai_cancel - asynchronous network "
53 "address and service translation"
54 msgstr ""
55 "getaddrinfo_a, gai_suspend, gai_error, gai_cancel - ترجمة غير متزامنة لعنوان "
56 "الشبكة والخدمة"
57
58 #. type: SH
59 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
60 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
61 #, no-wrap
62 msgid "LIBRARY"
63 msgstr "المكتبة"
64
65 #. type: Plain text
66 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
67 #: opensuse-leap-16-1 opensuse-tumbleweed
68 #| msgid "Asynchronous name lookup library (I<libanl>, I<-lanl>)"
69 msgid "Asynchronous name lookup library (I<libanl>,\\ I<-lanl>)"
70 msgstr "مكتبة البحث عن الأسماء غير المتزامنة (I<libanl>,\\ I<-lanl>)"
71
72 #. type: SH
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 #, no-wrap
76 msgid "SYNOPSIS"
77 msgstr "موجز"
78
79 #. type: Plain text
80 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
81 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
82 #, no-wrap
83 msgid ""
84 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
85 "B<#include E<lt>netdb.hE<gt>>\n"
86 msgstr ""
87 "B<#define _GNU_SOURCE> /* انظر feature_test_macros(7) */\n"
88 "B<#include E<lt>netdb.hE<gt>>\n"
89
90 #. type: Plain text
91 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
92 #: opensuse-tumbleweed
93 #, no-wrap
94 msgid ""
95 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict >I<n>B<"
96 "],>\n"
97 "B< int >I<n>B<, struct sigevent *restrict >I<sevp>B<);>\n"
98 "B<int gai_suspend(const struct gaicb *const >I<list>B<[>I<n>B<], int >I<n>B<,"
99 ">\n"
100 "B< const struct timespec *>I<timeout>B<);>\n"
101 msgstr ""
102 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict >I<n>B<"
103 "],>\n"
104 "B< int >I<n>B<, struct sigevent *restrict >I<sevp>B<);>\n"
105 "B<int gai_suspend(const struct gaicb *const >I<list>B<[>I<n>B<], int >I<n>B<,"
106 ">\n"
107 "B< const struct timespec *>I<timeout>B<);>\n"
108
109 #. type: Plain text
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 #, no-wrap
113 msgid ""
114 "B<int gai_error(struct gaicb *>I<req>B<);>\n"
115 "B<int gai_cancel(struct gaicb *>I<req>B<);>\n"
116 msgstr ""
117 "B<int gai_error(struct gaicb *>I<req>B<);>\n"
118 "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 #. type: TP
163 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
164 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
165 #, no-wrap
166 msgid "B<GAI_NOWAIT>"
167 msgstr "B<GAI_NOWAIT>"
168
169 #. type: Plain text
170 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
171 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
172 msgid ""
173 "Perform the look-ups asynchronously. The call returns immediately, and the "
174 "requests are resolved in the background. See the discussion of the I<sevp> "
175 "argument below."
176 msgstr ""
177 "إجراء عمليات البحث بشكل غير متزامن. يعود الاستدعاء فورًا، وتُحل الطلبات في "
178 "الخلفية. انظر مناقشة المعامل I<sevp> أدناه."
179
180 #. type: Plain text
181 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
182 #: opensuse-leap-16-1 opensuse-tumbleweed
183 msgid ""
184 "The array I<list> specifies the look-up requests to process. The I<n> "
185 "argument specifies the number of elements in I<list>. The requested look-up "
186 "operations are started in parallel. NULL elements in I<list> are ignored. "
187 "Each request is described by a I<gaicb> structure, defined as follows:"
188 msgstr ""
189 "المصفوفة I<list> تحدد طلبات البحث التي ستُعالج. المعامل I<n> يحدد عدد العناصر "
190 "في I<list>. تُبدأ عمليات البحث المطلوبة بالتوازي. تُتجاهل العناصر NULL في "
191 "I<list>. يُوصف كل طلب بهيكل I<gaicb>، المُعرَّف كالتالي:"
192
193 #. type: Plain text
194 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
195 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
196 #, no-wrap
197 msgid ""
198 "struct gaicb {\n"
199 " const char *ar_name;\n"
200 " const char *ar_service;\n"
201 " const struct addrinfo *ar_request;\n"
202 " struct addrinfo *ar_result;\n"
203 "};\n"
204 msgstr ""
205 "struct gaicb {\n"
206 " const char *ar_name;\n"
207 " const char *ar_service;\n"
208 " const struct addrinfo *ar_request;\n"
209 " struct addrinfo *ar_result;\n"
210 "};\n"
211
212 #. type: Plain text
213 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
214 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
215 msgid ""
216 "The elements of this structure correspond to the arguments of "
217 "B<getaddrinfo>(3). Thus, I<ar_name> corresponds to the I<node> argument and "
218 "I<ar_service> to the I<service> argument, identifying an Internet host and a "
219 "service. The I<ar_request> element corresponds to the I<hints> argument, "
220 "specifying the criteria for selecting the returned socket address "
221 "structures. Finally, I<ar_result> corresponds to the I<res> argument; you "
222 "do not need to initialize this element, it will be automatically set when "
223 "the request is resolved. The I<addrinfo> structure referenced by the last "
224 "two elements is described in B<getaddrinfo>(3)."
225 msgstr ""
226 "عناصر هذا الهيكل تتوافق مع معاملات B<getaddrinfo>(3). لذا، I<ar_name> يتوافق "
227 "مع المعامل I<node> و I<ar_service> مع المعامل I<service>، مُعرِّفًا مضيف"
228 " إنترنت "
229 "وخدمة. العنصر I<ar_request> يتوافق مع المعامل I<hints>، مُحددًا معايير اختيار "
230 "هياكل عنوان المقبس المُعادة. أخيرًا، I<ar_result> يتوافق مع المعامل I<res>؛"
231 " لا "
232 "تحتاج لتهيئة هذا العنصر، سيُضبط آليًا عند حل الطلب. هيكل I<addrinfo> المُشار "
233 "إليه بالعنصرين الأخيرين موصوف في B<getaddrinfo>(3)."
234
235 #. type: Plain text
236 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
237 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
238 msgid ""
239 "When I<mode> is specified as B<GAI_NOWAIT>, notifications about resolved "
240 "requests can be obtained by employing the I<sigevent> structure pointed to "
241 "by the I<sevp> argument. For the definition and general details of this "
242 "structure, see B<sigevent>(3type). The I<sevp-E<gt>sigev_notify> field can "
243 "have the following values:"
244 msgstr ""
245 "عندما يُحدد I<mode> كـ B<GAI_NOWAIT>، يمكن الحصول على إشعارات حول الطلبات "
246 "المُحلّة باستخدام هيكل I<sigevent> المُشار إليه بالمعامل I<sevp>. للتعريف "
247 "والتفاصيل العامة لهذا الهيكل، انظر B<sigevent>(3type). الحقل I<sevp-"
248 "E<gt>sigev_notify> يمكن أن يكون له القيم التالية:"
249
250 #. type: TP
251 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
252 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
253 #, no-wrap
254 msgid "B<SIGEV_NONE>"
255 msgstr "B<SIGEV_NONE>"
256
257 #. type: Plain text
258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
260 msgid "Don't provide any notification."
261 msgstr "لا تُقدم أي إشعار."
262
263 #. type: TP
264 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
265 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
266 #, no-wrap
267 msgid "B<SIGEV_SIGNAL>"
268 msgstr "B<SIGEV_SIGNAL>"
269
270 #. si_pid and si_uid are also set, to the values of the calling process,
271 #. which doesn't provide useful information, so we'll skip mentioning it.
272 #. type: Plain text
273 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
274 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
275 msgid ""
276 "When a look-up completes, generate the signal I<sigev_signo> for the "
277 "process. See B<sigevent>(3type) for general details. The I<si_code> field "
278 "of the I<siginfo_t> structure will be set to B<SI_ASYNCNL>."
279 msgstr ""
280 "عند اكتمال بحث، يُولَّد الإشارة I<sigev_signo> للعملية. انظر B<sigevent"
281 ">(3type) "
282 "للتفاصيل العامة. الحقل I<si_code> من هيكل I<siginfo_t> سيُضبط إلى "
283 "B<SI_ASYNCNL>."
284
285 #. type: TP
286 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
287 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
288 #, no-wrap
289 msgid "B<SIGEV_THREAD>"
290 msgstr "B<SIGEV_THREAD>"
291
292 #. type: Plain text
293 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
294 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
295 msgid ""
296 "When a look-up completes, invoke I<sigev_notify_function> as if it were the "
297 "start function of a new thread. See B<sigevent>(3type) for details."
298 msgstr ""
299 "عند اكتمال بحث، تُستدعى I<sigev_notify_function> كما لو كانت دالة بدء خيط "
300 "جديد. انظر B<sigevent>(3type) للتفاصيل."
301
302 #. type: Plain text
303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
305 msgid ""
306 "For B<SIGEV_SIGNAL> and B<SIGEV_THREAD>, it may be useful to point I<sevp-"
307 "E<gt>sigev_value.sival_ptr> to I<list>."
308 msgstr ""
309 "بالنسبة لـ B<SIGEV_SIGNAL> و B<SIGEV_THREAD>، قد يكون من المفيد توجيه I<sevp-"
310 "E<gt>sigev_value.sival_ptr> إلى I<list>."
311
312 #. type: Plain text
313 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
314 #: opensuse-leap-16-1 opensuse-tumbleweed
315 msgid ""
316 "The B<gai_suspend>() function suspends execution of the calling thread, "
317 "waiting for the completion of one or more requests in the array I<list>. "
318 "The I<n> argument specifies the size of the array I<list>. The call blocks "
319 "until one of the following occurs:"
320 msgstr ""
321 "الدالة B<gai_suspend>() تُعلق تنفيذ الخيط المُستدعي، منتظرة اكتمال طلب واحد"
322 " أو "
323 "أكثر في المصفوفة I<list>. المعامل I<n> يحدد حجم المصفوفة I<list>. يُحجَز "
324 "الاستدعاء حتى يحدث أحد التالي:"
325
326 #. type: IP
327 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
328 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
329 #, no-wrap
330 msgid "\\[bu]"
331 msgstr "\\[bu]"
332
333 #. type: Plain text
334 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
335 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
336 msgid "One or more of the operations in I<list> completes."
337 msgstr "تكتمل عملية أو أكثر من العمليات في I<list>."
338
339 #. type: Plain text
340 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
341 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
342 msgid "The call is interrupted by a signal that is caught."
343 msgstr "تُقاطع الاستدعاء بإشارة تم التقاطها."
344
345 #. type: Plain text
346 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
347 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
348 msgid ""
349 "The time interval specified in I<timeout> elapses. This argument specifies "
350 "a timeout in seconds plus nanoseconds (see B<nanosleep>(2) for details of "
351 "the I<timespec> structure). If I<timeout> is NULL, then the call blocks "
352 "indefinitely (until one of the events above occurs)."
353 msgstr ""
354 "ينقضي الفاصل الزمني المحدد في I<timeout>. تحدد هذه الوسيطة مهلة بالثواني "
355 "بالإضافة إلى النانوثانية (انظر B<nanosleep>(2) لتفاصيل بنية I<timespec>). "
356 "إذا كان I<timeout> NULL، فتحجب الاستدعاء إلى أجل غير مسمى (حتى يقع أحد "
357 "الأحداث أعلاه)."
358
359 #. type: Plain text
360 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
361 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
362 msgid ""
363 "No explicit indication of which request was completed is given; you must "
364 "determine which request(s) have completed by iterating with B<gai_error>() "
365 "over the list of requests."
366 msgstr ""
367 "لا يُعطى إشارة صريحة عن أي طلب أُكمل؛ يجب عليك تحديد أي الطلبات أُكملت"
368 " بالتكرار "
369 "مع B<gai_error>() على قائمة الطلبات."
370
371 #. type: Plain text
372 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
373 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
374 msgid ""
375 "The B<gai_error>() function returns the status of the request I<req>: "
376 "either B<EAI_INPROGRESS> if the request was not completed yet, 0 if it was "
377 "handled successfully, or an error code if the request could not be resolved."
378 msgstr ""
379 "ترجع الدالة B<gai_error>() حالة الطلب I<req>: إما B<EAI_INPROGRESS> إذا لم "
380 "يُكمل الطلب بعد، أو 0 إذا عُولج بنجاح، أو رمز خطأ إذا تعذر حل الطلب."
381
382 #. type: Plain text
383 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
384 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
385 msgid ""
386 "The B<gai_cancel>() function cancels the request I<req>. If the request "
387 "has been canceled successfully, the error status of the request will be set "
388 "to B<EAI_CANCELED> and normal asynchronous notification will be performed. "
389 "The request cannot be canceled if it is currently being processed; in that "
390 "case, it will be handled as if B<gai_cancel>() has never been called. If "
391 "I<req> is NULL, an attempt is made to cancel all outstanding requests that "
392 "the process has made."
393 msgstr ""
394 "تلغي الدالة B<gai_cancel>() الطلب I<req>. إذا أُلغي الطلب بنجاح، فتُضبط حالة "
395 "خطأ الطلب إلى B<EAI_CANCELED> ويُجرى الإعلام غير المتزامن العادي. لا يمكن "
396 "إلغاء الطلب إذا كان يُعالج حاليًا؛ في تلك الحالة، يُعالج كما لو أن "
397 "B<gai_cancel>() لم تُستدعَ أبدًا. إذا كان I<req> NULL، فتُبذل محاولة لإلغاء"
398 " جميع "
399 "الطلبات المعلقة التي قامت بها العملية."
400
401 #. type: SH
402 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
403 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
404 #, no-wrap
405 msgid "RETURN VALUE"
406 msgstr "قيمة الإرجاع"
407
408 #. type: Plain text
409 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
410 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
411 msgid ""
412 "The B<getaddrinfo_a>() function returns 0 if all of the requests have been "
413 "enqueued successfully, or one of the following nonzero error codes:"
414 msgstr ""
415 "ترجع الدالة B<getaddrinfo_a>() 0 إذا صُفت جميع الطلبات في قائمة الانتظار "
416 "بنجاح، أو أحد رموز الخطأ غير الصفرية التالية:"
417
418 #. type: TP
419 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
420 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
421 #, no-wrap
422 msgid "B<EAI_AGAIN>"
423 msgstr "B<EAI_AGAIN>"
424
425 #. type: Plain text
426 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
427 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
428 msgid ""
429 "The resources necessary to enqueue the look-up requests were not available. "
430 "The application may check the error status of each request to determine "
431 "which ones failed."
432 msgstr ""
433 "لم تكن الموارد اللازمة لصف طلبات البحث في قائمة الانتظار متاحة. يمكن للتطبيق "
434 "التحقق من حالة خطأ كل طلب لتحديد أي منها فشل."
435
436 #. type: TP
437 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
438 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
439 #, no-wrap
440 msgid "B<EAI_MEMORY>"
441 msgstr "B<EAI_MEMORY>"
442
443 #. type: Plain text
444 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
445 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
446 msgid "Out of memory."
447 msgstr "نفدت الذاكرة."
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_SYSTEM>"
454 msgstr "B<EAI_SYSTEM>"
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 "I<mode> is invalid."
460 msgstr "I<mode> غير صالح."
461
462 #. type: Plain text
463 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
464 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
465 msgid ""
466 "The B<gai_suspend>() function returns 0 if at least one of the listed "
467 "requests has been completed. Otherwise, it returns one of the following "
468 "nonzero error codes:"
469 msgstr ""
470 "ترجع الدالة B<gai_suspend>() 0 إذا أُكمل طلب واحد على الأقل من الطلبات "
471 "المدرجة. وإلا، فترجع أحد رموز الخطأ غير الصفرية التالية:"
472
473 #. type: Plain text
474 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
475 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
476 msgid ""
477 "The given timeout expired before any of the requests could be completed."
478 msgstr "انتهت المهلة المعطاة قبل أن يُكمل أي من الطلبات."
479
480 #. type: TP
481 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
482 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
483 #, no-wrap
484 msgid "B<EAI_ALLDONE>"
485 msgstr "B<EAI_ALLDONE>"
486
487 #. type: Plain text
488 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
489 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
490 msgid "There were no actual requests given to the function."
491 msgstr "لم تُعطَ أي طلبات فعلية للدالة."
492
493 #. type: TP
494 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
495 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
496 #, no-wrap
497 msgid "B<EAI_INTR>"
498 msgstr "B<EAI_INTR>"
499
500 #. type: Plain text
501 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
502 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
503 msgid ""
504 "A signal has interrupted the function. Note that this interruption might "
505 "have been caused by signal notification of some completed look-up request."
506 msgstr ""
507 "قاطعت إشارة الدالة. لاحظ أن هذا الانقطاع قد يكون ناتجًا عن إعلام إشارة لبعض "
508 "طلبات البحث المكتملة."
509
510 #. type: Plain text
511 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
512 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
513 msgid ""
514 "The B<gai_error>() function can return B<EAI_INPROGRESS> for an unfinished "
515 "look-up request, 0 for a successfully completed look-up (as described "
516 "above), one of the error codes that could be returned by B<getaddrinfo>(3), "
517 "or the error code B<EAI_CANCELED> if the request has been canceled "
518 "explicitly before it could be finished."
519 msgstr ""
520 "يمكن للدالة B<gai_error>() أن ترجع B<EAI_INPROGRESS> لطلب بحث غير مكتمل، أو "
521 "0 لبحث أُكمل بنجاح (كما هو موصوف أعلاه)، أو أحد رموز الخطأ التي قد ترجعها "
522 "B<getaddrinfo>(3)، أو رمز الخطأ B<EAI_CANCELED> إذا أُلغي الطلب صراحةً قبل أن "
523 "يُكمل."
524
525 #. type: Plain text
526 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
527 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
528 msgid "The B<gai_cancel>() function can return one of these values:"
529 msgstr "يمكن للدالة B<gai_cancel>() أن ترجع إحدى هذه القيم:"
530
531 #. type: TP
532 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
533 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
534 #, no-wrap
535 msgid "B<EAI_CANCELED>"
536 msgstr "B<EAI_CANCELED>"
537
538 #. type: Plain text
539 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
540 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
541 msgid "The request has been canceled successfully."
542 msgstr "أُلغي الطلب بنجاح."
543
544 #. type: TP
545 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
546 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
547 #, no-wrap
548 msgid "B<EAI_NOTCANCELED>"
549 msgstr "B<EAI_NOTCANCELED>"
550
551 #. type: Plain text
552 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
553 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
554 msgid "The request has not been canceled."
555 msgstr "لم يُلغَ الطلب."
556
557 #. type: Plain text
558 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
559 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
560 msgid "The request has already completed."
561 msgstr "اكتمل الطلب بالفعل."
562
563 #. type: Plain text
564 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
565 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
566 msgid ""
567 "The B<gai_strerror>(3) function translates these error codes to a human "
568 "readable string, suitable for error reporting."
569 msgstr ""
570 "ترجم الدالة B<gai_strerror>(3) رموز الخطأ هذه إلى سلسلة نصية مقروءة للبشر، "
571 "مناسبة للإبلاغ عن الأخطاء."
572
573 #. type: SH
574 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
575 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
576 #, no-wrap
577 msgid "ATTRIBUTES"
578 msgstr "السمات"
579
580 #. type: Plain text
581 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
582 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
583 msgid ""
584 "For an explanation of the terms used in this section, see B<attributes>(7)."
585 msgstr ""
586 "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B<attributes>(7)."
587
588 #. type: tbl table
589 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
590 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
591 #, no-wrap
592 msgid "Interface"
593 msgstr "الواجهة"
594
595 #. type: tbl table
596 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
597 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
598 #, no-wrap
599 msgid "Attribute"
600 msgstr "السمة"
601
602 #. type: tbl table
603 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
604 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
605 #, no-wrap
606 msgid "Value"
607 msgstr "القيمة"
608
609 #. type: tbl table
610 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
611 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
612 #, no-wrap
613 msgid ".na\n"
614 msgstr ".na\n"
615
616 #. type: tbl table
617 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
618 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
619 #, no-wrap
620 msgid ".nh\n"
621 msgstr ".nh\n"
622
623 #. type: tbl table
624 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
625 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
626 #, no-wrap
627 msgid ""
628 "B<getaddrinfo_a>(),\n"
629 "B<gai_suspend>(),\n"
630 "B<gai_error>(),\n"
631 "B<gai_cancel>()"
632 msgstr ""
633 "B<getaddrinfo_a>(),\n"
634 "B<gai_suspend>(),\n"
635 "B<gai_error>(),\n"
636 "B<gai_cancel>()"
637
638 #. type: tbl table
639 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
640 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
641 #, no-wrap
642 msgid "Thread safety"
643 msgstr "سلامة الخيوط"
644
645 #. type: tbl table
646 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
647 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
648 #, no-wrap
649 msgid "MT-Safe"
650 msgstr "MT-Safe"
651
652 #. type: SH
653 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
654 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
655 #, no-wrap
656 msgid "STANDARDS"
657 msgstr "المعايير"
658
659 #. type: Plain text
660 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
661 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
662 msgid "GNU."
663 msgstr "GNU."
664
665 #. type: SH
666 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
667 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
668 #, no-wrap
669 msgid "HISTORY"
670 msgstr "التاريخ"
671
672 #. type: Plain text
673 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
674 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
675 msgid "glibc 2.2.3."
676 msgstr "glibc 2.2.3."
677
678 #. type: Plain text
679 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
680 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
681 msgid ""
682 "The interface of B<getaddrinfo_a>() was modeled after the B<lio_listio>(3) "
683 "interface."
684 msgstr "صُممت واجهة B<getaddrinfo_a>() على غرار واجهة B<lio_listio>(3)."
685
686 #. type: SH
687 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
688 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
689 #, no-wrap
690 msgid "EXAMPLES"
691 msgstr "أمثلة"
692
693 #. type: Plain text
694 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
695 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
696 msgid ""
697 "Two examples are provided: a simple example that resolves several requests "
698 "in parallel synchronously, and a complex example showing some of the "
699 "asynchronous capabilities."
700 msgstr ""
701 "يُقدَّم مثالان: مثال بسيط يحل عدة طلبات بالتوازي بشكل تزامني، ومثال معقد"
702 " يُظهر "
703 "بعض القدرات اللاتزامنية."
704
705 #. type: SS
706 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
707 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
708 #, no-wrap
709 msgid "Synchronous example"
710 msgstr "مثال تزامني"
711
712 #. type: Plain text
713 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
714 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
715 msgid ""
716 "The program below simply resolves several hostnames in parallel, giving a "
717 "speed-up compared to resolving the hostnames sequentially using "
718 "B<getaddrinfo>(3). The program might be used like this:"
719 msgstr ""
720 "يحل البرنامج أدناه ببساطة عدة أسماء مضيفين بالتوازي، مما يُعطي تسريعًا مقارنة "
721 "بحل أسماء المضيفين تسلسليًا باستخدام B<getaddrinfo>(3). يمكن استخدام "
722 "البرنامج هكذا:"
723
724 #. type: Plain text
725 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
726 #: opensuse-tumbleweed
727 #, no-wrap
728 msgid ""
729 "$B< ./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>;\n"
730 "mirrors.kernel.org: 139.178.88.99\n"
731 "enoent.linuxfoundation.org: Name or service not known\n"
732 "gnu.org: 209.51.188.116\n"
733 msgstr ""
734 "$B< ./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>;\n"
735 "mirrors.kernel.org: 139.178.88.99\n"
736 "enoent.linuxfoundation.org: Name or service not known\n"
737 "gnu.org: 209.51.188.116\n"
738
739 #. type: Plain text
740 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
741 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
742 msgid "Here is the program source code"
743 msgstr "هذا هو الكود المصدري للبرنامج"
744
745 #. type: Plain text
746 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
747 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
748 #, no-wrap
749 msgid ""
750 "#define _GNU_SOURCE\n"
751 "#include E<lt>err.hE<gt>\n"
752 "#include E<lt>netdb.hE<gt>\n"
753 "#include E<lt>stdio.hE<gt>\n"
754 "#include E<lt>stdlib.hE<gt>\n"
755 "#include E<lt>string.hE<gt>\n"
756 "\\&\n"
757 "#define MALLOC(n, type) ((type *) reallocarray(NULL, n, sizeof(type)))\n"
758 "\\&\n"
759 "int\n"
760 "main(int argc, char *argv[])\n"
761 "{\n"
762 " int ret;\n"
763 " struct gaicb *reqs[argc - 1];\n"
764 " char host[NI_MAXHOST];\n"
765 " struct addrinfo *res;\n"
766 "\\&\n"
767 " if (argc E<lt> 2) {\n"
768 " fprintf(stderr, \"Usage: %s HOST...\\[rs]n\", argv[0]);\n"
769 " exit(EXIT_FAILURE);\n"
770 " }\n"
771 "\\&\n"
772 " for (size_t i = 0; i E<lt> argc - 1; i++) {\n"
773 " reqs[i] = MALLOC(1, struct gaicb);\n"
774 " if (reqs[i] == NULL)\n"
775 " err(EXIT_FAILURE, \"malloc\");\n"
776 "\\&\n"
777 " memset(reqs[i], 0, sizeof(*reqs[0]));\n"
778 " reqs[i]-E<gt>ar_name = argv[i + 1];\n"
779 " }\n"
780 "\\&\n"
781 " ret = getaddrinfo_a(GAI_WAIT, reqs, argc - 1, NULL);\n"
782 " if (ret != 0) {\n"
783 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
784 " gai_strerror(ret));\n"
785 " exit(EXIT_FAILURE);\n"
786 " }\n"
787 "\\&\n"
788 " for (size_t i = 0; i E<lt> argc - 1; i++) {\n"
789 " printf(\"%s: \", reqs[i]-E<gt>ar_name);\n"
790 " ret = gai_error(reqs[i]);\n"
791 " if (ret == 0) {\n"
792 " res = reqs[i]-E<gt>ar_result;\n"
793 "\\&\n"
794 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
795 " host, sizeof(host),\n"
796 " NULL, 0, NI_NUMERICHOST);\n"
797 " if (ret != 0) {\n"
798 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
799 " gai_strerror(ret));\n"
800 " exit(EXIT_FAILURE);\n"
801 " }\n"
802 " puts(host);\n"
803 "\\&\n"
804 " } else {\n"
805 " puts(gai_strerror(ret));\n"
806 " }\n"
807 " }\n"
808 " exit(EXIT_SUCCESS);\n"
809 "}\n"
810 msgstr ""
811 "#define _GNU_SOURCE\n"
812 "#include E<lt>err.hE<gt>\n"
813 "#include E<lt>netdb.hE<gt>\n"
814 "#include E<lt>stdio.hE<gt>\n"
815 "#include E<lt>stdlib.hE<gt>\n"
816 "#include E<lt>string.hE<gt>\n"
817 "\\&\n"
818 "#define MALLOC(n, type) ((type *) reallocarray(NULL, n, sizeof(type)))\n"
819 "\\&\n"
820 "int\n"
821 "main(int argc, char *argv[])\n"
822 "{\n"
823 " int ret;\n"
824 " struct gaicb *reqs[argc - 1];\n"
825 " char host[NI_MAXHOST];\n"
826 " struct addrinfo *res;\n"
827 "\\&\n"
828 " if (argc E<lt> 2) {\n"
829 " fprintf(stderr, \"Usage: %s HOST...\\[rs]n\", argv[0]);\n"
830 " exit(EXIT_FAILURE);\n"
831 " }\n"
832 "\\&\n"
833 " for (size_t i = 0; i E<lt> argc - 1; i++) {\n"
834 " reqs[i] = MALLOC(1, struct gaicb);\n"
835 " if (reqs[i] == NULL)\n"
836 " err(EXIT_FAILURE, \"malloc\");\n"
837 "\\&\n"
838 " memset(reqs[i], 0, sizeof(*reqs[0]));\n"
839 " reqs[i]-E<gt>ar_name = argv[i + 1];\n"
840 " }\n"
841 "\\&\n"
842 " ret = getaddrinfo_a(GAI_WAIT, reqs, argc - 1, NULL);\n"
843 " if (ret != 0) {\n"
844 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
845 " gai_strerror(ret));\n"
846 " exit(EXIT_FAILURE);\n"
847 " }\n"
848 "\\&\n"
849 " for (size_t i = 0; i E<lt> argc - 1; i++) {\n"
850 " printf(\"%s: \", reqs[i]-E<gt>ar_name);\n"
851 " ret = gai_error(reqs[i]);\n"
852 " if (ret == 0) {\n"
853 " res = reqs[i]-E<gt>ar_result;\n"
854 "\\&\n"
855 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
856 " host, sizeof(host),\n"
857 " NULL, 0, NI_NUMERICHOST);\n"
858 " if (ret != 0) {\n"
859 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
860 " gai_strerror(ret));\n"
861 " exit(EXIT_FAILURE);\n"
862 " }\n"
863 " puts(host);\n"
864 "\\&\n"
865 " } else {\n"
866 " puts(gai_strerror(ret));\n"
867 " }\n"
868 " }\n"
869 " exit(EXIT_SUCCESS);\n"
870 "}\n"
871
872 #. SRC END
873 #. type: SS
874 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
875 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
876 #, no-wrap
877 msgid "Asynchronous example"
878 msgstr "مثال لاتزامني"
879
880 #. type: Plain text
881 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
882 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
883 msgid ""
884 "This example shows a simple interactive B<getaddrinfo_a>() front-end. The "
885 "notification facility is not demonstrated."
886 msgstr ""
887 "يُظهر هذا المثال واجهة أمامية تفاعلية بسيطة لـ B<getaddrinfo_a>(). لم"
888 " يُوضَّح "
889 "مرفق الإشعار."
890
891 #. type: Plain text
892 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
893 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
894 msgid "An example session might look like this:"
895 msgstr "قد تبدو جلسة مثال هكذا:"
896
897 #. type: Plain text
898 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
899 #: opensuse-tumbleweed
900 #, no-wrap
901 msgid ""
902 "$B< ./a.out>;\n"
903 "E<gt> a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n"
904 "E<gt> c 2\n"
905 "[2] gnu.org: Request not canceled\n"
906 "E<gt> w 0 1\n"
907 "[00] mirrors.kernel.org: Finished\n"
908 "E<gt> l\n"
909 "[00] mirrors.kernel.org: 139.178.88.99\n"
910 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
911 "[02] gnu.org: 209.51.188.116\n"
912 "E<gt> l\n"
913 "[00] mirrors.kernel.org: 139.178.88.99\n"
914 "[01] enoent.linuxfoundation.org: Name or service not known\n"
915 "[02] gnu.org: 209.51.188.116\n"
916 msgstr ""
917 "$B< ./a.out>;\n"
918 "E<gt> a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n"
919 "E<gt> c 2\n"
920 "[2] gnu.org: Request not canceled\n"
921 "E<gt> w 0 1\n"
922 "[00] mirrors.kernel.org: Finished\n"
923 "E<gt> l\n"
924 "[00] mirrors.kernel.org: 139.178.88.99\n"
925 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
926 "[02] gnu.org: 209.51.188.116\n"
927 "E<gt> l\n"
928 "[00] mirrors.kernel.org: 139.178.88.99\n"
929 "[01] enoent.linuxfoundation.org: Name or service not known\n"
930 "[02] gnu.org: 209.51.188.116\n"
931
932 #. type: Plain text
933 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
934 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
935 msgid "The program source is as follows:"
936 msgstr "المصدر البرمجي للبرنامج كما يلي:"
937
938 #. type: Plain text
939 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
940 #: opensuse-tumbleweed
941 #, no-wrap
942 msgid ""
943 "#define _GNU_SOURCE\n"
944 "#include E<lt>assert.hE<gt>\n"
945 "#include E<lt>err.hE<gt>\n"
946 "#include E<lt>netdb.hE<gt>\n"
947 "#include E<lt>stdio.hE<gt>\n"
948 "#include E<lt>stdlib.hE<gt>\n"
949 "#include E<lt>string.hE<gt>\n"
950 "\\&\n"
951 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
952 "\\&\n"
953 "#define REALLOCF(ptr, n, type) "
954 " \\[rs]\n"
955 "({ "
956 " \\[rs]\n"
957 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); "
958 " \\[rs]\n"
959 " "
960 " \\[rs]\n"
961 " (type *) reallocarrayf(ptr, n, sizeof(type)); "
962 " \\[rs]\n"
963 "})\n"
964 "\\&\n"
965 "static struct gaicb **reqs = NULL;\n"
966 "static size_t nreqs = 0;\n"
967 "\\&\n"
968 "static inline void *\n"
969 "reallocarrayf(void *p, size_t n, size_t size)\n"
970 "{\n"
971 " void *q;\n"
972 "\\&\n"
973 " q = reallocarray(p, n, size);\n"
974 " if (q == NULL && n != 0 && size != 0)\n"
975 " free(p);\n"
976 " return q;\n"
977 "}\n"
978 "\\&\n"
979 "static char *\n"
980 "getcmd(void)\n"
981 "{\n"
982 " static char buf[256];\n"
983 "\\&\n"
984 " fputs(\"E<gt> \", stdout);\n"
985 " fflush(stdout);\n"
986 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
987 " return NULL;\n"
988 "\\&\n"
989 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
990 " buf[strlen(buf) - 1] = 0;\n"
991 "\\&\n"
992 " return buf;\n"
993 "}\n"
994 "\\&\n"
995 "/* Add requests for specified hostnames. */\n"
996 "static void\n"
997 "add_requests(void)\n"
998 "{\n"
999 " size_t nreqs_base = nreqs;\n"
1000 " char *host;\n"
1001 " int ret;\n"
1002 "\\&\n"
1003 " while ((host = strtok(NULL, \" \"))) {\n"
1004 " nreqs++;\n"
1005 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
1006 " if (reqs == NULL)\n"
1007 " err(EXIT_FAILURE, \"reallocf\");\n"
1008 "\\&\n"
1009 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
1010 " if (reqs[nreqs - 1] == NULL)\n"
1011 " err(EXIT_FAILURE, \"calloc\");\n"
1012 "\\&\n"
1013 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1014 " }\n"
1015 "\\&\n"
1016 " /* Queue nreqs_base..nreqs requests. */\n"
1017 "\\&\n"
1018 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1019 " nreqs - nreqs_base, NULL);\n"
1020 " if (ret) {\n"
1021 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1022 " gai_strerror(ret));\n"
1023 " exit(EXIT_FAILURE);\n"
1024 " }\n"
1025 "}\n"
1026 "\\&\n"
1027 "/* Wait until at least one of specified requests completes. */\n"
1028 "static void\n"
1029 "wait_requests(void)\n"
1030 "{\n"
1031 " char *id;\n"
1032 " int ret;\n"
1033 " size_t n;\n"
1034 " struct gaicb const **wait_reqs;\n"
1035 "\\&\n"
1036 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1037 " if (wait_reqs == NULL)\n"
1038 " err(EXIT_FAILURE, \"calloc\");\n"
1039 "\\&\n"
1040 " /* NULL elements are ignored by gai_suspend(). */\n"
1041 "\\&\n"
1042 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1043 " n = atoi(id);\n"
1044 "\\&\n"
1045 " if (n E<gt>= nreqs) {\n"
1046 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1047 " return;\n"
1048 " }\n"
1049 "\\&\n"
1050 " wait_reqs[n] = reqs[n];\n"
1051 " }\n"
1052 "\\&\n"
1053 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1054 " if (ret) {\n"
1055 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1056 " return;\n"
1057 " }\n"
1058 "\\&\n"
1059 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1060 " if (wait_reqs[i] == NULL)\n"
1061 " continue;\n"
1062 "\\&\n"
1063 " ret = gai_error(reqs[i]);\n"
1064 " if (ret == EAI_INPROGRESS)\n"
1065 " continue;\n"
1066 "\\&\n"
1067 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1068 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1069 " }\n"
1070 "}\n"
1071 "\\&\n"
1072 "/* Cancel specified requests. */\n"
1073 "static void\n"
1074 "cancel_requests(void)\n"
1075 "{\n"
1076 " char *id;\n"
1077 " int ret;\n"
1078 " size_t n;\n"
1079 "\\&\n"
1080 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1081 " n = atoi(id);\n"
1082 "\\&\n"
1083 " if (n E<gt>= nreqs) {\n"
1084 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1085 " return;\n"
1086 " }\n"
1087 "\\&\n"
1088 " ret = gai_cancel(reqs[n]);\n"
1089 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1090 " gai_strerror(ret));\n"
1091 " }\n"
1092 "}\n"
1093 "\\&\n"
1094 "/* List all requests. */\n"
1095 "static void\n"
1096 "list_requests(void)\n"
1097 "{\n"
1098 " int ret;\n"
1099 " char host[NI_MAXHOST];\n"
1100 " struct addrinfo *res;\n"
1101 "\\&\n"
1102 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1103 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1104 " ret = gai_error(reqs[i]);\n"
1105 "\\&\n"
1106 " if (!ret) {\n"
1107 " res = reqs[i]-E<gt>ar_result;\n"
1108 "\\&\n"
1109 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1110 " host, sizeof(host),\n"
1111 " NULL, 0, NI_NUMERICHOST);\n"
1112 " if (ret) {\n"
1113 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1114 " gai_strerror(ret));\n"
1115 " exit(EXIT_FAILURE);\n"
1116 " }\n"
1117 " puts(host);\n"
1118 " } else {\n"
1119 " puts(gai_strerror(ret));\n"
1120 " }\n"
1121 " }\n"
1122 "}\n"
1123 "\\&\n"
1124 "int\n"
1125 "main(void)\n"
1126 "{\n"
1127 " char *cmdline;\n"
1128 " char *cmd;\n"
1129 "\\&\n"
1130 " while ((cmdline = getcmd()) != NULL) {\n"
1131 " cmd = strtok(cmdline, \" \");\n"
1132 "\\&\n"
1133 " if (cmd == NULL) {\n"
1134 " list_requests();\n"
1135 " } else {\n"
1136 " switch (cmd[0]) {\n"
1137 " case \\[aq]a\\[aq]:\n"
1138 " add_requests();\n"
1139 " break;\n"
1140 " case \\[aq]w\\[aq]:\n"
1141 " wait_requests();\n"
1142 " break;\n"
1143 " case \\[aq]c\\[aq]:\n"
1144 " cancel_requests();\n"
1145 " break;\n"
1146 " case \\[aq]l\\[aq]:\n"
1147 " list_requests();\n"
1148 " break;\n"
1149 " default:\n"
1150 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1151 " break;\n"
1152 " }\n"
1153 " }\n"
1154 " }\n"
1155 " exit(EXIT_SUCCESS);\n"
1156 "}\n"
1157 msgstr ""
1158 "#define _GNU_SOURCE\n"
1159 "#include E<lt>assert.hE<gt>\n"
1160 "#include E<lt>err.hE<gt>\n"
1161 "#include E<lt>netdb.hE<gt>\n"
1162 "#include E<lt>stdio.hE<gt>\n"
1163 "#include E<lt>stdlib.hE<gt>\n"
1164 "#include E<lt>string.hE<gt>\n"
1165 "\\&\n"
1166 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
1167 "\\&\n"
1168 "#define REALLOCF(ptr, n, type) "
1169 " \\[rs]\n"
1170 "({ "
1171 " \\[rs]\n"
1172 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); "
1173 " \\[rs]\n"
1174 " "
1175 " \\[rs]\n"
1176 " (type *) reallocarrayf(ptr, n, sizeof(type)); "
1177 " \\[rs]\n"
1178 "})\n"
1179 "\\&\n"
1180 "static struct gaicb **reqs = NULL;\n"
1181 "static size_t nreqs = 0;\n"
1182 "\\&\n"
1183 "static inline void *\n"
1184 "reallocarrayf(void *p, size_t n, size_t size)\n"
1185 "{\n"
1186 " void *q;\n"
1187 "\\&\n"
1188 " q = reallocarray(p, n, size);\n"
1189 " if (q == NULL && n != 0 && size != 0)\n"
1190 " free(p);\n"
1191 " return q;\n"
1192 "}\n"
1193 "\\&\n"
1194 "static char *\n"
1195 "getcmd(void)\n"
1196 "{\n"
1197 " static char buf[256];\n"
1198 "\\&\n"
1199 " fputs(\"E<gt> \", stdout);\n"
1200 " fflush(stdout);\n"
1201 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
1202 " return NULL;\n"
1203 "\\&\n"
1204 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
1205 " buf[strlen(buf) - 1] = 0;\n"
1206 "\\&\n"
1207 " return buf;\n"
1208 "}\n"
1209 "\\&\n"
1210 "/* Add requests for specified hostnames. */\n"
1211 "static void\n"
1212 "add_requests(void)\n"
1213 "{\n"
1214 " size_t nreqs_base = nreqs;\n"
1215 " char *host;\n"
1216 " int ret;\n"
1217 "\\&\n"
1218 " while ((host = strtok(NULL, \" \"))) {\n"
1219 " nreqs++;\n"
1220 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
1221 " if (reqs == NULL)\n"
1222 " err(EXIT_FAILURE, \"reallocf\");\n"
1223 "\\&\n"
1224 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
1225 " if (reqs[nreqs - 1] == NULL)\n"
1226 " err(EXIT_FAILURE, \"calloc\");\n"
1227 "\\&\n"
1228 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1229 " }\n"
1230 "\\&\n"
1231 " /* Queue nreqs_base..nreqs requests. */\n"
1232 "\\&\n"
1233 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1234 " nreqs - nreqs_base, NULL);\n"
1235 " if (ret) {\n"
1236 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1237 " gai_strerror(ret));\n"
1238 " exit(EXIT_FAILURE);\n"
1239 " }\n"
1240 "}\n"
1241 "\\&\n"
1242 "/* Wait until at least one of specified requests completes. */\n"
1243 "static void\n"
1244 "wait_requests(void)\n"
1245 "{\n"
1246 " char *id;\n"
1247 " int ret;\n"
1248 " size_t n;\n"
1249 " struct gaicb const **wait_reqs;\n"
1250 "\\&\n"
1251 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1252 " if (wait_reqs == NULL)\n"
1253 " err(EXIT_FAILURE, \"calloc\");\n"
1254 "\\&\n"
1255 " /* NULL elements are ignored by gai_suspend(). */\n"
1256 "\\&\n"
1257 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1258 " n = atoi(id);\n"
1259 "\\&\n"
1260 " if (n E<gt>= nreqs) {\n"
1261 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1262 " return;\n"
1263 " }\n"
1264 "\\&\n"
1265 " wait_reqs[n] = reqs[n];\n"
1266 " }\n"
1267 "\\&\n"
1268 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1269 " if (ret) {\n"
1270 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1271 " return;\n"
1272 " }\n"
1273 "\\&\n"
1274 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1275 " if (wait_reqs[i] == NULL)\n"
1276 " continue;\n"
1277 "\\&\n"
1278 " ret = gai_error(reqs[i]);\n"
1279 " if (ret == EAI_INPROGRESS)\n"
1280 " continue;\n"
1281 "\\&\n"
1282 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1283 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1284 " }\n"
1285 "}\n"
1286 "\\&\n"
1287 "/* Cancel specified requests. */\n"
1288 "static void\n"
1289 "cancel_requests(void)\n"
1290 "{\n"
1291 " char *id;\n"
1292 " int ret;\n"
1293 " size_t n;\n"
1294 "\\&\n"
1295 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1296 " n = atoi(id);\n"
1297 "\\&\n"
1298 " if (n E<gt>= nreqs) {\n"
1299 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1300 " return;\n"
1301 " }\n"
1302 "\\&\n"
1303 " ret = gai_cancel(reqs[n]);\n"
1304 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1305 " gai_strerror(ret));\n"
1306 " }\n"
1307 "}\n"
1308 "\\&\n"
1309 "/* List all requests. */\n"
1310 "static void\n"
1311 "list_requests(void)\n"
1312 "{\n"
1313 " int ret;\n"
1314 " char host[NI_MAXHOST];\n"
1315 " struct addrinfo *res;\n"
1316 "\\&\n"
1317 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1318 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1319 " ret = gai_error(reqs[i]);\n"
1320 "\\&\n"
1321 " if (!ret) {\n"
1322 " res = reqs[i]-E<gt>ar_result;\n"
1323 "\\&\n"
1324 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1325 " host, sizeof(host),\n"
1326 " NULL, 0, NI_NUMERICHOST);\n"
1327 " if (ret) {\n"
1328 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1329 " gai_strerror(ret));\n"
1330 " exit(EXIT_FAILURE);\n"
1331 " }\n"
1332 " puts(host);\n"
1333 " } else {\n"
1334 " puts(gai_strerror(ret));\n"
1335 " }\n"
1336 " }\n"
1337 "}\n"
1338 "\\&\n"
1339 "int\n"
1340 "main(void)\n"
1341 "{\n"
1342 " char *cmdline;\n"
1343 " char *cmd;\n"
1344 "\\&\n"
1345 " while ((cmdline = getcmd()) != NULL) {\n"
1346 " cmd = strtok(cmdline, \" \");\n"
1347 "\\&\n"
1348 " if (cmd == NULL) {\n"
1349 " list_requests();\n"
1350 " } else {\n"
1351 " switch (cmd[0]) {\n"
1352 " case \\[aq]a\\[aq]:\n"
1353 " add_requests();\n"
1354 " break;\n"
1355 " case \\[aq]w\\[aq]:\n"
1356 " wait_requests();\n"
1357 " break;\n"
1358 " case \\[aq]c\\[aq]:\n"
1359 " cancel_requests();\n"
1360 " break;\n"
1361 " case \\[aq]l\\[aq]:\n"
1362 " list_requests();\n"
1363 " break;\n"
1364 " default:\n"
1365 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1366 " break;\n"
1367 " }\n"
1368 " }\n"
1369 " }\n"
1370 " exit(EXIT_SUCCESS);\n"
1371 "}\n"
1372
1373 #. SRC END
1374 #. type: SH
1375 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1376 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1377 #, no-wrap
1378 msgid "SEE ALSO"
1379 msgstr "انظر أيضًا"
1380
1381 #. type: Plain text
1382 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1383 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1384 msgid ""
1385 "B<getaddrinfo>(3), B<inet>(3), B<lio_listio>(3), B<hostname>(7), B<ip>(7), "
1386 "B<sigevent>(3type)"
1387 msgstr ""
1388 "B<getaddrinfo>(3), B<inet>(3), B<lio_listio>(3), B<hostname>(7), B<ip>(7), "
1389 "B<sigevent>(3type)"
1390
1391 #. type: TH
1392 #: debian-trixie
1393 #, no-wrap
1394 msgid "2024-06-15"
1395 msgstr "15 يونيو 2024"
1396
1397 #. type: TH
1398 #: debian-trixie
1399 #, no-wrap
1400 msgid "Linux man-pages 6.9.1"
1401 msgstr "صفحات دليل لينكس 6.9.1"
1402
1403 #. type: Plain text
1404 #: debian-trixie
1405 msgid "Asynchronous name lookup library (I<libanl>, I<-lanl>)"
1406 msgstr "مكتبة البحث عن الأسماء غير المتزامنة (I<libanl>, I<-lanl>)"
1407
1408 #. type: Plain text
1409 #: debian-trixie
1410 #, no-wrap
1411 msgid ""
1412 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict],>\n"
1413 "B< int >I<nitems>B<, struct sigevent *restrict >I<sevp>B<);"
1414 ">\n"
1415 "B<int gai_suspend(const struct gaicb *const >I<list>B<[], int >I<nitems>B<,>\n"
1416 "B< const struct timespec *>I<timeout>B<);>\n"
1417 msgstr ""
1418 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict],>\n"
1419 "B< int >I<nitems>B<, struct sigevent *restrict >I<sevp>B<);"
1420 ">\n"
1421 "B<int gai_suspend(const struct gaicb *const >I<list>B<[], int >I<nitems>B<,>\n"
1422 "B< const struct timespec *>I<timeout>B<);>\n"
1423
1424 #. type: Plain text
1425 #: debian-trixie
1426 msgid ""
1427 "The array I<list> specifies the look-up requests to process. The I<nitems> "
1428 "argument specifies the number of elements in I<list>. The requested look-up "
1429 "operations are started in parallel. NULL elements in I<list> are ignored. "
1430 "Each request is described by a I<gaicb> structure, defined as follows:"
1431 msgstr ""
1432 "المصفوفة I<list> تحدد طلبات البحث التي ستُعالج. المعامل I<nitems> يحدد عدد "
1433 "العناصر في I<list>. تُبدأ عمليات البحث المطلوبة بالتوازي. تُتجاهل العناصر"
1434 " NULL "
1435 "في I<list>. يُوصف كل طلب بهيكل I<gaicb>، المُعرَّف كالتالي:"
1436
1437 #. type: Plain text
1438 #: debian-trixie
1439 msgid ""
1440 "The B<gai_suspend>() function suspends execution of the calling thread, "
1441 "waiting for the completion of one or more requests in the array I<list>. "
1442 "The I<nitems> argument specifies the size of the array I<list>. The call "
1443 "blocks until one of the following occurs:"
1444 msgstr ""
1445 "الدالة B<gai_suspend>() تعلق تنفيذ الخيط المستدعي، منتظرة إكمال طلب واحد أو "
1446 "أكثر في المصفوفة I<list>. تُحدد الوسيطة I<nitems> حجم المصفوفة I<list>. يحجب "
1447 "الاستدعاء حتى يحدث أحد التالي:"
1448
1449 #. type: Plain text
1450 #: debian-trixie fedora-44 fedora-rawhide
1451 #, no-wrap
1452 msgid ""
1453 "$ B<./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>\n"
1454 "mirrors.kernel.org: 139.178.88.99\n"
1455 "enoent.linuxfoundation.org: Name or service not known\n"
1456 "gnu.org: 209.51.188.116\n"
1457 msgstr ""
1458 "$ B<./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>\n"
1459 "mirrors.kernel.org: 139.178.88.99\n"
1460 "enoent.linuxfoundation.org: Name or service not known\n"
1461 "gnu.org: 209.51.188.116\n"
1462
1463 #. type: Plain text
1464 #: debian-trixie fedora-44 fedora-rawhide
1465 #, no-wrap
1466 msgid ""
1467 "$ B<./a.out>\n"
1468 "E<gt> a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n"
1469 "E<gt> c 2\n"
1470 "[2] gnu.org: Request not canceled\n"
1471 "E<gt> w 0 1\n"
1472 "[00] mirrors.kernel.org: Finished\n"
1473 "E<gt> l\n"
1474 "[00] mirrors.kernel.org: 139.178.88.99\n"
1475 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
1476 "[02] gnu.org: 209.51.188.116\n"
1477 "E<gt> l\n"
1478 "[00] mirrors.kernel.org: 139.178.88.99\n"
1479 "[01] enoent.linuxfoundation.org: Name or service not known\n"
1480 "[02] gnu.org: 209.51.188.116\n"
1481 msgstr ""
1482 "$ B<./a.out>\n"
1483 "E<gt> a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n"
1484 "E<gt> c 2\n"
1485 "[2] gnu.org: Request not canceled\n"
1486 "E<gt> w 0 1\n"
1487 "[00] mirrors.kernel.org: Finished\n"
1488 "E<gt> l\n"
1489 "[00] mirrors.kernel.org: 139.178.88.99\n"
1490 "[01] enoent.linuxfoundation.org: Processing request in progress\n"
1491 "[02] gnu.org: 209.51.188.116\n"
1492 "E<gt> l\n"
1493 "[00] mirrors.kernel.org: 139.178.88.99\n"
1494 "[01] enoent.linuxfoundation.org: Name or service not known\n"
1495 "[02] gnu.org: 209.51.188.116\n"
1496
1497 #. type: Plain text
1498 #: debian-trixie
1499 #, no-wrap
1500 msgid ""
1501 "#define _GNU_SOURCE\n"
1502 "#include E<lt>assert.hE<gt>\n"
1503 "#include E<lt>err.hE<gt>\n"
1504 "#include E<lt>netdb.hE<gt>\n"
1505 "#include E<lt>stdio.hE<gt>\n"
1506 "#include E<lt>stdlib.hE<gt>\n"
1507 "#include E<lt>string.hE<gt>\n"
1508 "\\&\n"
1509 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
1510 "\\&\n"
1511 "#define REALLOCF(ptr, n, type) "
1512 " \\[rs]\n"
1513 "({ "
1514 " \\[rs]\n"
1515 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); "
1516 " \\[rs]\n"
1517 " "
1518 " \\[rs]\n"
1519 " (type *) reallocarrayf(ptr, n, sizeof(type)); "
1520 " \\[rs]\n"
1521 "})\n"
1522 "\\&\n"
1523 "static struct gaicb **reqs = NULL;\n"
1524 "static size_t nreqs = 0;\n"
1525 "\\&\n"
1526 "static inline void *\n"
1527 "reallocarrayf(void *p, size_t nmemb, size_t size)\n"
1528 "{\n"
1529 " void *q;\n"
1530 "\\&\n"
1531 " q = reallocarray(p, nmemb, size);\n"
1532 " if (q == NULL && nmemb != 0 && size != 0)\n"
1533 " free(p);\n"
1534 " return q;\n"
1535 "}\n"
1536 "\\&\n"
1537 "static char *\n"
1538 "getcmd(void)\n"
1539 "{\n"
1540 " static char buf[256];\n"
1541 "\\&\n"
1542 " fputs(\"E<gt> \", stdout); fflush(stdout);\n"
1543 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
1544 " return NULL;\n"
1545 "\\&\n"
1546 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
1547 " buf[strlen(buf) - 1] = 0;\n"
1548 "\\&\n"
1549 " return buf;\n"
1550 "}\n"
1551 "\\&\n"
1552 "/* Add requests for specified hostnames. */\n"
1553 "static void\n"
1554 "add_requests(void)\n"
1555 "{\n"
1556 " size_t nreqs_base = nreqs;\n"
1557 " char *host;\n"
1558 " int ret;\n"
1559 "\\&\n"
1560 " while ((host = strtok(NULL, \" \"))) {\n"
1561 " nreqs++;\n"
1562 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
1563 " if (reqs == NULL)\n"
1564 " err(EXIT_FAILURE, \"reallocf\");\n"
1565 "\\&\n"
1566 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
1567 " if (reqs[nreqs - 1] == NULL)\n"
1568 " err(EXIT_FAILURE, \"calloc\");\n"
1569 "\\&\n"
1570 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1571 " }\n"
1572 "\\&\n"
1573 " /* Queue nreqs_base..nreqs requests. */\n"
1574 "\\&\n"
1575 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1576 " nreqs - nreqs_base, NULL);\n"
1577 " if (ret) {\n"
1578 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1579 " gai_strerror(ret));\n"
1580 " exit(EXIT_FAILURE);\n"
1581 " }\n"
1582 "}\n"
1583 "\\&\n"
1584 "/* Wait until at least one of specified requests completes. */\n"
1585 "static void\n"
1586 "wait_requests(void)\n"
1587 "{\n"
1588 " char *id;\n"
1589 " int ret;\n"
1590 " size_t n;\n"
1591 " struct gaicb const **wait_reqs;\n"
1592 "\\&\n"
1593 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1594 " if (wait_reqs == NULL)\n"
1595 " err(EXIT_FAILURE, \"calloc\");\n"
1596 "\\&\n"
1597 " /* NULL elements are ignored by gai_suspend(). */\n"
1598 "\\&\n"
1599 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1600 " n = atoi(id);\n"
1601 "\\&\n"
1602 " if (n E<gt>= nreqs) {\n"
1603 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1604 " return;\n"
1605 " }\n"
1606 "\\&\n"
1607 " wait_reqs[n] = reqs[n];\n"
1608 " }\n"
1609 "\\&\n"
1610 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1611 " if (ret) {\n"
1612 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1613 " return;\n"
1614 " }\n"
1615 "\\&\n"
1616 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1617 " if (wait_reqs[i] == NULL)\n"
1618 " continue;\n"
1619 "\\&\n"
1620 " ret = gai_error(reqs[i]);\n"
1621 " if (ret == EAI_INPROGRESS)\n"
1622 " continue;\n"
1623 "\\&\n"
1624 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1625 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1626 " }\n"
1627 "}\n"
1628 "\\&\n"
1629 "/* Cancel specified requests. */\n"
1630 "static void\n"
1631 "cancel_requests(void)\n"
1632 "{\n"
1633 " char *id;\n"
1634 " int ret;\n"
1635 " size_t n;\n"
1636 "\\&\n"
1637 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1638 " n = atoi(id);\n"
1639 "\\&\n"
1640 " if (n E<gt>= nreqs) {\n"
1641 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1642 " return;\n"
1643 " }\n"
1644 "\\&\n"
1645 " ret = gai_cancel(reqs[n]);\n"
1646 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1647 " gai_strerror(ret));\n"
1648 " }\n"
1649 "}\n"
1650 "\\&\n"
1651 "/* List all requests. */\n"
1652 "static void\n"
1653 "list_requests(void)\n"
1654 "{\n"
1655 " int ret;\n"
1656 " char host[NI_MAXHOST];\n"
1657 " struct addrinfo *res;\n"
1658 "\\&\n"
1659 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1660 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1661 " ret = gai_error(reqs[i]);\n"
1662 "\\&\n"
1663 " if (!ret) {\n"
1664 " res = reqs[i]-E<gt>ar_result;\n"
1665 "\\&\n"
1666 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1667 " host, sizeof(host),\n"
1668 " NULL, 0, NI_NUMERICHOST);\n"
1669 " if (ret) {\n"
1670 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1671 " gai_strerror(ret));\n"
1672 " exit(EXIT_FAILURE);\n"
1673 " }\n"
1674 " puts(host);\n"
1675 " } else {\n"
1676 " puts(gai_strerror(ret));\n"
1677 " }\n"
1678 " }\n"
1679 "}\n"
1680 "\\&\n"
1681 "int\n"
1682 "main(void)\n"
1683 "{\n"
1684 " char *cmdline;\n"
1685 " char *cmd;\n"
1686 "\\&\n"
1687 " while ((cmdline = getcmd()) != NULL) {\n"
1688 " cmd = strtok(cmdline, \" \");\n"
1689 "\\&\n"
1690 " if (cmd == NULL) {\n"
1691 " list_requests();\n"
1692 " } else {\n"
1693 " switch (cmd[0]) {\n"
1694 " case \\[aq]a\\[aq]:\n"
1695 " add_requests();\n"
1696 " break;\n"
1697 " case \\[aq]w\\[aq]:\n"
1698 " wait_requests();\n"
1699 " break;\n"
1700 " case \\[aq]c\\[aq]:\n"
1701 " cancel_requests();\n"
1702 " break;\n"
1703 " case \\[aq]l\\[aq]:\n"
1704 " list_requests();\n"
1705 " break;\n"
1706 " default:\n"
1707 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1708 " break;\n"
1709 " }\n"
1710 " }\n"
1711 " }\n"
1712 " exit(EXIT_SUCCESS);\n"
1713 "}\n"
1714 msgstr ""
1715 "#define _GNU_SOURCE\n"
1716 "#include E<lt>assert.hE<gt>\n"
1717 "#include E<lt>err.hE<gt>\n"
1718 "#include E<lt>netdb.hE<gt>\n"
1719 "#include E<lt>stdio.hE<gt>\n"
1720 "#include E<lt>stdlib.hE<gt>\n"
1721 "#include E<lt>string.hE<gt>\n"
1722 "\\&\n"
1723 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
1724 "\\&\n"
1725 "#define REALLOCF(ptr, n, type) "
1726 " \\[rs]\n"
1727 "({ "
1728 " \\[rs]\n"
1729 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); "
1730 " \\[rs]\n"
1731 " "
1732 " \\[rs]\n"
1733 " (type *) reallocarrayf(ptr, n, sizeof(type)); "
1734 " \\[rs]\n"
1735 "})\n"
1736 "\\&\n"
1737 "static struct gaicb **reqs = NULL;\n"
1738 "static size_t nreqs = 0;\n"
1739 "\\&\n"
1740 "static inline void *\n"
1741 "reallocarrayf(void *p, size_t nmemb, size_t size)\n"
1742 "{\n"
1743 " void *q;\n"
1744 "\\&\n"
1745 " q = reallocarray(p, nmemb, size);\n"
1746 " if (q == NULL && nmemb != 0 && size != 0)\n"
1747 " free(p);\n"
1748 " return q;\n"
1749 "}\n"
1750 "\\&\n"
1751 "static char *\n"
1752 "getcmd(void)\n"
1753 "{\n"
1754 " static char buf[256];\n"
1755 "\\&\n"
1756 " fputs(\"E<gt> \", stdout); fflush(stdout);\n"
1757 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
1758 " return NULL;\n"
1759 "\\&\n"
1760 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
1761 " buf[strlen(buf) - 1] = 0;\n"
1762 "\\&\n"
1763 " return buf;\n"
1764 "}\n"
1765 "\\&\n"
1766 "/* Add requests for specified hostnames. */\n"
1767 "static void\n"
1768 "add_requests(void)\n"
1769 "{\n"
1770 " size_t nreqs_base = nreqs;\n"
1771 " char *host;\n"
1772 " int ret;\n"
1773 "\\&\n"
1774 " while ((host = strtok(NULL, \" \"))) {\n"
1775 " nreqs++;\n"
1776 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
1777 " if (reqs == NULL)\n"
1778 " err(EXIT_FAILURE, \"reallocf\");\n"
1779 "\\&\n"
1780 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
1781 " if (reqs[nreqs - 1] == NULL)\n"
1782 " err(EXIT_FAILURE, \"calloc\");\n"
1783 "\\&\n"
1784 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
1785 " }\n"
1786 "\\&\n"
1787 " /* Queue nreqs_base..nreqs requests. */\n"
1788 "\\&\n"
1789 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
1790 " nreqs - nreqs_base, NULL);\n"
1791 " if (ret) {\n"
1792 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
1793 " gai_strerror(ret));\n"
1794 " exit(EXIT_FAILURE);\n"
1795 " }\n"
1796 "}\n"
1797 "\\&\n"
1798 "/* Wait until at least one of specified requests completes. */\n"
1799 "static void\n"
1800 "wait_requests(void)\n"
1801 "{\n"
1802 " char *id;\n"
1803 " int ret;\n"
1804 " size_t n;\n"
1805 " struct gaicb const **wait_reqs;\n"
1806 "\\&\n"
1807 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
1808 " if (wait_reqs == NULL)\n"
1809 " err(EXIT_FAILURE, \"calloc\");\n"
1810 "\\&\n"
1811 " /* NULL elements are ignored by gai_suspend(). */\n"
1812 "\\&\n"
1813 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1814 " n = atoi(id);\n"
1815 "\\&\n"
1816 " if (n E<gt>= nreqs) {\n"
1817 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1818 " return;\n"
1819 " }\n"
1820 "\\&\n"
1821 " wait_reqs[n] = reqs[n];\n"
1822 " }\n"
1823 "\\&\n"
1824 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
1825 " if (ret) {\n"
1826 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
1827 " return;\n"
1828 " }\n"
1829 "\\&\n"
1830 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1831 " if (wait_reqs[i] == NULL)\n"
1832 " continue;\n"
1833 "\\&\n"
1834 " ret = gai_error(reqs[i]);\n"
1835 " if (ret == EAI_INPROGRESS)\n"
1836 " continue;\n"
1837 "\\&\n"
1838 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
1839 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
1840 " }\n"
1841 "}\n"
1842 "\\&\n"
1843 "/* Cancel specified requests. */\n"
1844 "static void\n"
1845 "cancel_requests(void)\n"
1846 "{\n"
1847 " char *id;\n"
1848 " int ret;\n"
1849 " size_t n;\n"
1850 "\\&\n"
1851 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
1852 " n = atoi(id);\n"
1853 "\\&\n"
1854 " if (n E<gt>= nreqs) {\n"
1855 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
1856 " return;\n"
1857 " }\n"
1858 "\\&\n"
1859 " ret = gai_cancel(reqs[n]);\n"
1860 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
1861 " gai_strerror(ret));\n"
1862 " }\n"
1863 "}\n"
1864 "\\&\n"
1865 "/* List all requests. */\n"
1866 "static void\n"
1867 "list_requests(void)\n"
1868 "{\n"
1869 " int ret;\n"
1870 " char host[NI_MAXHOST];\n"
1871 " struct addrinfo *res;\n"
1872 "\\&\n"
1873 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
1874 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
1875 " ret = gai_error(reqs[i]);\n"
1876 "\\&\n"
1877 " if (!ret) {\n"
1878 " res = reqs[i]-E<gt>ar_result;\n"
1879 "\\&\n"
1880 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
1881 " host, sizeof(host),\n"
1882 " NULL, 0, NI_NUMERICHOST);\n"
1883 " if (ret) {\n"
1884 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
1885 " gai_strerror(ret));\n"
1886 " exit(EXIT_FAILURE);\n"
1887 " }\n"
1888 " puts(host);\n"
1889 " } else {\n"
1890 " puts(gai_strerror(ret));\n"
1891 " }\n"
1892 " }\n"
1893 "}\n"
1894 "\\&\n"
1895 "int\n"
1896 "main(void)\n"
1897 "{\n"
1898 " char *cmdline;\n"
1899 " char *cmd;\n"
1900 "\\&\n"
1901 " while ((cmdline = getcmd()) != NULL) {\n"
1902 " cmd = strtok(cmdline, \" \");\n"
1903 "\\&\n"
1904 " if (cmd == NULL) {\n"
1905 " list_requests();\n"
1906 " } else {\n"
1907 " switch (cmd[0]) {\n"
1908 " case \\[aq]a\\[aq]:\n"
1909 " add_requests();\n"
1910 " break;\n"
1911 " case \\[aq]w\\[aq]:\n"
1912 " wait_requests();\n"
1913 " break;\n"
1914 " case \\[aq]c\\[aq]:\n"
1915 " cancel_requests();\n"
1916 " break;\n"
1917 " case \\[aq]l\\[aq]:\n"
1918 " list_requests();\n"
1919 " break;\n"
1920 " default:\n"
1921 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
1922 " break;\n"
1923 " }\n"
1924 " }\n"
1925 " }\n"
1926 " exit(EXIT_SUCCESS);\n"
1927 "}\n"
1928
1929 #. type: TH
1930 #: fedora-44 fedora-rawhide
1931 #, no-wrap
1932 msgid "2024-11-17"
1933 msgstr "17 نوفمبر 2024"
1934
1935 #. type: TH
1936 #: fedora-44 fedora-rawhide
1937 #, no-wrap
1938 msgid "Linux man-pages 6.13"
1939 msgstr "صفحات دليل لينكس 6.13"
1940
1941 #. type: Plain text
1942 #: fedora-44 fedora-rawhide
1943 #, no-wrap
1944 msgid ""
1945 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict],>\n"
1946 "B< int >I<n>B<, struct sigevent *restrict >I<sevp>B<);>\n"
1947 "B<int gai_suspend(const struct gaicb *const >I<list>B<[], int >I<n>B<,>\n"
1948 "B< const struct timespec *>I<timeout>B<);>\n"
1949 msgstr ""
1950 "B<int getaddrinfo_a(int >I<mode>B<, struct gaicb *>I<list>B<[restrict],>\n"
1951 "B< int >I<n>B<, struct sigevent *restrict >I<sevp>B<);>\n"
1952 "B<int gai_suspend(const struct gaicb *const >I<list>B<[], int >I<n>B<,>\n"
1953 "B< const struct timespec *>I<timeout>B<);>\n"
1954
1955 #. type: Plain text
1956 #: fedora-44 fedora-rawhide
1957 #, no-wrap
1958 msgid ""
1959 "#define _GNU_SOURCE\n"
1960 "#include E<lt>assert.hE<gt>\n"
1961 "#include E<lt>err.hE<gt>\n"
1962 "#include E<lt>netdb.hE<gt>\n"
1963 "#include E<lt>stdio.hE<gt>\n"
1964 "#include E<lt>stdlib.hE<gt>\n"
1965 "#include E<lt>string.hE<gt>\n"
1966 "\\&\n"
1967 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
1968 "\\&\n"
1969 "#define REALLOCF(ptr, n, type) "
1970 " \\[rs]\n"
1971 "({ "
1972 " \\[rs]\n"
1973 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); "
1974 " \\[rs]\n"
1975 " "
1976 " \\[rs]\n"
1977 " (type *) reallocarrayf(ptr, n, sizeof(type)); "
1978 " \\[rs]\n"
1979 "})\n"
1980 "\\&\n"
1981 "static struct gaicb **reqs = NULL;\n"
1982 "static size_t nreqs = 0;\n"
1983 "\\&\n"
1984 "static inline void *\n"
1985 "reallocarrayf(void *p, size_t n, size_t size)\n"
1986 "{\n"
1987 " void *q;\n"
1988 "\\&\n"
1989 " q = reallocarray(p, n, size);\n"
1990 " if (q == NULL && n != 0 && size != 0)\n"
1991 " free(p);\n"
1992 " return q;\n"
1993 "}\n"
1994 "\\&\n"
1995 "static char *\n"
1996 "getcmd(void)\n"
1997 "{\n"
1998 " static char buf[256];\n"
1999 "\\&\n"
2000 " fputs(\"E<gt> \", stdout); fflush(stdout);\n"
2001 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
2002 " return NULL;\n"
2003 "\\&\n"
2004 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
2005 " buf[strlen(buf) - 1] = 0;\n"
2006 "\\&\n"
2007 " return buf;\n"
2008 "}\n"
2009 "\\&\n"
2010 "/* Add requests for specified hostnames. */\n"
2011 "static void\n"
2012 "add_requests(void)\n"
2013 "{\n"
2014 " size_t nreqs_base = nreqs;\n"
2015 " char *host;\n"
2016 " int ret;\n"
2017 "\\&\n"
2018 " while ((host = strtok(NULL, \" \"))) {\n"
2019 " nreqs++;\n"
2020 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
2021 " if (reqs == NULL)\n"
2022 " err(EXIT_FAILURE, \"reallocf\");\n"
2023 "\\&\n"
2024 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
2025 " if (reqs[nreqs - 1] == NULL)\n"
2026 " err(EXIT_FAILURE, \"calloc\");\n"
2027 "\\&\n"
2028 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
2029 " }\n"
2030 "\\&\n"
2031 " /* Queue nreqs_base..nreqs requests. */\n"
2032 "\\&\n"
2033 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
2034 " nreqs - nreqs_base, NULL);\n"
2035 " if (ret) {\n"
2036 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
2037 " gai_strerror(ret));\n"
2038 " exit(EXIT_FAILURE);\n"
2039 " }\n"
2040 "}\n"
2041 "\\&\n"
2042 "/* Wait until at least one of specified requests completes. */\n"
2043 "static void\n"
2044 "wait_requests(void)\n"
2045 "{\n"
2046 " char *id;\n"
2047 " int ret;\n"
2048 " size_t n;\n"
2049 " struct gaicb const **wait_reqs;\n"
2050 "\\&\n"
2051 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
2052 " if (wait_reqs == NULL)\n"
2053 " err(EXIT_FAILURE, \"calloc\");\n"
2054 "\\&\n"
2055 " /* NULL elements are ignored by gai_suspend(). */\n"
2056 "\\&\n"
2057 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
2058 " n = atoi(id);\n"
2059 "\\&\n"
2060 " if (n E<gt>= nreqs) {\n"
2061 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
2062 " return;\n"
2063 " }\n"
2064 "\\&\n"
2065 " wait_reqs[n] = reqs[n];\n"
2066 " }\n"
2067 "\\&\n"
2068 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
2069 " if (ret) {\n"
2070 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
2071 " return;\n"
2072 " }\n"
2073 "\\&\n"
2074 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
2075 " if (wait_reqs[i] == NULL)\n"
2076 " continue;\n"
2077 "\\&\n"
2078 " ret = gai_error(reqs[i]);\n"
2079 " if (ret == EAI_INPROGRESS)\n"
2080 " continue;\n"
2081 "\\&\n"
2082 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
2083 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
2084 " }\n"
2085 "}\n"
2086 "\\&\n"
2087 "/* Cancel specified requests. */\n"
2088 "static void\n"
2089 "cancel_requests(void)\n"
2090 "{\n"
2091 " char *id;\n"
2092 " int ret;\n"
2093 " size_t n;\n"
2094 "\\&\n"
2095 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
2096 " n = atoi(id);\n"
2097 "\\&\n"
2098 " if (n E<gt>= nreqs) {\n"
2099 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
2100 " return;\n"
2101 " }\n"
2102 "\\&\n"
2103 " ret = gai_cancel(reqs[n]);\n"
2104 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
2105 " gai_strerror(ret));\n"
2106 " }\n"
2107 "}\n"
2108 "\\&\n"
2109 "/* List all requests. */\n"
2110 "static void\n"
2111 "list_requests(void)\n"
2112 "{\n"
2113 " int ret;\n"
2114 " char host[NI_MAXHOST];\n"
2115 " struct addrinfo *res;\n"
2116 "\\&\n"
2117 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
2118 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
2119 " ret = gai_error(reqs[i]);\n"
2120 "\\&\n"
2121 " if (!ret) {\n"
2122 " res = reqs[i]-E<gt>ar_result;\n"
2123 "\\&\n"
2124 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
2125 " host, sizeof(host),\n"
2126 " NULL, 0, NI_NUMERICHOST);\n"
2127 " if (ret) {\n"
2128 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
2129 " gai_strerror(ret));\n"
2130 " exit(EXIT_FAILURE);\n"
2131 " }\n"
2132 " puts(host);\n"
2133 " } else {\n"
2134 " puts(gai_strerror(ret));\n"
2135 " }\n"
2136 " }\n"
2137 "}\n"
2138 "\\&\n"
2139 "int\n"
2140 "main(void)\n"
2141 "{\n"
2142 " char *cmdline;\n"
2143 " char *cmd;\n"
2144 "\\&\n"
2145 " while ((cmdline = getcmd()) != NULL) {\n"
2146 " cmd = strtok(cmdline, \" \");\n"
2147 "\\&\n"
2148 " if (cmd == NULL) {\n"
2149 " list_requests();\n"
2150 " } else {\n"
2151 " switch (cmd[0]) {\n"
2152 " case \\[aq]a\\[aq]:\n"
2153 " add_requests();\n"
2154 " break;\n"
2155 " case \\[aq]w\\[aq]:\n"
2156 " wait_requests();\n"
2157 " break;\n"
2158 " case \\[aq]c\\[aq]:\n"
2159 " cancel_requests();\n"
2160 " break;\n"
2161 " case \\[aq]l\\[aq]:\n"
2162 " list_requests();\n"
2163 " break;\n"
2164 " default:\n"
2165 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
2166 " break;\n"
2167 " }\n"
2168 " }\n"
2169 " }\n"
2170 " exit(EXIT_SUCCESS);\n"
2171 "}\n"
2172 msgstr ""
2173 "#define _GNU_SOURCE\n"
2174 "#include E<lt>assert.hE<gt>\n"
2175 "#include E<lt>err.hE<gt>\n"
2176 "#include E<lt>netdb.hE<gt>\n"
2177 "#include E<lt>stdio.hE<gt>\n"
2178 "#include E<lt>stdlib.hE<gt>\n"
2179 "#include E<lt>string.hE<gt>\n"
2180 "\\&\n"
2181 "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n"
2182 "\\&\n"
2183 "#define REALLOCF(ptr, n, type) "
2184 " \\[rs]\n"
2185 "({ "
2186 " \\[rs]\n"
2187 " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); "
2188 " \\[rs]\n"
2189 " "
2190 " \\[rs]\n"
2191 " (type *) reallocarrayf(ptr, n, sizeof(type)); "
2192 " \\[rs]\n"
2193 "})\n"
2194 "\\&\n"
2195 "static struct gaicb **reqs = NULL;\n"
2196 "static size_t nreqs = 0;\n"
2197 "\\&\n"
2198 "static inline void *\n"
2199 "reallocarrayf(void *p, size_t n, size_t size)\n"
2200 "{\n"
2201 " void *q;\n"
2202 "\\&\n"
2203 " q = reallocarray(p, n, size);\n"
2204 " if (q == NULL && n != 0 && size != 0)\n"
2205 " free(p);\n"
2206 " return q;\n"
2207 "}\n"
2208 "\\&\n"
2209 "static char *\n"
2210 "getcmd(void)\n"
2211 "{\n"
2212 " static char buf[256];\n"
2213 "\\&\n"
2214 " fputs(\"E<gt> \", stdout); fflush(stdout);\n"
2215 " if (fgets(buf, sizeof(buf), stdin) == NULL)\n"
2216 " return NULL;\n"
2217 "\\&\n"
2218 " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n"
2219 " buf[strlen(buf) - 1] = 0;\n"
2220 "\\&\n"
2221 " return buf;\n"
2222 "}\n"
2223 "\\&\n"
2224 "/* Add requests for specified hostnames. */\n"
2225 "static void\n"
2226 "add_requests(void)\n"
2227 "{\n"
2228 " size_t nreqs_base = nreqs;\n"
2229 " char *host;\n"
2230 " int ret;\n"
2231 "\\&\n"
2232 " while ((host = strtok(NULL, \" \"))) {\n"
2233 " nreqs++;\n"
2234 " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n"
2235 " if (reqs == NULL)\n"
2236 " err(EXIT_FAILURE, \"reallocf\");\n"
2237 "\\&\n"
2238 " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n"
2239 " if (reqs[nreqs - 1] == NULL)\n"
2240 " err(EXIT_FAILURE, \"calloc\");\n"
2241 "\\&\n"
2242 " reqs[nreqs - 1]-E<gt>ar_name = strdup(host);\n"
2243 " }\n"
2244 "\\&\n"
2245 " /* Queue nreqs_base..nreqs requests. */\n"
2246 "\\&\n"
2247 " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n"
2248 " nreqs - nreqs_base, NULL);\n"
2249 " if (ret) {\n"
2250 " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n"
2251 " gai_strerror(ret));\n"
2252 " exit(EXIT_FAILURE);\n"
2253 " }\n"
2254 "}\n"
2255 "\\&\n"
2256 "/* Wait until at least one of specified requests completes. */\n"
2257 "static void\n"
2258 "wait_requests(void)\n"
2259 "{\n"
2260 " char *id;\n"
2261 " int ret;\n"
2262 " size_t n;\n"
2263 " struct gaicb const **wait_reqs;\n"
2264 "\\&\n"
2265 " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n"
2266 " if (wait_reqs == NULL)\n"
2267 " err(EXIT_FAILURE, \"calloc\");\n"
2268 "\\&\n"
2269 " /* NULL elements are ignored by gai_suspend(). */\n"
2270 "\\&\n"
2271 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
2272 " n = atoi(id);\n"
2273 "\\&\n"
2274 " if (n E<gt>= nreqs) {\n"
2275 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
2276 " return;\n"
2277 " }\n"
2278 "\\&\n"
2279 " wait_reqs[n] = reqs[n];\n"
2280 " }\n"
2281 "\\&\n"
2282 " ret = gai_suspend(wait_reqs, nreqs, NULL);\n"
2283 " if (ret) {\n"
2284 " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n"
2285 " return;\n"
2286 " }\n"
2287 "\\&\n"
2288 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
2289 " if (wait_reqs[i] == NULL)\n"
2290 " continue;\n"
2291 "\\&\n"
2292 " ret = gai_error(reqs[i]);\n"
2293 " if (ret == EAI_INPROGRESS)\n"
2294 " continue;\n"
2295 "\\&\n"
2296 " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-E<gt>ar_name,\n"
2297 " ret == 0 ? \"Finished\" : gai_strerror(ret));\n"
2298 " }\n"
2299 "}\n"
2300 "\\&\n"
2301 "/* Cancel specified requests. */\n"
2302 "static void\n"
2303 "cancel_requests(void)\n"
2304 "{\n"
2305 " char *id;\n"
2306 " int ret;\n"
2307 " size_t n;\n"
2308 "\\&\n"
2309 " while ((id = strtok(NULL, \" \")) != NULL) {\n"
2310 " n = atoi(id);\n"
2311 "\\&\n"
2312 " if (n E<gt>= nreqs) {\n"
2313 " printf(\"Bad request number: %s\\[rs]n\", id);\n"
2314 " return;\n"
2315 " }\n"
2316 "\\&\n"
2317 " ret = gai_cancel(reqs[n]);\n"
2318 " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-E<gt>ar_name,\n"
2319 " gai_strerror(ret));\n"
2320 " }\n"
2321 "}\n"
2322 "\\&\n"
2323 "/* List all requests. */\n"
2324 "static void\n"
2325 "list_requests(void)\n"
2326 "{\n"
2327 " int ret;\n"
2328 " char host[NI_MAXHOST];\n"
2329 " struct addrinfo *res;\n"
2330 "\\&\n"
2331 " for (size_t i = 0; i E<lt> nreqs; i++) {\n"
2332 " printf(\"[%02zu] %s: \", i, reqs[i]-E<gt>ar_name);\n"
2333 " ret = gai_error(reqs[i]);\n"
2334 "\\&\n"
2335 " if (!ret) {\n"
2336 " res = reqs[i]-E<gt>ar_result;\n"
2337 "\\&\n"
2338 " ret = getnameinfo(res-E<gt>ai_addr, res-E<gt>ai_addrlen,\n"
2339 " host, sizeof(host),\n"
2340 " NULL, 0, NI_NUMERICHOST);\n"
2341 " if (ret) {\n"
2342 " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n"
2343 " gai_strerror(ret));\n"
2344 " exit(EXIT_FAILURE);\n"
2345 " }\n"
2346 " puts(host);\n"
2347 " } else {\n"
2348 " puts(gai_strerror(ret));\n"
2349 " }\n"
2350 " }\n"
2351 "}\n"
2352 "\\&\n"
2353 "int\n"
2354 "main(void)\n"
2355 "{\n"
2356 " char *cmdline;\n"
2357 " char *cmd;\n"
2358 "\\&\n"
2359 " while ((cmdline = getcmd()) != NULL) {\n"
2360 " cmd = strtok(cmdline, \" \");\n"
2361 "\\&\n"
2362 " if (cmd == NULL) {\n"
2363 " list_requests();\n"
2364 " } else {\n"
2365 " switch (cmd[0]) {\n"
2366 " case \\[aq]a\\[aq]:\n"
2367 " add_requests();\n"
2368 " break;\n"
2369 " case \\[aq]w\\[aq]:\n"
2370 " wait_requests();\n"
2371 " break;\n"
2372 " case \\[aq]c\\[aq]:\n"
2373 " cancel_requests();\n"
2374 " break;\n"
2375 " case \\[aq]l\\[aq]:\n"
2376 " list_requests();\n"
2377 " break;\n"
2378 " default:\n"
2379 " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n"
2380 " break;\n"
2381 " }\n"
2382 " }\n"
2383 " }\n"
2384 " exit(EXIT_SUCCESS);\n"
2385 "}\n"
2386
2387 #. type: TH
2388 #: mageia-cauldron
2389 #, no-wrap
2390 msgid "Linux man-pages 6.17"
2391 msgstr "صفحات دليل لينكس 6.17"
2392
2393 #. type: TH
2394 #: opensuse-leap-16-1 opensuse-tumbleweed
2395 #, no-wrap
2396 msgid "Linux man-pages (unreleased)"
2397 msgstr "صفحات دليل لينكس (لم تصدر بعد)"
2398