# 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:35+0200\n" "PO-Revision-Date: 2026-05-18 18:06+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 "poll" msgstr "poll" #. 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 "poll, ppoll - wait for some event on a file descriptor" msgstr "poll, ppoll - انتظار حدث ما على واصف ملف" #. 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 "Standard C library (I,\\ I<-lc>)" msgstr "مكتبة سي المعيارية (I،\\ I<-lc>)" #. 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<#include Epoll.hE>\n" msgstr "B<#include Epoll.hE>\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<, nfds_t >IB<, int >IB<);>\n" msgstr "BIB<, nfds_t >IB<, int >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 "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" "B<#include Epoll.hE>\n" msgstr "" "B<#define _GNU_SOURCE> /* انظر feature_test_macros(7) */\n" "B<#include Epoll.hE>\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<, nfds_t >IB<,>\n" "B< const struct timespec *_Nullable >IB<,>\n" "B< const sigset_t *_Nullable >IB<);>\n" msgstr "" "BIB<, nfds_t >IB<,>\n" "B< const struct timespec *_Nullable >IB<,>\n" "B< const sigset_t *_Nullable >IB<);>\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 "" "B() performs a similar task to B(2): فهي تنتظر حتى يصبح أحد مجموعة " "من واصفات الملفات جاهزًا لأداء الإدخال/الإخراج. تؤدي واجهة برمجة التطبيقات " "الخاصة بلينكس B(7) مهمة مشابهة، ولكنها تقدم ميزات تتجاوز تلك " "الموجودة في B()." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The set of file descriptors to be monitored is specified in the I " "argument, which is an array of structures of the following form:" msgstr "" "يتم تحديد مجموعة واصفات الملفات المراد مراقبتها في الوسيط 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 pollfd {\n" " int fd; /* file descriptor */\n" " short events; /* requested events */\n" " short revents; /* returned events */\n" "};\n" msgstr "" "struct pollfd {\n" " int fd; /* واصف ملف */\n" " short events; /* الأحداث المطلوبة */\n" " short revents; /* الأحداث المعادة */\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The caller should specify the number of items in the I array in I." msgstr "يجب على المستدعي تحديد عدد العناصر في مصفوفة I في I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The field I contains a file descriptor for an open file. If this field " "is negative, then the corresponding I field is ignored and the " "I field returns zero. (This provides an easy way of ignoring a " "file descriptor for a single B() call: simply set the I field to " "its bitwise complement.)" msgstr "" "يحتوي الحقل I على واصف ملف لملف مفتوح. إذا كان هذا الحقل سالبًا، فسيتم " "تجاهل حقل I المقابل ويعيد حقل I صفرًا. (يوفر هذا طريقة سهلة " "لتجاهل واصف ملف لاستدعاء B() واحد: ببساطة اضبط حقل I على مكمله " "بالبت.)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The field I is an input parameter, a bit mask specifying the events " "the application is interested in for the file descriptor I. This field " "may be specified as zero, in which case the only events that can be returned " "in I are B, B, and B (see below)." msgstr "" "الحقل I هو معامل إدخال، قناع بت يحدد الأحداث التي يهتم بها التطبيق " "لواصف الملف I. يمكن تحديد هذا الحقل كصفر، وفي هذه الحالة تكون الأحداث " "الوحيدة التي يمكن إعادتها في I هي B و B و " "B (انظر أدناه)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The field I is an output parameter, filled by the kernel with the " "events that actually occurred. The bits returned in I can include " "any of those specified in I, or one of the values B, " "B, or B. (These three bits are meaningless in the " "I field, and will be set in the I field whenever the " "corresponding condition is true.)" msgstr "" "الحقل I هو معامل إخراج، يملؤه النواة بالأحداث التي حدثت فعليًا. " "يمكن أن تتضمن البتات المعادة في I أيًا من تلك المحددة في I، " "أو إحدى القيم B أو B أو B. (هذه البتات الثلاث " "لا معنى لها في حقل I، وسيتم تعيينها في حقل I كلما كان الشرط " "المقابل صحيحًا.)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If none of the events requested (and no error) has occurred for any of the " "file descriptors, then B() blocks until one of the events occurs." msgstr "" "إذا لم يحدث أي من الأحداث المطلوبة (ولا خطأ) لأي من واصفات الملفات، فإن " "B() تحظر حتى يقع أحد الأحداث." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I argument specifies the number of milliseconds that B() " "should block waiting for a file descriptor to become ready. The call will " "block until either:" msgstr "" "تحدد الوسيطة I عدد الميلي ثانية التي يجب أن تحظر فيها B() في " "انتظار أن يصبح واصف الملف جاهزًا. ستحظر الاستدعاء حتى:" #. 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 "a file descriptor becomes ready;" msgstr "يصبح واصف الملف جاهزًا؛" #. 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 handler; or" msgstr "الاستدعاء قوطع بواسطة معالج إشارة؛ أو" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "the timeout expires." msgstr "انتهاء المهلة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Being \"ready\" means that the requested operation will not block; thus, " "B()ing regular files, block devices, and other files with no " "reasonable polling semantic I returns instantly as ready to read and " "write." msgstr "" "كونه \"جاهزًا\" يعني أن العملية المطلوبة لن تحظر؛ وبالتالي، فإن استقصاء " "B() للملفات العادية وأجهزة الكتل والملفات الأخرى التي لا تحتوي على " "دلالات استقصاء معقولة يعود I<دائمًا> فورًا كجاهز للقراءة والكتابة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Note that the I interval will be rounded up to the system clock " "granularity, and kernel scheduling delays mean that the blocking interval " "may overrun by a small amount. Specifying a negative value in I " "means an infinite timeout. Specifying a I of zero causes " "B() to return immediately, even if no file descriptors are ready." msgstr "" "لاحظ أن الفاصل الزمني I سيتم تقريبه لأعلى إلى دقة ساعة النظام، " "وتأخيرات جدولة النواة تعني أن فترة الحظر قد تتجاوز بمقدار صغير. تحديد قيمة " "سالبة في I يعني مهلة غير محدودة. تحديد I بقيمة صفر يتسبب " "في عودة B() فورًا، حتى لو لم تكن أي واصفات ملفات جاهزة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The bits that may be set/returned in I and I are defined in " "Ipoll.hE>:" msgstr "" "البتات التي يمكن تعيينها/إعادتها في I و I معرفة في " "Ipoll.hE>:" #. 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 is data to read." 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 is some exceptional condition on the file descriptor. Possibilities " "include:" msgstr "توجد حالة استثنائية على واصف الملف. تشمل الاحتمالات:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "There is out-of-band data on a TCP socket (see B(7))." msgstr "توجد بيانات خارج النطاق على مقبس TCP (انظر B(7))." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A pseudoterminal master in packet mode has seen a state change on the slave " "(see B(2))." msgstr "" "رأى رئيس طرفي زائف في وضع الحزمة تغيير حالة على التابع (انظر " "B(2))." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "A I file has been modified (see B(7))." msgstr "تم تعديل ملف I (انظر B(7))." #. 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 "" "Writing is now possible, though a write larger than the available space in a " "socket or pipe will still block (unless B is set)." 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 (since Linux 2.6.17)" msgstr "B (منذ لينكس 2.6.17)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Stream socket peer closed connection, or shut down writing half of " "connection. The B<_GNU_SOURCE> feature test macro must be defined (before " "including I header files) in order to obtain this definition." msgstr "" "أغلق نظير مقبس الدفق الاتصال، أو أوقف كتابة نصف الاتصال. يجب تعريف ماكرو " "اختبار الميزة B<_GNU_SOURCE> (قبل تضمين 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 "" "Error condition (only returned in I; ignored in I). This " "bit is also set for a file descriptor referring to the write end of a pipe " "when the read end has been closed." msgstr "" "حالة خطأ (تُعاد فقط في I؛ تُتجاهل في 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 "" "Hang up (only returned in I; ignored in I). Note that when " "reading from a channel such as a pipe or a stream socket, this event merely " "indicates that the peer closed its end of the channel. Subsequent reads " "from the channel will return 0 (end of file) only after all outstanding " "data in the channel has been consumed." msgstr "" "تعليق (يُعاد فقط في I؛ يُتجاهل في I). لاحظ أنه عند القراءة " "من قناة مثل أنبوب أو مقبس دفق، يشير هذا الحدث فقط إلى أن النظير أغلق نهايته " "من القناة. ستعيد القراءات اللاحقة من القناة 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 "" "Invalid request: I not open (only returned in I; ignored in " "I)." msgstr "" "طلب غير صالح: I غير مفتوح (يُعاد فقط في I؛ يُتجاهل في I)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When compiling with B<_XOPEN_SOURCE> defined, one also has the following, " "which convey no further information beyond the bits listed above:" msgstr "" "عند الترجمة مع تعريف B<_XOPEN_SOURCE>، تتوفر أيضًا القيم التالية، التي لا " "تنقل معلومات إضافية تتجاوز البتات المذكورة أعلاه:" #. 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 "Equivalent to B." 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" #. POLLRDBAND is used in the DECnet protocol. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Priority band data can be read (generally unused on Linux)." 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 "Equivalent to B." 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 "Priority data may be written." msgstr "يمكن كتابة بيانات ذات أولوية." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Linux also knows about, but does not use B." msgstr "لينكس يعرف أيضًا B، لكنه لا يستخدمه." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ppoll()" msgstr "ppoll()" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The relationship between B() and B() is analogous to the " "relationship between B(2) " "وB(2): مثل B(2)، يسمح B() للتطبيق بالانتظار بأمان " "حتى يصبح واصف ملف جاهزًا أو حتى يتم التقاط إشارة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Other than the difference in the precision of the I argument, the " "following B() call:" msgstr "بخلاف الاختلاف في دقة وسيط I، فإن استدعاء B() التالي:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ready = ppoll(&fds, nfds, tmo_p, &sigmask);\n" msgstr "ready = ppoll(&fds, nfds, tmo_p, &sigmask);\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "is nearly equivalent to I executing the following calls:" msgstr "يكاد يكون مكافئًا لتنفيذ الاستدعاءات التالية I<بشكل ذري>:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "sigset_t origmask;\n" "int timeout;\n" "\\&\n" "timeout = (tmo_p == NULL) ? -1 :\n" " (tmo_p-Etv_sec * 1000 + tmo_p-Etv_nsec / 1000000);\n" "pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);\n" "ready = poll(&fds, nfds, timeout);\n" "pthread_sigmask(SIG_SETMASK, &origmask, NULL);\n" msgstr "" "sigset_t origmask;\n" "int timeout;\n" "\\&\n" "timeout = (tmo_p == NULL) ? -1 :\n" " (tmo_p-Etv_sec * 1000 + tmo_p-Etv_nsec / 1000000);\n" "pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);\n" "ready = poll(&fds, nfds, timeout);\n" "pthread_sigmask(SIG_SETMASK, &origmask, NULL);\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The above code segment is described as I equivalent because whereas " "a negative I value for B() is interpreted as an infinite " "timeout, a negative value expressed in I<*tmo_p> results in an error from " "B()." msgstr "" "يُوصف مقطع الكود أعلاه بأنه I<يكاد> يكون مكافئًا لأنه بينما تُفسر قيمة " "I السالبة لـ B() على أنها مهلة لا نهائية، تؤدي القيمة السالبة " "المعبر عنها في I<*tmo_p> إلى خطأ من B()." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "See the description of B(2) for an explanation of why B() " "is necessary." msgstr "انظر وصف B(2) لشرح سبب ضرورة B()." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If the I argument is specified as NULL, then no signal mask " "manipulation is performed (and thus B() differs from B() only " "in the precision of the I argument)." msgstr "" "إذا تم تحديد وسيط I كـ NULL، فلا يتم إجراء أي معالجة لقناع الإشارة " "(وبالتالي يختلف B() عن B() فقط في دقة وسيط I)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I argument specifies an upper limit on the amount of time that " "B() will block. This argument is a pointer to a B(3) " "structure." msgstr "" "يحدد وسيط I حدًا أعلى لمقدار الوقت الذي سينتظر فيه B() بشكل " "محظور. هذا الوسيط هو مؤشر لبنية B(3)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If I is specified as NULL, then B() can block indefinitely." msgstr "" "إذا تم تحديد I كـ NULL، فيمكن لـ B() الانتظار بشكل محظور إلى " "أجل غير مسمى." #. 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 "" "On success, B() returns a nonnegative value which is the number of " "elements in the I whose I fields have been set to a " "nonzero value (indicating an event or an error). A return value of zero " "indicates that the system call timed out before any file descriptors became " "ready." msgstr "" "عند النجاح، تُرجع B() قيمة غير سالبة وهي عدد العناصر في I التي " "تم تعيين حقول I فيها إلى قيمة غير صفرية (تشير إلى حدث أو خطأ). تشير " "قيمة الإرجاع صفر إلى أن استدعاء النظام انتهت مهلة قبل أن يصبح أي واصف ملف " "جاهزًا." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "On error, -1 is returned, and I is set to indicate the error." msgstr "عند الخطأ، تُعاد القيمة -1، ويُضبط I للإشارة إلى الخطأ." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ERRORS" 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 points outside the process's accessible address space. The array " "given as argument was not contained in the calling program's address space." 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 "A signal occurred before any requested event; see B(7)." msgstr "حدثت إشارة قبل أي حدث مطلوب؛ انظر B(7)." #. 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 I value exceeds the B value." msgstr "قيمة I تتجاوز قيمة B." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "(B()) The timeout value expressed in I<*tmo_p> is invalid (negative)." msgstr "(B()) قيمة المهلة المعبر عنها في I<*tmo_p> غير صالحة (سالبة)." #. 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 "Unable to allocate memory for kernel data structures." msgstr "غير قادر على تخصيص ذاكرة لهياكل بيانات النواة." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "VERSIONS" msgstr "الإصدارات" #. Darwin, according to a report by Jeremy Sequoia, relayed by Josh Triplett #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "On some other UNIX systems, B() can fail with the error B if " "the system fails to allocate kernel-internal resources, rather than " "B as Linux does. POSIX permits this behavior. Portable programs " "may wish to check for B and loop, just as with B." msgstr "" "على بعض أنظمة UNIX الأخرى، يمكن أن يفشل B() مع الخطأ B إذا فشل " "النظام في تخصيص موارد داخلية للنواة، بدلاً من B كما يفعل لينكس. يسمح " "POSIX بهذا السلوك. قد ترغب البرامج المحمولة في التحقق من B والتكرار، " "تمامًا كما هو الحال مع B." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Some implementations define the nonstandard constant B with the " "value -1 for use as a I for B(). This constant is not " "provided in glibc." msgstr "" "تعرف بعض التطبيقات الثابت غير القياسي B بالقيمة -1 لاستخدامه كـ " "I لـ B(). هذا الثابت غير متوفر في glibc." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "C library/kernel differences" msgstr "الاختلافات بين مكتبة C والنواة" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The Linux B() system call modifies its I argument. However, " "the glibc wrapper function hides this behavior by using a local variable for " "the timeout argument that is passed to the system call. Thus, the glibc " "B() function does not modify its I argument." msgstr "" "استدعاء النظام B() في لينكس يُعدّل وسيطته I. لكن دالة الغلاف " "glibc تُخفي هذا السلوك باستخدام متغير محلي لوسيطة المهلة التي تُمرّر لاستدعاء " "النظام. وبالتالي، دالة B() في glibc لا تُعدّل وسيطتها I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The raw B() system call has a fifth argument, I, " "which specifies the size in bytes of the I argument. The glibc " "B() wrapper function specifies this argument as a fixed value (equal " "to I). See B(2) for a discussion on " "the differences between the kernel and the libc notion of the sigset." msgstr "" "استدعاء النظام الخام B() يمتلك وسيطة خامسة، I، " "التي تُحدد الحجم بالبايت لوسيطة I. دالة الغلاف B() في glibc " "تُحدد هذه الوسيطة بقيمة ثابتة (تساوي I). انظر " "B(2) لمناقشة الفروقات بين مفهوم النواة و libc لـ sigset." #. 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-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "POSIX.1-2024." msgstr "POSIX.1-2024." #. 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: 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 "POSIX.1-2001. Linux 2.1.23." msgstr "POSIX.1-2001. لينكس 2.1.23." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "On older kernels that lack this system call, the glibc B() wrapper " "function provides emulation using B(2)." #. 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-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "POSIX.1-2024. Linux 2.6.16, glibc 2.4." msgstr "POSIX.1-2024. لينكس 2.6.16، glibc 2.4." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "ملاحظات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The operation of B() and B() is not affected by the " "B flag." msgstr "عملية B() و B() لا تتأثر بالعلامة B." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For a discussion of what may happen if a file descriptor being monitored by " "B() is closed in another thread, see B(2)." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "BUGS" msgstr "العلل" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "See the discussion of spurious readiness notifications under the BUGS " "section of B(2)." #. 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 "" "The program below opens each of the files named in its command-line " "arguments and monitors the resulting file descriptors for readiness to read " "(B). The program loops, repeatedly using B() to monitor the " "file descriptors, printing the number of ready file descriptors on return. " "For each ready file descriptor, the program:" msgstr "" "البرنامج أدناه يفتح كل ملف مُسمّى في وسائط سطر الأوامر ويُراقب واصفات الملف " "الناتجة للجاهزية للقراءة (B). البرنامج يُكرر، مستخدماً B() بشكل " "متكرر لمراقبة واصفات الملف، طابعاً عدد واصفات الملف الجاهزة عند العودة. لكل " "واصف ملف جاهز، البرنامج:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "displays the returned I field in a human-readable form;" msgstr "يعرض حقل I المُعاد بصيغة قابلة للقراءة البشرية؛" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "if the file descriptor is readable, reads some data from it, and displays " "that data on standard output; and" msgstr "" "إذا كان واصف الملف قابلاً للقراءة، يقرأ بعض البيانات منه، ويعرض تلك البيانات " "على المخرجات القياسية؛ و" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "if the file descriptor was not readable, but some other event occurred " "(presumably B), closes the file descriptor." msgstr "" "إذا لم يكن واصف الملف قابلاً للقراءة، لكن حدث آخر وقع (يفترض B)، " "يُغلق واصف الملف." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Suppose we run the program in one terminal, asking it to open a FIFO:" msgstr "لنفترض أننا نشغّل البرنامج في طرفية واحدة، نطلب منه فتح FIFO:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "$B< mkfifo myfifo>;\n" "$B< ./poll_input myfifo>;\n" msgstr "" "$B< mkfifo myfifo>;\n" "$B< ./poll_input myfifo>;\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In a second terminal window, we then open the FIFO for writing, write some " "data to it, and close the FIFO:" msgstr "" "في نافذة طرفية ثانية، نفتح FIFO للكتابة، نكتب بعض البيانات إليه، ونُغلق FIFO:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "$B< echo aaaaabbbbbccccc E myfifo>;\n" msgstr "$B< echo aaaaabbbbbccccc E myfifo>;\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "In the terminal where we are running the program, we would then see:" msgstr "في الطرفية حيث نشغّل البرنامج، سنرى بعدها:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "Opened \"myfifo\" on fd 3\n" "About to poll()\n" "Ready: 1\n" " fd=3; events: POLLIN POLLHUP\n" " read 10 bytes: aaaaabbbbb\n" "About to poll()\n" "Ready: 1\n" " fd=3; events: POLLIN POLLHUP\n" " read 6 bytes: ccccc\n" "\\&\n" "About to poll()\n" "Ready: 1\n" " fd=3; events: POLLHUP\n" " closing fd 3\n" "All file descriptors closed. Bye.\n" msgstr "" "Opened \"myfifo\" on fd 3\n" "About to poll()\n" "Ready: 1\n" " fd=3; events: POLLIN POLLHUP\n" " read 10 bytes: aaaaabbbbb\n" "About to poll()\n" "Ready: 1\n" " fd=3; events: POLLIN POLLHUP\n" " read 6 bytes: ccccc\n" "\\&\n" "About to poll()\n" "Ready: 1\n" " fd=3; events: POLLHUP\n" " closing fd 3\n" "All file descriptors closed. Bye.\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "In the above output, we see that B() returned three times:" msgstr "في المخرجات أعلاه، نرى أن B() عاد ثلاث مرات:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "On the first return, the bits returned in the I field were " "B, indicating that the file descriptor is readable, and B, " "indicating that the other end of the FIFO has been closed. The program then " "consumed some of the available input." msgstr "" "في العودة الأولى، البتات المُعادة في حقل I كانت B، مشيرة إلى " "أن واصف الملف قابل للقراءة، و B، مشيرة إلى أن الطرف الآخر من FIFO " "أُغلق. البرنامج استهلك بعدها بعضاً من المُدخلات المتاحة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The second return from B() also indicated B and B; " "the program then consumed the last of the available input." msgstr "" "العودة الثانية من B() أشارت أيضًا إلى B و B؛ البرنامج " "استهلك بعدها آخر المُدخلات المتاحة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "On the final return, B() indicated only B on the FIFO, at " "which point the file descriptor was closed and the program terminated." msgstr "" "في العودة النهائية، B() أشار فقط إلى B على FIFO، وعندها أُغلق " "واصف الملف وانتهى البرنامج." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "مصدر البرنامج" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "/* poll_input.c\n" "\\&\n" " Licensed under GNU General Public License v2 or later.\n" "*/\n" "#include Eerr.hE\n" "#include Efcntl.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int ready;\n" " char buf[10];\n" " nfds_t num_open_fds, nfds;\n" " ssize_t s;\n" " struct pollfd *pfds;\n" "\\&\n" " if (argc E 2) {\n" " fprintf(stderr, \"Usage: %s file...\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " num_open_fds = nfds = argc - 1;\n" " pfds = calloc(nfds, sizeof(struct pollfd));\n" " if (pfds == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " /* Open each file on command line, and add it to \\[aq]pfds\\[aq] array. */\n" "\\&\n" " for (nfds_t j = 0; j E nfds; j++) {\n" " pfds[j].fd = open(argv[j + 1], O_RDONLY);\n" " if (pfds[j].fd == -1)\n" " err(EXIT_FAILURE, \"open\");\n" "\\&\n" " printf(\"Opened \\[rs]\"%s\\[rs]\" on fd %d\\[rs]n\", argv[j + 1], pfds[j].fd);\n" "\\&\n" " pfds[j].events = POLLIN;\n" " }\n" "\\&\n" " /* Keep calling poll() as long as at least one file descriptor is\n" " open. */\n" "\\&\n" " while (num_open_fds E 0) {\n" " printf(\"About to poll()\\[rs]n\");\n" " ready = poll(pfds, nfds, -1);\n" " if (ready == -1)\n" " err(EXIT_FAILURE, \"poll\");\n" "\\&\n" " printf(\"Ready: %d\\[rs]n\", ready);\n" "\\&\n" " /* Deal with array returned by poll(). */\n" "\\&\n" " for (nfds_t j = 0; j E nfds; j++) {\n" " if (pfds[j].revents != 0) {\n" " printf(\" fd=%d; events: %s%s%s\\[rs]n\", pfds[j].fd,\n" " (pfds[j].revents & POLLIN) ? \"POLLIN \" : \"\",\n" " (pfds[j].revents & POLLHUP) ? \"POLLHUP \" : \"\",\n" " (pfds[j].revents & POLLERR) ? \"POLLERR \" : \"\");\n" "\\&\n" " if (pfds[j].revents & POLLIN) {\n" " s = read(pfds[j].fd, buf, sizeof(buf));\n" " if (s == -1)\n" " err(EXIT_FAILURE, \"read\");\n" " printf(\" read %zd bytes: %.*s\\[rs]n\",\n" " s, (int) s, buf);\n" " } else { /* POLLERR | POLLHUP */\n" " printf(\" closing fd %d\\[rs]n\", pfds[j].fd);\n" " if (close(pfds[j].fd) == -1)\n" " err(EXIT_FAILURE, \"close\");\n" " num_open_fds--;\n" " }\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"All file descriptors closed. Bye.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "/* poll_input.c\n" "\\&\n" " Licensed under GNU General Public License v2 or later.\n" "*/\n" "#include Eerr.hE\n" "#include Efcntl.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int ready;\n" " char buf[10];\n" " nfds_t num_open_fds, nfds;\n" " ssize_t s;\n" " struct pollfd *pfds;\n" "\\&\n" " if (argc E 2) {\n" " fprintf(stderr, \"Usage: %s file...\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " num_open_fds = nfds = argc - 1;\n" " pfds = calloc(nfds, sizeof(struct pollfd));\n" " if (pfds == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " /* Open each file on command line, and add it to \\[aq]pfds\\[aq] array. */\n" "\\&\n" " for (nfds_t j = 0; j E nfds; j++) {\n" " pfds[j].fd = open(argv[j + 1], O_RDONLY);\n" " if (pfds[j].fd == -1)\n" " err(EXIT_FAILURE, \"open\");\n" "\\&\n" " printf(\"Opened \\[rs]\"%s\\[rs]\" on fd %d\\[rs]n\", argv[j + 1], pfds[j].fd);\n" "\\&\n" " pfds[j].events = POLLIN;\n" " }\n" "\\&\n" " /* Keep calling poll() as long as at least one file descriptor is\n" " open. */\n" "\\&\n" " while (num_open_fds E 0) {\n" " printf(\"About to poll()\\[rs]n\");\n" " ready = poll(pfds, nfds, -1);\n" " if (ready == -1)\n" " err(EXIT_FAILURE, \"poll\");\n" "\\&\n" " printf(\"Ready: %d\\[rs]n\", ready);\n" "\\&\n" " /* Deal with array returned by poll(). */\n" "\\&\n" " for (nfds_t j = 0; j E nfds; j++) {\n" " if (pfds[j].revents != 0) {\n" " printf(\" fd=%d; events: %s%s%s\\[rs]n\", pfds[j].fd,\n" " (pfds[j].revents & POLLIN) ? \"POLLIN \" : \"\",\n" " (pfds[j].revents & POLLHUP) ? \"POLLHUP \" : \"\",\n" " (pfds[j].revents & POLLERR) ? \"POLLERR \" : \"\");\n" "\\&\n" " if (pfds[j].revents & POLLIN) {\n" " s = read(pfds[j].fd, buf, sizeof(buf));\n" " if (s == -1)\n" " err(EXIT_FAILURE, \"read\");\n" " printf(\" read %zd bytes: %.*s\\[rs]n\",\n" " s, (int) s, buf);\n" " } else { /* POLLERR | POLLHUP */\n" " printf(\" closing fd %d\\[rs]n\", pfds[j].fd);\n" " if (close(pfds[j].fd) == -1)\n" " err(EXIT_FAILURE, \"close\");\n" " num_open_fds--;\n" " }\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"All file descriptors closed. Bye.\\[rs]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(2), B(2), B(2), B(3), " "B(7), B