# Arabic translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # زايد السعيدي , 2026. msgid "" msgstr "" "Project-Id-Version: manpages-l10n 4.30.2\n" "POT-Creation-Date: 2026-06-05 06:25+0200\n" "PO-Revision-Date: 2026-06-06 08:53+0400\n" "Last-Translator: Zayed Al-Saidi \n" "Language-Team: Arabic \n" "Language: ar\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 &&" " n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" "X-Generator: Lokalize 23.08.5\n" #. type: TH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "getaddrinfo_a" msgstr "getaddrinfo_a" #. type: TH #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "2026-02-08" msgstr "8 فبراير 2026" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.18" msgstr "صفحات دليل لينكس 6.18" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "الاسم" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "getaddrinfo_a, gai_suspend, gai_error, gai_cancel - asynchronous network " "address and service translation" msgstr "" "getaddrinfo_a, gai_suspend, gai_error, gai_cancel - ترجمة غير متزامنة لعنوان " "الشبكة والخدمة" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "المكتبة" #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed #| msgid "Asynchronous name lookup library (I, I<-lanl>)" msgid "Asynchronous name lookup library (I,\\ I<-lanl>)" msgstr "مكتبة البحث عن الأسماء غير المتزامنة (I,\\ I<-lanl>)" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "موجز" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" "B<#include Enetdb.hE>\n" msgstr "" "B<#define _GNU_SOURCE> /* انظر feature_test_macros(7) */\n" "B<#include Enetdb.hE>\n" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "BIB<, struct gaicb *>IB<[restrict >IB<" "],>\n" "B< int >IB<, struct sigevent *restrict >IB<);>\n" "BIB<[>IB<], int >IB<," ">\n" "B< const struct timespec *>IB<);>\n" msgstr "" "BIB<, struct gaicb *>IB<[restrict >IB<" "],>\n" "B< int >IB<, struct sigevent *restrict >IB<);>\n" "BIB<[>IB<], int >IB<," ">\n" "B< const struct timespec *>IB<);>\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "BIB<);>\n" "BIB<);>\n" msgstr "" "BIB<);>\n" "BIB<);>\n" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "الوصف" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function performs the same task as " "B(3), but allows multiple name look-ups to be performed " "asynchronously, with optional notification on completion of look-up " "operations." msgstr "" "الدالة B() تؤدي نفس مهمة B(3)، لكنها تسمح بإجراء " "عمليات بحث متعددة عن الأسماء بشكل غير متزامن، مع إشعار اختياري عند اكتمال " "عمليات البحث." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The I argument has one of the following values:" msgstr "المعامل I له إحدى القيم التالية:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Perform the look-ups synchronously. The call blocks until the look-ups have " "completed." msgstr "" "إجراء عمليات البحث بشكل متزامن. يُحجَز الاستدعاء حتى تكتمل عمليات البحث." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Perform the look-ups asynchronously. The call returns immediately, and the " "requests are resolved in the background. See the discussion of the I " "argument below." msgstr "" "إجراء عمليات البحث بشكل غير متزامن. يعود الاستدعاء فورًا، وتُحل الطلبات في " "الخلفية. انظر مناقشة المعامل I أدناه." #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The array I specifies the look-up requests to process. The I " "argument specifies the number of elements in I. The requested look-up " "operations are started in parallel. NULL elements in I are ignored. " "Each request is described by a I structure, defined as follows:" msgstr "" "المصفوفة I تحدد طلبات البحث التي ستُعالج. المعامل I يحدد عدد العناصر " "في I. تُبدأ عمليات البحث المطلوبة بالتوازي. تُتجاهل العناصر NULL في " "I. يُوصف كل طلب بهيكل I، المُعرَّف كالتالي:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "struct gaicb {\n" " const char *ar_name;\n" " const char *ar_service;\n" " const struct addrinfo *ar_request;\n" " struct addrinfo *ar_result;\n" "};\n" msgstr "" "struct gaicb {\n" " const char *ar_name;\n" " const char *ar_service;\n" " const struct addrinfo *ar_request;\n" " struct addrinfo *ar_result;\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The elements of this structure correspond to the arguments of " "B(3). Thus, I corresponds to the I argument and " "I to the I argument, identifying an Internet host and a " "service. The I element corresponds to the I argument, " "specifying the criteria for selecting the returned socket address " "structures. Finally, I corresponds to the I argument; you " "do not need to initialize this element, it will be automatically set when " "the request is resolved. The I structure referenced by the last " "two elements is described in B(3)." msgstr "" "عناصر هذا الهيكل تتوافق مع معاملات B(3). لذا، I يتوافق " "مع المعامل I و I مع المعامل I، مُعرِّفًا مضيف" " إنترنت " "وخدمة. العنصر I يتوافق مع المعامل I، مُحددًا معايير اختيار " "هياكل عنوان المقبس المُعادة. أخيرًا، I يتوافق مع المعامل I؛" " لا " "تحتاج لتهيئة هذا العنصر، سيُضبط آليًا عند حل الطلب. هيكل I المُشار " "إليه بالعنصرين الأخيرين موصوف في B(3)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When I is specified as B, notifications about resolved " "requests can be obtained by employing the I structure pointed to " "by the I argument. For the definition and general details of this " "structure, see B(3type). The Isigev_notify> field can " "have the following values:" msgstr "" "عندما يُحدد I كـ B، يمكن الحصول على إشعارات حول الطلبات " "المُحلّة باستخدام هيكل I المُشار إليه بالمعامل I. للتعريف " "والتفاصيل العامة لهذا الهيكل، انظر B(3type). الحقل Isigev_notify> يمكن أن يكون له القيم التالية:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Don't provide any notification." msgstr "لا تُقدم أي إشعار." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. si_pid and si_uid are also set, to the values of the calling process, #. which doesn't provide useful information, so we'll skip mentioning it. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When a look-up completes, generate the signal I for the " "process. See B(3type) for general details. The I field " "of the I structure will be set to B." msgstr "" "عند اكتمال بحث، يُولَّد الإشارة I للعملية. انظر B(3type) " "للتفاصيل العامة. الحقل I من هيكل I سيُضبط إلى " "B." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When a look-up completes, invoke I as if it were the " "start function of a new thread. See B(3type) for details." msgstr "" "عند اكتمال بحث، تُستدعى I كما لو كانت دالة بدء خيط " "جديد. انظر B(3type) للتفاصيل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For B and B, it may be useful to point Isigev_value.sival_ptr> to I." msgstr "" "بالنسبة لـ B و B، قد يكون من المفيد توجيه Isigev_value.sival_ptr> إلى I." #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function suspends execution of the calling thread, " "waiting for the completion of one or more requests in the array I. " "The I argument specifies the size of the array I. The call blocks " "until one of the following occurs:" msgstr "" "الدالة B() تُعلق تنفيذ الخيط المُستدعي، منتظرة اكتمال طلب واحد" " أو " "أكثر في المصفوفة I. المعامل I يحدد حجم المصفوفة I. يُحجَز " "الاستدعاء حتى يحدث أحد التالي:" #. type: IP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "\\[bu]" msgstr "\\[bu]" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "One or more of the operations in I completes." msgstr "تكتمل عملية أو أكثر من العمليات في I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The call is interrupted by a signal that is caught." msgstr "تُقاطع الاستدعاء بإشارة تم التقاطها." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The time interval specified in I elapses. This argument specifies " "a timeout in seconds plus nanoseconds (see B(2) for details of " "the I structure). If I is NULL, then the call blocks " "indefinitely (until one of the events above occurs)." msgstr "" "ينقضي الفاصل الزمني المحدد في I. تحدد هذه الوسيطة مهلة بالثواني " "بالإضافة إلى النانوثانية (انظر B(2) لتفاصيل بنية I). " "إذا كان I NULL، فتحجب الاستدعاء إلى أجل غير مسمى (حتى يقع أحد " "الأحداث أعلاه)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "No explicit indication of which request was completed is given; you must " "determine which request(s) have completed by iterating with B() " "over the list of requests." msgstr "" "لا يُعطى إشارة صريحة عن أي طلب أُكمل؛ يجب عليك تحديد أي الطلبات أُكملت" " بالتكرار " "مع B() على قائمة الطلبات." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function returns the status of the request I: " "either B if the request was not completed yet, 0 if it was " "handled successfully, or an error code if the request could not be resolved." msgstr "" "ترجع الدالة B() حالة الطلب I: إما B إذا لم " "يُكمل الطلب بعد، أو 0 إذا عُولج بنجاح، أو رمز خطأ إذا تعذر حل الطلب." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function cancels the request I. If the request " "has been canceled successfully, the error status of the request will be set " "to B and normal asynchronous notification will be performed. " "The request cannot be canceled if it is currently being processed; in that " "case, it will be handled as if B() has never been called. If " "I is NULL, an attempt is made to cancel all outstanding requests that " "the process has made." msgstr "" "تلغي الدالة B() الطلب I. إذا أُلغي الطلب بنجاح، فتُضبط حالة " "خطأ الطلب إلى B ويُجرى الإعلام غير المتزامن العادي. لا يمكن " "إلغاء الطلب إذا كان يُعالج حاليًا؛ في تلك الحالة، يُعالج كما لو أن " "B() لم تُستدعَ أبدًا. إذا كان I NULL، فتُبذل محاولة لإلغاء" " جميع " "الطلبات المعلقة التي قامت بها العملية." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "قيمة الإرجاع" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function returns 0 if all of the requests have been " "enqueued successfully, or one of the following nonzero error codes:" msgstr "" "ترجع الدالة B() 0 إذا صُفت جميع الطلبات في قائمة الانتظار " "بنجاح، أو أحد رموز الخطأ غير الصفرية التالية:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The resources necessary to enqueue the look-up requests were not available. " "The application may check the error status of each request to determine " "which ones failed." msgstr "" "لم تكن الموارد اللازمة لصف طلبات البحث في قائمة الانتظار متاحة. يمكن للتطبيق " "التحقق من حالة خطأ كل طلب لتحديد أي منها فشل." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Out of memory." msgstr "نفدت الذاكرة." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "I is invalid." msgstr "I غير صالح." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function returns 0 if at least one of the listed " "requests has been completed. Otherwise, it returns one of the following " "nonzero error codes:" msgstr "" "ترجع الدالة B() 0 إذا أُكمل طلب واحد على الأقل من الطلبات " "المدرجة. وإلا، فترجع أحد رموز الخطأ غير الصفرية التالية:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The given timeout expired before any of the requests could be completed." msgstr "انتهت المهلة المعطاة قبل أن يُكمل أي من الطلبات." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "There were no actual requests given to the function." msgstr "لم تُعطَ أي طلبات فعلية للدالة." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A signal has interrupted the function. Note that this interruption might " "have been caused by signal notification of some completed look-up request." msgstr "" "قاطعت إشارة الدالة. لاحظ أن هذا الانقطاع قد يكون ناتجًا عن إعلام إشارة لبعض " "طلبات البحث المكتملة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function can return B for an unfinished " "look-up request, 0 for a successfully completed look-up (as described " "above), one of the error codes that could be returned by B(3), " "or the error code B if the request has been canceled " "explicitly before it could be finished." msgstr "" "يمكن للدالة B() أن ترجع B لطلب بحث غير مكتمل، أو " "0 لبحث أُكمل بنجاح (كما هو موصوف أعلاه)، أو أحد رموز الخطأ التي قد ترجعها " "B(3)، أو رمز الخطأ B إذا أُلغي الطلب صراحةً قبل أن " "يُكمل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The B() function can return one of these values:" msgstr "يمكن للدالة B() أن ترجع إحدى هذه القيم:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The request has been canceled successfully." msgstr "أُلغي الطلب بنجاح." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The request has not been canceled." msgstr "لم يُلغَ الطلب." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The request has already completed." msgstr "اكتمل الطلب بالفعل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B(3) function translates these error codes to a human " "readable string, suitable for error reporting." msgstr "" "ترجم الدالة B(3) رموز الخطأ هذه إلى سلسلة نصية مقروءة للبشر، " "مناسبة للإبلاغ عن الأخطاء." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ATTRIBUTES" msgstr "السمات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For an explanation of the terms used in this section, see B(7)." msgstr "" "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B(7)." #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Interface" msgstr "الواجهة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Attribute" msgstr "السمة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Value" msgstr "القيمة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".na\n" msgstr ".na\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".nh\n" msgstr ".nh\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "B(),\n" "B(),\n" "B(),\n" "B()" msgstr "" "B(),\n" "B(),\n" "B(),\n" "B()" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Thread safety" msgstr "سلامة الخيوط" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "MT-Safe" msgstr "MT-Safe" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "المعايير" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "GNU." msgstr "GNU." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "التاريخ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "glibc 2.2.3." msgstr "glibc 2.2.3." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The interface of B() was modeled after the B(3) " "interface." msgstr "صُممت واجهة B() على غرار واجهة B(3)." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "أمثلة" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Two examples are provided: a simple example that resolves several requests " "in parallel synchronously, and a complex example showing some of the " "asynchronous capabilities." msgstr "" "يُقدَّم مثالان: مثال بسيط يحل عدة طلبات بالتوازي بشكل تزامني، ومثال معقد" " يُظهر " "بعض القدرات اللاتزامنية." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Synchronous example" msgstr "مثال تزامني" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The program below simply resolves several hostnames in parallel, giving a " "speed-up compared to resolving the hostnames sequentially using " "B(3). The program might be used like this:" msgstr "" "يحل البرنامج أدناه ببساطة عدة أسماء مضيفين بالتوازي، مما يُعطي تسريعًا مقارنة " "بحل أسماء المضيفين تسلسليًا باستخدام B(3). يمكن استخدام " "البرنامج هكذا:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "$B< ./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>;\n" "mirrors.kernel.org: 139.178.88.99\n" "enoent.linuxfoundation.org: Name or service not known\n" "gnu.org: 209.51.188.116\n" msgstr "" "$B< ./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>;\n" "mirrors.kernel.org: 139.178.88.99\n" "enoent.linuxfoundation.org: Name or service not known\n" "gnu.org: 209.51.188.116\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Here is the program source code" msgstr "هذا هو الكود المصدري للبرنامج" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Enetdb.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "\\&\n" "#define MALLOC(n, type) ((type *) reallocarray(NULL, n, sizeof(type)))\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int ret;\n" " struct gaicb *reqs[argc - 1];\n" " char host[NI_MAXHOST];\n" " struct addrinfo *res;\n" "\\&\n" " if (argc E 2) {\n" " fprintf(stderr, \"Usage: %s HOST...\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " for (size_t i = 0; i E argc - 1; i++) {\n" " reqs[i] = MALLOC(1, struct gaicb);\n" " if (reqs[i] == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " memset(reqs[i], 0, sizeof(*reqs[0]));\n" " reqs[i]-Ear_name = argv[i + 1];\n" " }\n" "\\&\n" " ret = getaddrinfo_a(GAI_WAIT, reqs, argc - 1, NULL);\n" " if (ret != 0) {\n" " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " for (size_t i = 0; i E argc - 1; i++) {\n" " printf(\"%s: \", reqs[i]-Ear_name);\n" " ret = gai_error(reqs[i]);\n" " if (ret == 0) {\n" " res = reqs[i]-Ear_result;\n" "\\&\n" " ret = getnameinfo(res-Eai_addr, res-Eai_addrlen,\n" " host, sizeof(host),\n" " NULL, 0, NI_NUMERICHOST);\n" " if (ret != 0) {\n" " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" " puts(host);\n" "\\&\n" " } else {\n" " puts(gai_strerror(ret));\n" " }\n" " }\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Enetdb.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "\\&\n" "#define MALLOC(n, type) ((type *) reallocarray(NULL, n, sizeof(type)))\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int ret;\n" " struct gaicb *reqs[argc - 1];\n" " char host[NI_MAXHOST];\n" " struct addrinfo *res;\n" "\\&\n" " if (argc E 2) {\n" " fprintf(stderr, \"Usage: %s HOST...\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " for (size_t i = 0; i E argc - 1; i++) {\n" " reqs[i] = MALLOC(1, struct gaicb);\n" " if (reqs[i] == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " memset(reqs[i], 0, sizeof(*reqs[0]));\n" " reqs[i]-Ear_name = argv[i + 1];\n" " }\n" "\\&\n" " ret = getaddrinfo_a(GAI_WAIT, reqs, argc - 1, NULL);\n" " if (ret != 0) {\n" " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " for (size_t i = 0; i E argc - 1; i++) {\n" " printf(\"%s: \", reqs[i]-Ear_name);\n" " ret = gai_error(reqs[i]);\n" " if (ret == 0) {\n" " res = reqs[i]-Ear_result;\n" "\\&\n" " ret = getnameinfo(res-Eai_addr, res-Eai_addrlen,\n" " host, sizeof(host),\n" " NULL, 0, NI_NUMERICHOST);\n" " if (ret != 0) {\n" " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" " puts(host);\n" "\\&\n" " } else {\n" " puts(gai_strerror(ret));\n" " }\n" " }\n" " exit(EXIT_SUCCESS);\n" "}\n" #. SRC END #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Asynchronous example" msgstr "مثال لاتزامني" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This example shows a simple interactive B() front-end. The " "notification facility is not demonstrated." msgstr "" "يُظهر هذا المثال واجهة أمامية تفاعلية بسيطة لـ B(). لم" " يُوضَّح " "مرفق الإشعار." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "An example session might look like this:" msgstr "قد تبدو جلسة مثال هكذا:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "$B< ./a.out>;\n" "E a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n" "E c 2\n" "[2] gnu.org: Request not canceled\n" "E w 0 1\n" "[00] mirrors.kernel.org: Finished\n" "E l\n" "[00] mirrors.kernel.org: 139.178.88.99\n" "[01] enoent.linuxfoundation.org: Processing request in progress\n" "[02] gnu.org: 209.51.188.116\n" "E l\n" "[00] mirrors.kernel.org: 139.178.88.99\n" "[01] enoent.linuxfoundation.org: Name or service not known\n" "[02] gnu.org: 209.51.188.116\n" msgstr "" "$B< ./a.out>;\n" "E a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n" "E c 2\n" "[2] gnu.org: Request not canceled\n" "E w 0 1\n" "[00] mirrors.kernel.org: Finished\n" "E l\n" "[00] mirrors.kernel.org: 139.178.88.99\n" "[01] enoent.linuxfoundation.org: Processing request in progress\n" "[02] gnu.org: 209.51.188.116\n" "E l\n" "[00] mirrors.kernel.org: 139.178.88.99\n" "[01] enoent.linuxfoundation.org: Name or service not known\n" "[02] gnu.org: 209.51.188.116\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The program source is as follows:" msgstr "المصدر البرمجي للبرنامج كما يلي:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eassert.hE\n" "#include Eerr.hE\n" "#include Enetdb.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "\\&\n" "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n" "\\&\n" "#define REALLOCF(ptr, n, type) " " \\[rs]\n" "({ " " \\[rs]\n" " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); " " \\[rs]\n" " " " \\[rs]\n" " (type *) reallocarrayf(ptr, n, sizeof(type)); " " \\[rs]\n" "})\n" "\\&\n" "static struct gaicb **reqs = NULL;\n" "static size_t nreqs = 0;\n" "\\&\n" "static inline void *\n" "reallocarrayf(void *p, size_t n, size_t size)\n" "{\n" " void *q;\n" "\\&\n" " q = reallocarray(p, n, size);\n" " if (q == NULL && n != 0 && size != 0)\n" " free(p);\n" " return q;\n" "}\n" "\\&\n" "static char *\n" "getcmd(void)\n" "{\n" " static char buf[256];\n" "\\&\n" " fputs(\"E \", stdout);\n" " fflush(stdout);\n" " if (fgets(buf, sizeof(buf), stdin) == NULL)\n" " return NULL;\n" "\\&\n" " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n" " buf[strlen(buf) - 1] = 0;\n" "\\&\n" " return buf;\n" "}\n" "\\&\n" "/* Add requests for specified hostnames. */\n" "static void\n" "add_requests(void)\n" "{\n" " size_t nreqs_base = nreqs;\n" " char *host;\n" " int ret;\n" "\\&\n" " while ((host = strtok(NULL, \" \"))) {\n" " nreqs++;\n" " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n" " if (reqs == NULL)\n" " err(EXIT_FAILURE, \"reallocf\");\n" "\\&\n" " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n" " if (reqs[nreqs - 1] == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " reqs[nreqs - 1]-Ear_name = strdup(host);\n" " }\n" "\\&\n" " /* Queue nreqs_base..nreqs requests. */\n" "\\&\n" " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n" " nreqs - nreqs_base, NULL);\n" " if (ret) {\n" " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" "}\n" "\\&\n" "/* Wait until at least one of specified requests completes. */\n" "static void\n" "wait_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" " struct gaicb const **wait_reqs;\n" "\\&\n" " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n" " if (wait_reqs == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " /* NULL elements are ignored by gai_suspend(). */\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " wait_reqs[n] = reqs[n];\n" " }\n" "\\&\n" " ret = gai_suspend(wait_reqs, nreqs, NULL);\n" " if (ret) {\n" " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n" " return;\n" " }\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " if (wait_reqs[i] == NULL)\n" " continue;\n" "\\&\n" " ret = gai_error(reqs[i]);\n" " if (ret == EAI_INPROGRESS)\n" " continue;\n" "\\&\n" " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-Ear_name,\n" " ret == 0 ? \"Finished\" : gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* Cancel specified requests. */\n" "static void\n" "cancel_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " ret = gai_cancel(reqs[n]);\n" " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-Ear_name,\n" " gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* List all requests. */\n" "static void\n" "list_requests(void)\n" "{\n" " int ret;\n" " char host[NI_MAXHOST];\n" " struct addrinfo *res;\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " printf(\"[%02zu] %s: \", i, reqs[i]-Ear_name);\n" " ret = gai_error(reqs[i]);\n" "\\&\n" " if (!ret) {\n" " res = reqs[i]-Ear_result;\n" "\\&\n" " ret = getnameinfo(res-Eai_addr, res-Eai_addrlen,\n" " host, sizeof(host),\n" " NULL, 0, NI_NUMERICHOST);\n" " if (ret) {\n" " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" " puts(host);\n" " } else {\n" " puts(gai_strerror(ret));\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(void)\n" "{\n" " char *cmdline;\n" " char *cmd;\n" "\\&\n" " while ((cmdline = getcmd()) != NULL) {\n" " cmd = strtok(cmdline, \" \");\n" "\\&\n" " if (cmd == NULL) {\n" " list_requests();\n" " } else {\n" " switch (cmd[0]) {\n" " case \\[aq]a\\[aq]:\n" " add_requests();\n" " break;\n" " case \\[aq]w\\[aq]:\n" " wait_requests();\n" " break;\n" " case \\[aq]c\\[aq]:\n" " cancel_requests();\n" " break;\n" " case \\[aq]l\\[aq]:\n" " list_requests();\n" " break;\n" " default:\n" " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n" " break;\n" " }\n" " }\n" " }\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eassert.hE\n" "#include Eerr.hE\n" "#include Enetdb.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "\\&\n" "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n" "\\&\n" "#define REALLOCF(ptr, n, type) " " \\[rs]\n" "({ " " \\[rs]\n" " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); " " \\[rs]\n" " " " \\[rs]\n" " (type *) reallocarrayf(ptr, n, sizeof(type)); " " \\[rs]\n" "})\n" "\\&\n" "static struct gaicb **reqs = NULL;\n" "static size_t nreqs = 0;\n" "\\&\n" "static inline void *\n" "reallocarrayf(void *p, size_t n, size_t size)\n" "{\n" " void *q;\n" "\\&\n" " q = reallocarray(p, n, size);\n" " if (q == NULL && n != 0 && size != 0)\n" " free(p);\n" " return q;\n" "}\n" "\\&\n" "static char *\n" "getcmd(void)\n" "{\n" " static char buf[256];\n" "\\&\n" " fputs(\"E \", stdout);\n" " fflush(stdout);\n" " if (fgets(buf, sizeof(buf), stdin) == NULL)\n" " return NULL;\n" "\\&\n" " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n" " buf[strlen(buf) - 1] = 0;\n" "\\&\n" " return buf;\n" "}\n" "\\&\n" "/* Add requests for specified hostnames. */\n" "static void\n" "add_requests(void)\n" "{\n" " size_t nreqs_base = nreqs;\n" " char *host;\n" " int ret;\n" "\\&\n" " while ((host = strtok(NULL, \" \"))) {\n" " nreqs++;\n" " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n" " if (reqs == NULL)\n" " err(EXIT_FAILURE, \"reallocf\");\n" "\\&\n" " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n" " if (reqs[nreqs - 1] == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " reqs[nreqs - 1]-Ear_name = strdup(host);\n" " }\n" "\\&\n" " /* Queue nreqs_base..nreqs requests. */\n" "\\&\n" " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n" " nreqs - nreqs_base, NULL);\n" " if (ret) {\n" " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" "}\n" "\\&\n" "/* Wait until at least one of specified requests completes. */\n" "static void\n" "wait_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" " struct gaicb const **wait_reqs;\n" "\\&\n" " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n" " if (wait_reqs == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " /* NULL elements are ignored by gai_suspend(). */\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " wait_reqs[n] = reqs[n];\n" " }\n" "\\&\n" " ret = gai_suspend(wait_reqs, nreqs, NULL);\n" " if (ret) {\n" " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n" " return;\n" " }\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " if (wait_reqs[i] == NULL)\n" " continue;\n" "\\&\n" " ret = gai_error(reqs[i]);\n" " if (ret == EAI_INPROGRESS)\n" " continue;\n" "\\&\n" " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-Ear_name,\n" " ret == 0 ? \"Finished\" : gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* Cancel specified requests. */\n" "static void\n" "cancel_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " ret = gai_cancel(reqs[n]);\n" " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-Ear_name,\n" " gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* List all requests. */\n" "static void\n" "list_requests(void)\n" "{\n" " int ret;\n" " char host[NI_MAXHOST];\n" " struct addrinfo *res;\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " printf(\"[%02zu] %s: \", i, reqs[i]-Ear_name);\n" " ret = gai_error(reqs[i]);\n" "\\&\n" " if (!ret) {\n" " res = reqs[i]-Ear_result;\n" "\\&\n" " ret = getnameinfo(res-Eai_addr, res-Eai_addrlen,\n" " host, sizeof(host),\n" " NULL, 0, NI_NUMERICHOST);\n" " if (ret) {\n" " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" " puts(host);\n" " } else {\n" " puts(gai_strerror(ret));\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(void)\n" "{\n" " char *cmdline;\n" " char *cmd;\n" "\\&\n" " while ((cmdline = getcmd()) != NULL) {\n" " cmd = strtok(cmdline, \" \");\n" "\\&\n" " if (cmd == NULL) {\n" " list_requests();\n" " } else {\n" " switch (cmd[0]) {\n" " case \\[aq]a\\[aq]:\n" " add_requests();\n" " break;\n" " case \\[aq]w\\[aq]:\n" " wait_requests();\n" " break;\n" " case \\[aq]c\\[aq]:\n" " cancel_requests();\n" " break;\n" " case \\[aq]l\\[aq]:\n" " list_requests();\n" " break;\n" " default:\n" " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n" " break;\n" " }\n" " }\n" " }\n" " exit(EXIT_SUCCESS);\n" "}\n" #. SRC END #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "انظر أيضًا" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "B(3), B(3), B(3), B(7), B(7), " "B(3type)" msgstr "" "B(3), B(3), B(3), B(7), B(7), " "B(3type)" #. type: TH #: debian-trixie #, no-wrap msgid "2024-06-15" msgstr "15 يونيو 2024" #. type: TH #: debian-trixie #, no-wrap msgid "Linux man-pages 6.9.1" msgstr "صفحات دليل لينكس 6.9.1" #. type: Plain text #: debian-trixie msgid "Asynchronous name lookup library (I, I<-lanl>)" msgstr "مكتبة البحث عن الأسماء غير المتزامنة (I, I<-lanl>)" #. type: Plain text #: debian-trixie #, no-wrap msgid "" "BIB<, struct gaicb *>IB<[restrict],>\n" "B< int >IB<, struct sigevent *restrict >IB<);" ">\n" "BIB<[], int >IB<,>\n" "B< const struct timespec *>IB<);>\n" msgstr "" "BIB<, struct gaicb *>IB<[restrict],>\n" "B< int >IB<, struct sigevent *restrict >IB<);" ">\n" "BIB<[], int >IB<,>\n" "B< const struct timespec *>IB<);>\n" #. type: Plain text #: debian-trixie msgid "" "The array I specifies the look-up requests to process. The I " "argument specifies the number of elements in I. The requested look-up " "operations are started in parallel. NULL elements in I are ignored. " "Each request is described by a I structure, defined as follows:" msgstr "" "المصفوفة I تحدد طلبات البحث التي ستُعالج. المعامل I يحدد عدد " "العناصر في I. تُبدأ عمليات البحث المطلوبة بالتوازي. تُتجاهل العناصر" " NULL " "في I. يُوصف كل طلب بهيكل I، المُعرَّف كالتالي:" #. type: Plain text #: debian-trixie msgid "" "The B() function suspends execution of the calling thread, " "waiting for the completion of one or more requests in the array I. " "The I argument specifies the size of the array I. The call " "blocks until one of the following occurs:" msgstr "" "الدالة B() تعلق تنفيذ الخيط المستدعي، منتظرة إكمال طلب واحد أو " "أكثر في المصفوفة I. تُحدد الوسيطة I حجم المصفوفة I. يحجب " "الاستدعاء حتى يحدث أحد التالي:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "$ B<./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>\n" "mirrors.kernel.org: 139.178.88.99\n" "enoent.linuxfoundation.org: Name or service not known\n" "gnu.org: 209.51.188.116\n" msgstr "" "$ B<./a.out mirrors.kernel.org enoent.linuxfoundation.org gnu.org>\n" "mirrors.kernel.org: 139.178.88.99\n" "enoent.linuxfoundation.org: Name or service not known\n" "gnu.org: 209.51.188.116\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "$ B<./a.out>\n" "E a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n" "E c 2\n" "[2] gnu.org: Request not canceled\n" "E w 0 1\n" "[00] mirrors.kernel.org: Finished\n" "E l\n" "[00] mirrors.kernel.org: 139.178.88.99\n" "[01] enoent.linuxfoundation.org: Processing request in progress\n" "[02] gnu.org: 209.51.188.116\n" "E l\n" "[00] mirrors.kernel.org: 139.178.88.99\n" "[01] enoent.linuxfoundation.org: Name or service not known\n" "[02] gnu.org: 209.51.188.116\n" msgstr "" "$ B<./a.out>\n" "E a mirrors.kernel.org enoent.linuxfoundation.org gnu.org\n" "E c 2\n" "[2] gnu.org: Request not canceled\n" "E w 0 1\n" "[00] mirrors.kernel.org: Finished\n" "E l\n" "[00] mirrors.kernel.org: 139.178.88.99\n" "[01] enoent.linuxfoundation.org: Processing request in progress\n" "[02] gnu.org: 209.51.188.116\n" "E l\n" "[00] mirrors.kernel.org: 139.178.88.99\n" "[01] enoent.linuxfoundation.org: Name or service not known\n" "[02] gnu.org: 209.51.188.116\n" #. type: Plain text #: debian-trixie #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eassert.hE\n" "#include Eerr.hE\n" "#include Enetdb.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "\\&\n" "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n" "\\&\n" "#define REALLOCF(ptr, n, type) " " \\[rs]\n" "({ " " \\[rs]\n" " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); " " \\[rs]\n" " " " \\[rs]\n" " (type *) reallocarrayf(ptr, n, sizeof(type)); " " \\[rs]\n" "})\n" "\\&\n" "static struct gaicb **reqs = NULL;\n" "static size_t nreqs = 0;\n" "\\&\n" "static inline void *\n" "reallocarrayf(void *p, size_t nmemb, size_t size)\n" "{\n" " void *q;\n" "\\&\n" " q = reallocarray(p, nmemb, size);\n" " if (q == NULL && nmemb != 0 && size != 0)\n" " free(p);\n" " return q;\n" "}\n" "\\&\n" "static char *\n" "getcmd(void)\n" "{\n" " static char buf[256];\n" "\\&\n" " fputs(\"E \", stdout); fflush(stdout);\n" " if (fgets(buf, sizeof(buf), stdin) == NULL)\n" " return NULL;\n" "\\&\n" " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n" " buf[strlen(buf) - 1] = 0;\n" "\\&\n" " return buf;\n" "}\n" "\\&\n" "/* Add requests for specified hostnames. */\n" "static void\n" "add_requests(void)\n" "{\n" " size_t nreqs_base = nreqs;\n" " char *host;\n" " int ret;\n" "\\&\n" " while ((host = strtok(NULL, \" \"))) {\n" " nreqs++;\n" " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n" " if (reqs == NULL)\n" " err(EXIT_FAILURE, \"reallocf\");\n" "\\&\n" " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n" " if (reqs[nreqs - 1] == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " reqs[nreqs - 1]-Ear_name = strdup(host);\n" " }\n" "\\&\n" " /* Queue nreqs_base..nreqs requests. */\n" "\\&\n" " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n" " nreqs - nreqs_base, NULL);\n" " if (ret) {\n" " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" "}\n" "\\&\n" "/* Wait until at least one of specified requests completes. */\n" "static void\n" "wait_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" " struct gaicb const **wait_reqs;\n" "\\&\n" " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n" " if (wait_reqs == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " /* NULL elements are ignored by gai_suspend(). */\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " wait_reqs[n] = reqs[n];\n" " }\n" "\\&\n" " ret = gai_suspend(wait_reqs, nreqs, NULL);\n" " if (ret) {\n" " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n" " return;\n" " }\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " if (wait_reqs[i] == NULL)\n" " continue;\n" "\\&\n" " ret = gai_error(reqs[i]);\n" " if (ret == EAI_INPROGRESS)\n" " continue;\n" "\\&\n" " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-Ear_name,\n" " ret == 0 ? \"Finished\" : gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* Cancel specified requests. */\n" "static void\n" "cancel_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " ret = gai_cancel(reqs[n]);\n" " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-Ear_name,\n" " gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* List all requests. */\n" "static void\n" "list_requests(void)\n" "{\n" " int ret;\n" " char host[NI_MAXHOST];\n" " struct addrinfo *res;\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " printf(\"[%02zu] %s: \", i, reqs[i]-Ear_name);\n" " ret = gai_error(reqs[i]);\n" "\\&\n" " if (!ret) {\n" " res = reqs[i]-Ear_result;\n" "\\&\n" " ret = getnameinfo(res-Eai_addr, res-Eai_addrlen,\n" " host, sizeof(host),\n" " NULL, 0, NI_NUMERICHOST);\n" " if (ret) {\n" " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" " puts(host);\n" " } else {\n" " puts(gai_strerror(ret));\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(void)\n" "{\n" " char *cmdline;\n" " char *cmd;\n" "\\&\n" " while ((cmdline = getcmd()) != NULL) {\n" " cmd = strtok(cmdline, \" \");\n" "\\&\n" " if (cmd == NULL) {\n" " list_requests();\n" " } else {\n" " switch (cmd[0]) {\n" " case \\[aq]a\\[aq]:\n" " add_requests();\n" " break;\n" " case \\[aq]w\\[aq]:\n" " wait_requests();\n" " break;\n" " case \\[aq]c\\[aq]:\n" " cancel_requests();\n" " break;\n" " case \\[aq]l\\[aq]:\n" " list_requests();\n" " break;\n" " default:\n" " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n" " break;\n" " }\n" " }\n" " }\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eassert.hE\n" "#include Eerr.hE\n" "#include Enetdb.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "\\&\n" "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n" "\\&\n" "#define REALLOCF(ptr, n, type) " " \\[rs]\n" "({ " " \\[rs]\n" " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); " " \\[rs]\n" " " " \\[rs]\n" " (type *) reallocarrayf(ptr, n, sizeof(type)); " " \\[rs]\n" "})\n" "\\&\n" "static struct gaicb **reqs = NULL;\n" "static size_t nreqs = 0;\n" "\\&\n" "static inline void *\n" "reallocarrayf(void *p, size_t nmemb, size_t size)\n" "{\n" " void *q;\n" "\\&\n" " q = reallocarray(p, nmemb, size);\n" " if (q == NULL && nmemb != 0 && size != 0)\n" " free(p);\n" " return q;\n" "}\n" "\\&\n" "static char *\n" "getcmd(void)\n" "{\n" " static char buf[256];\n" "\\&\n" " fputs(\"E \", stdout); fflush(stdout);\n" " if (fgets(buf, sizeof(buf), stdin) == NULL)\n" " return NULL;\n" "\\&\n" " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n" " buf[strlen(buf) - 1] = 0;\n" "\\&\n" " return buf;\n" "}\n" "\\&\n" "/* Add requests for specified hostnames. */\n" "static void\n" "add_requests(void)\n" "{\n" " size_t nreqs_base = nreqs;\n" " char *host;\n" " int ret;\n" "\\&\n" " while ((host = strtok(NULL, \" \"))) {\n" " nreqs++;\n" " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n" " if (reqs == NULL)\n" " err(EXIT_FAILURE, \"reallocf\");\n" "\\&\n" " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n" " if (reqs[nreqs - 1] == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " reqs[nreqs - 1]-Ear_name = strdup(host);\n" " }\n" "\\&\n" " /* Queue nreqs_base..nreqs requests. */\n" "\\&\n" " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n" " nreqs - nreqs_base, NULL);\n" " if (ret) {\n" " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" "}\n" "\\&\n" "/* Wait until at least one of specified requests completes. */\n" "static void\n" "wait_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" " struct gaicb const **wait_reqs;\n" "\\&\n" " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n" " if (wait_reqs == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " /* NULL elements are ignored by gai_suspend(). */\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " wait_reqs[n] = reqs[n];\n" " }\n" "\\&\n" " ret = gai_suspend(wait_reqs, nreqs, NULL);\n" " if (ret) {\n" " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n" " return;\n" " }\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " if (wait_reqs[i] == NULL)\n" " continue;\n" "\\&\n" " ret = gai_error(reqs[i]);\n" " if (ret == EAI_INPROGRESS)\n" " continue;\n" "\\&\n" " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-Ear_name,\n" " ret == 0 ? \"Finished\" : gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* Cancel specified requests. */\n" "static void\n" "cancel_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " ret = gai_cancel(reqs[n]);\n" " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-Ear_name,\n" " gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* List all requests. */\n" "static void\n" "list_requests(void)\n" "{\n" " int ret;\n" " char host[NI_MAXHOST];\n" " struct addrinfo *res;\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " printf(\"[%02zu] %s: \", i, reqs[i]-Ear_name);\n" " ret = gai_error(reqs[i]);\n" "\\&\n" " if (!ret) {\n" " res = reqs[i]-Ear_result;\n" "\\&\n" " ret = getnameinfo(res-Eai_addr, res-Eai_addrlen,\n" " host, sizeof(host),\n" " NULL, 0, NI_NUMERICHOST);\n" " if (ret) {\n" " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" " puts(host);\n" " } else {\n" " puts(gai_strerror(ret));\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(void)\n" "{\n" " char *cmdline;\n" " char *cmd;\n" "\\&\n" " while ((cmdline = getcmd()) != NULL) {\n" " cmd = strtok(cmdline, \" \");\n" "\\&\n" " if (cmd == NULL) {\n" " list_requests();\n" " } else {\n" " switch (cmd[0]) {\n" " case \\[aq]a\\[aq]:\n" " add_requests();\n" " break;\n" " case \\[aq]w\\[aq]:\n" " wait_requests();\n" " break;\n" " case \\[aq]c\\[aq]:\n" " cancel_requests();\n" " break;\n" " case \\[aq]l\\[aq]:\n" " list_requests();\n" " break;\n" " default:\n" " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n" " break;\n" " }\n" " }\n" " }\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "2024-11-17" msgstr "17 نوفمبر 2024" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "Linux man-pages 6.13" msgstr "صفحات دليل لينكس 6.13" #. type: Plain text #: fedora-44 fedora-rawhide #, no-wrap msgid "" "BIB<, struct gaicb *>IB<[restrict],>\n" "B< int >IB<, struct sigevent *restrict >IB<);>\n" "BIB<[], int >IB<,>\n" "B< const struct timespec *>IB<);>\n" msgstr "" "BIB<, struct gaicb *>IB<[restrict],>\n" "B< int >IB<, struct sigevent *restrict >IB<);>\n" "BIB<[], int >IB<,>\n" "B< const struct timespec *>IB<);>\n" #. type: Plain text #: fedora-44 fedora-rawhide #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eassert.hE\n" "#include Eerr.hE\n" "#include Enetdb.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "\\&\n" "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n" "\\&\n" "#define REALLOCF(ptr, n, type) " " \\[rs]\n" "({ " " \\[rs]\n" " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); " " \\[rs]\n" " " " \\[rs]\n" " (type *) reallocarrayf(ptr, n, sizeof(type)); " " \\[rs]\n" "})\n" "\\&\n" "static struct gaicb **reqs = NULL;\n" "static size_t nreqs = 0;\n" "\\&\n" "static inline void *\n" "reallocarrayf(void *p, size_t n, size_t size)\n" "{\n" " void *q;\n" "\\&\n" " q = reallocarray(p, n, size);\n" " if (q == NULL && n != 0 && size != 0)\n" " free(p);\n" " return q;\n" "}\n" "\\&\n" "static char *\n" "getcmd(void)\n" "{\n" " static char buf[256];\n" "\\&\n" " fputs(\"E \", stdout); fflush(stdout);\n" " if (fgets(buf, sizeof(buf), stdin) == NULL)\n" " return NULL;\n" "\\&\n" " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n" " buf[strlen(buf) - 1] = 0;\n" "\\&\n" " return buf;\n" "}\n" "\\&\n" "/* Add requests for specified hostnames. */\n" "static void\n" "add_requests(void)\n" "{\n" " size_t nreqs_base = nreqs;\n" " char *host;\n" " int ret;\n" "\\&\n" " while ((host = strtok(NULL, \" \"))) {\n" " nreqs++;\n" " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n" " if (reqs == NULL)\n" " err(EXIT_FAILURE, \"reallocf\");\n" "\\&\n" " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n" " if (reqs[nreqs - 1] == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " reqs[nreqs - 1]-Ear_name = strdup(host);\n" " }\n" "\\&\n" " /* Queue nreqs_base..nreqs requests. */\n" "\\&\n" " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n" " nreqs - nreqs_base, NULL);\n" " if (ret) {\n" " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" "}\n" "\\&\n" "/* Wait until at least one of specified requests completes. */\n" "static void\n" "wait_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" " struct gaicb const **wait_reqs;\n" "\\&\n" " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n" " if (wait_reqs == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " /* NULL elements are ignored by gai_suspend(). */\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " wait_reqs[n] = reqs[n];\n" " }\n" "\\&\n" " ret = gai_suspend(wait_reqs, nreqs, NULL);\n" " if (ret) {\n" " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n" " return;\n" " }\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " if (wait_reqs[i] == NULL)\n" " continue;\n" "\\&\n" " ret = gai_error(reqs[i]);\n" " if (ret == EAI_INPROGRESS)\n" " continue;\n" "\\&\n" " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-Ear_name,\n" " ret == 0 ? \"Finished\" : gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* Cancel specified requests. */\n" "static void\n" "cancel_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " ret = gai_cancel(reqs[n]);\n" " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-Ear_name,\n" " gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* List all requests. */\n" "static void\n" "list_requests(void)\n" "{\n" " int ret;\n" " char host[NI_MAXHOST];\n" " struct addrinfo *res;\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " printf(\"[%02zu] %s: \", i, reqs[i]-Ear_name);\n" " ret = gai_error(reqs[i]);\n" "\\&\n" " if (!ret) {\n" " res = reqs[i]-Ear_result;\n" "\\&\n" " ret = getnameinfo(res-Eai_addr, res-Eai_addrlen,\n" " host, sizeof(host),\n" " NULL, 0, NI_NUMERICHOST);\n" " if (ret) {\n" " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" " puts(host);\n" " } else {\n" " puts(gai_strerror(ret));\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(void)\n" "{\n" " char *cmdline;\n" " char *cmd;\n" "\\&\n" " while ((cmdline = getcmd()) != NULL) {\n" " cmd = strtok(cmdline, \" \");\n" "\\&\n" " if (cmd == NULL) {\n" " list_requests();\n" " } else {\n" " switch (cmd[0]) {\n" " case \\[aq]a\\[aq]:\n" " add_requests();\n" " break;\n" " case \\[aq]w\\[aq]:\n" " wait_requests();\n" " break;\n" " case \\[aq]c\\[aq]:\n" " cancel_requests();\n" " break;\n" " case \\[aq]l\\[aq]:\n" " list_requests();\n" " break;\n" " default:\n" " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n" " break;\n" " }\n" " }\n" " }\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eassert.hE\n" "#include Eerr.hE\n" "#include Enetdb.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "\\&\n" "#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))\n" "\\&\n" "#define REALLOCF(ptr, n, type) " " \\[rs]\n" "({ " " \\[rs]\n" " static_assert(__builtin_types_compatible_p(typeof(ptr), type *)); " " \\[rs]\n" " " " \\[rs]\n" " (type *) reallocarrayf(ptr, n, sizeof(type)); " " \\[rs]\n" "})\n" "\\&\n" "static struct gaicb **reqs = NULL;\n" "static size_t nreqs = 0;\n" "\\&\n" "static inline void *\n" "reallocarrayf(void *p, size_t n, size_t size)\n" "{\n" " void *q;\n" "\\&\n" " q = reallocarray(p, n, size);\n" " if (q == NULL && n != 0 && size != 0)\n" " free(p);\n" " return q;\n" "}\n" "\\&\n" "static char *\n" "getcmd(void)\n" "{\n" " static char buf[256];\n" "\\&\n" " fputs(\"E \", stdout); fflush(stdout);\n" " if (fgets(buf, sizeof(buf), stdin) == NULL)\n" " return NULL;\n" "\\&\n" " if (buf[strlen(buf) - 1] == \\[aq]\\[rs]n\\[aq])\n" " buf[strlen(buf) - 1] = 0;\n" "\\&\n" " return buf;\n" "}\n" "\\&\n" "/* Add requests for specified hostnames. */\n" "static void\n" "add_requests(void)\n" "{\n" " size_t nreqs_base = nreqs;\n" " char *host;\n" " int ret;\n" "\\&\n" " while ((host = strtok(NULL, \" \"))) {\n" " nreqs++;\n" " reqs = REALLOCF(reqs, nreqs, struct gaicb *);\n" " if (reqs == NULL)\n" " err(EXIT_FAILURE, \"reallocf\");\n" "\\&\n" " reqs[nreqs - 1] = CALLOC(1, struct gaicb);\n" " if (reqs[nreqs - 1] == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " reqs[nreqs - 1]-Ear_name = strdup(host);\n" " }\n" "\\&\n" " /* Queue nreqs_base..nreqs requests. */\n" "\\&\n" " ret = getaddrinfo_a(GAI_NOWAIT, &reqs[nreqs_base],\n" " nreqs - nreqs_base, NULL);\n" " if (ret) {\n" " fprintf(stderr, \"getaddrinfo_a() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" "}\n" "\\&\n" "/* Wait until at least one of specified requests completes. */\n" "static void\n" "wait_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" " struct gaicb const **wait_reqs;\n" "\\&\n" " wait_reqs = CALLOC(nreqs, const struct gaicb *);\n" " if (wait_reqs == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " /* NULL elements are ignored by gai_suspend(). */\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " wait_reqs[n] = reqs[n];\n" " }\n" "\\&\n" " ret = gai_suspend(wait_reqs, nreqs, NULL);\n" " if (ret) {\n" " printf(\"gai_suspend(): %s\\[rs]n\", gai_strerror(ret));\n" " return;\n" " }\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " if (wait_reqs[i] == NULL)\n" " continue;\n" "\\&\n" " ret = gai_error(reqs[i]);\n" " if (ret == EAI_INPROGRESS)\n" " continue;\n" "\\&\n" " printf(\"[%02zu] %s: %s\\[rs]n\", i, reqs[i]-Ear_name,\n" " ret == 0 ? \"Finished\" : gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* Cancel specified requests. */\n" "static void\n" "cancel_requests(void)\n" "{\n" " char *id;\n" " int ret;\n" " size_t n;\n" "\\&\n" " while ((id = strtok(NULL, \" \")) != NULL) {\n" " n = atoi(id);\n" "\\&\n" " if (n E= nreqs) {\n" " printf(\"Bad request number: %s\\[rs]n\", id);\n" " return;\n" " }\n" "\\&\n" " ret = gai_cancel(reqs[n]);\n" " printf(\"[%s] %s: %s\\[rs]n\", id, reqs[atoi(id)]-Ear_name,\n" " gai_strerror(ret));\n" " }\n" "}\n" "\\&\n" "/* List all requests. */\n" "static void\n" "list_requests(void)\n" "{\n" " int ret;\n" " char host[NI_MAXHOST];\n" " struct addrinfo *res;\n" "\\&\n" " for (size_t i = 0; i E nreqs; i++) {\n" " printf(\"[%02zu] %s: \", i, reqs[i]-Ear_name);\n" " ret = gai_error(reqs[i]);\n" "\\&\n" " if (!ret) {\n" " res = reqs[i]-Ear_result;\n" "\\&\n" " ret = getnameinfo(res-Eai_addr, res-Eai_addrlen,\n" " host, sizeof(host),\n" " NULL, 0, NI_NUMERICHOST);\n" " if (ret) {\n" " fprintf(stderr, \"getnameinfo() failed: %s\\[rs]n\",\n" " gai_strerror(ret));\n" " exit(EXIT_FAILURE);\n" " }\n" " puts(host);\n" " } else {\n" " puts(gai_strerror(ret));\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(void)\n" "{\n" " char *cmdline;\n" " char *cmd;\n" "\\&\n" " while ((cmdline = getcmd()) != NULL) {\n" " cmd = strtok(cmdline, \" \");\n" "\\&\n" " if (cmd == NULL) {\n" " list_requests();\n" " } else {\n" " switch (cmd[0]) {\n" " case \\[aq]a\\[aq]:\n" " add_requests();\n" " break;\n" " case \\[aq]w\\[aq]:\n" " wait_requests();\n" " break;\n" " case \\[aq]c\\[aq]:\n" " cancel_requests();\n" " break;\n" " case \\[aq]l\\[aq]:\n" " list_requests();\n" " break;\n" " default:\n" " fprintf(stderr, \"Bad command: %c\\[rs]n\", cmd[0]);\n" " break;\n" " }\n" " }\n" " }\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: mageia-cauldron #, no-wrap msgid "Linux man-pages 6.17" msgstr "صفحات دليل لينكس 6.17" #. type: TH #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "صفحات دليل لينكس (لم تصدر بعد)"