# 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\n" "POT-Creation-Date: 2026-06-05 06:27+0200\n" "PO-Revision-Date: 2026-06-03 04:49+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" ".MIME-Version: 1.0\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 "inotify" msgstr "inotify" #. type: TH #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "2026-02-14" msgstr "14 فبراير 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 "inotify - monitoring filesystem events" msgstr "inotify - مراقبة أحداث نظام الملفات" #. 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 I API provides a mechanism for monitoring filesystem events. " "Inotify can be used to monitor individual files, or to monitor directories. " "When a directory is monitored, inotify will return events for the directory " "itself, and for files inside the directory." msgstr "" "توفر واجهة برمجة التطبيقات I آلية لمراقبة أحداث نظام الملفات. يمكن " "استخدام inotify لمراقبة ملفات فردية، أو لمراقبة أدلة. عند مراقبة دليل، يُرجع " "inotify أحداثًا للدليل نفسه، وللملفات داخل الدليل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The following system calls are used with this API:" msgstr "تُستخدم استدعاءات النظام التالية مع واجهة برمجة التطبيقات هذه:" #. 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 "" "B(2) creates an inotify instance and returns a file " "descriptor referring to the inotify instance. The more recent " "B(2) is like B(2), but has a I argument " "that provides access to some extra functionality." msgstr "" "ينشئ B(2) مثيل inotify ويُعيد واصف ملف يشير إلى مثيل inotify. " "الإصدار الأحدث B(2) مشابه لـ B(2)، لكنه يحتوي " "على وسيط I يوفر الوصول إلى بعض الوظائف الإضافية." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "B(2) manipulates the \"watch list\" associated with an " "inotify instance. Each item (\"watch\") in the watch list specifies the " "pathname of a file or directory, along with some set of events that the " "kernel should monitor for the file referred to by that pathname. " "B(2) either creates a new watch item, or modifies an " "existing watch. Each watch has a unique \"watch descriptor\", an integer " "returned by B(2) when the watch is created." msgstr "" "يتلاعب B(2) بقائمة المراقبة المرتبطة بمثيل inotify. يحدد " "كل عنصر (\"مراقبة\") في قائمة المراقبة اسم مسار ملف أو دليل، بالإضافة إلى " "مجموعة من الأحداث التي يجب على النواة مراقبتها للملف المشار إليه بواسطة اسم " "المسار ذلك. إما أن ينشئ B(2) عنصر مراقبة جديد، أو يعدل " "مراقبة موجودة. لكل مراقبة \"واصف مراقبة\" فريد، وهو عدد صحيح يُعاد بواسطة " "B(2) عند إنشاء المراقبة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When events occur for monitored files and directories, those events are made " "available to the application as structured data that can be read from the " "inotify file descriptor using B(2) (see below)." msgstr "" "عند حدوث أحداث للملفات والأدلة المراقبة، تُتاح تلك الأحداث للتطبيق كبيانات " "منظمة يمكن قراءتها من واصف ملف inotify باستخدام B(2) (انظر أدناه)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "B(2) removes an item from an inotify watch list." msgstr "يزيل B(2) عنصرًا من قائمة مراقبة inotify." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When all file descriptors referring to an inotify instance have been closed " "(using B(2)), the underlying object and its resources are freed for " "reuse by the kernel; all associated watches are automatically freed." msgstr "" "عند إغلاق جميع واصفات الملفات التي تشير إلى مثيل inotify (باستخدام " "B(2))، يُحرر الكائن الأساسي وموارده لإعادة الاستخدام بواسطة النواة؛ " "تُحرر جميع المراقبات المرتبطة آليًا." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "With careful programming, an application can use inotify to efficiently " "monitor and cache the state of a set of filesystem objects. However, robust " "applications should allow for the fact that bugs in the monitoring logic or " "races of the kind described below may leave the cache inconsistent with the " "filesystem state. It is probably wise to do some consistency checking, and " "rebuild the cache when inconsistencies are detected." msgstr "" "مع البرمجة الدقيقة، يمكن للتطبيق استخدام inotify لمراقبة وتخزين حالة مجموعة " "من كائنات نظام الملفات بكفاءة. ومع ذلك، يجب على التطبيقات القوية أن تأخذ في " "الاعتبار حقيقة أن الأخطاء في منطق المراقبة أو حالات السباق من النوع الموصوف " "أدناه قد تترك الخبيئة غير متسقة مع حالة نظام الملفات. من الحكمة على الأرجح " "إجراء بعض التحقق من الاتساق، وإعادة بناء الخبيئة عند اكتشاف حالات عدم " "الاتساق." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Reading events from an inotify file descriptor" msgstr "قراءة الأحداث من واصف ملف inotify" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "To determine what events have occurred, an application B(2)s from the " "inotify file descriptor. If no events have so far occurred, then, assuming " "a blocking file descriptor, B(2) will block until at least one event " "occurs (unless interrupted by a signal, in which case the call fails with " "the error B; see B(7))." msgstr "" "لتحديد الأحداث التي حدثت، يقرأ التطبيق B(2) من واصف ملف inotify. إذا " "لم تحدث أي أحداث حتى الآن، فبافتراض واصف ملف محظور، سيحظر B(2) حتى " "يحدث حدث واحد على الأقل (ما لم يُقاطع بإشارة، وفي هذه الحالة يفشل الاستدعاء " "مع الخطأ B؛ انظر B(7))." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Each successful B(2) returns a buffer containing one or more of the " "following structures:" msgstr "" "يُعيد كل B(2) ناجح مخزنًا مؤقتًا يحتوي على بنية واحدة أو أكثر مما يلي:" #. FIXME . The type of the 'wd' field should probably be "int32_t". #. I submitted a patch to fix this. See the LKML thread #. "[patch] Fix type errors in inotify interfaces", 18 Nov 2008 #. glibc bug filed: https://www.sourceware.org/bugzilla/show_bug.cgi?id=7040 #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "struct inotify_event {\n" " int wd; /* Watch descriptor */\n" " uint32_t mask; /* Mask describing event */\n" " uint32_t cookie; /* Unique cookie associating related\n" " events (for rename(2)) */\n" " uint32_t len; /* Size of \\f[I]name\\fR field */\n" " char name[]; /* Optional null-terminated name */\n" "};\n" msgstr "" "struct inotify_event {\n" " int wd; /* Watch descriptor */\n" " uint32_t mask; /* Mask describing event */\n" " uint32_t cookie; /* Unique cookie associating related\n" " events (for rename(2)) */\n" " uint32_t len; /* Size of \\f[I]name\\fR field */\n" " char name[]; /* Optional null-terminated name */\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "I identifies the watch for which this event occurs. It is one of the " "watch descriptors returned by a previous call to B(2)." msgstr "" "يُحدد I المراقبة التي يحدث لها هذا الحدث. وهو أحد واصفات المراقبة التي " "أعيدت بواسطة استدعاء سابق لـ B(2)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "I contains bits that describe the event that occurred (see below)." msgstr "يحتوي I على بتات تصف الحدث الذي حدث (انظر أدناه)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "I is a unique integer that connects related events. Currently, this " "is used only for rename events, and allows the resulting pair of " "B and B events to be connected by the " "application. For all other event types, I is set to 0." msgstr "" "I هو عدد صحيح فريد يربط الأحداث ذات الصلة. حاليًا، يُستخدم هذا فقط " "لأحداث إعادة التسمية، ويسمح للتطبيق بربط الزوج الناتج من أحداث " "B و B. بالنسبة لجميع أنواع الأحداث الأخرى، يُضبط " "I على 0." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I field is present only when an event is returned for a file " "inside a watched directory; it identifies the filename within the watched " "directory. This filename is null-terminated, and may include further null " "bytes (\\[aq]\\[rs]0\\[aq]) to align subsequent reads to a suitable address " "boundary." msgstr "" "حقل I موجود فقط عند إعادة حدث لملف داخل دليل مراقب؛ يُحدد اسم الملف " "داخل الدليل المراقب. اسم الملف هذا منتهي بصفر، وقد يتضمن بايتات صفرية إضافية " "(\\[aq]\\[rs]0\\[aq]) لمحاذاة القراءات اللاحقة إلى حد عنوان مناسب." #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I field counts all of the bytes in I, including the null " "bytes; the size of each I structure is thus I." msgstr "" "يحسب حقل I جميع البايتات في I، بما في ذلك البايتات الصفرية؛ " "وبالتالي فإن حجم كل بنية I هو I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The behavior when the buffer given to B(2) is too small to return " "information about the next event depends on the kernel version: before Linux " "2.6.21, B(2) returns 0; since Linux 2.6.21, B(2) fails with " "the error B. Specifying a buffer of size" msgstr "" "يعتمد السلوك عندما يكون المخزن المؤقت المُعطى لـ B(2) صغيرًا جدًا لإعادة " "معلومات حول الحدث التالي على إصدار النواة: قبل Linux 2.6.21، يُعيد B(2) " "0؛ منذ Linux 2.6.21، يفشل B(2) مع الخطأ B. تحديد مخزن مؤقت بحجم" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "sizeof(struct inotify_event) + NAME_MAX + 1\n" msgstr "sizeof(struct inotify_event) + NAME_MAX + 1\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "will be sufficient to read at least one event." msgstr "سيكون كافيًا لقراءة حدث واحد على الأقل." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "inotify events" msgstr "أحداث inotify" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B(2) I argument and the I field of the " "I structure returned when B(2)ing an inotify file " "descriptor are both bit masks identifying inotify events. The following " "bits can be specified in I when calling B(2) and " "may be returned in the I field returned by B(2):" msgstr "" "وسيط I لـ B(2) وحقل I لبنية I " "المُعاد عند قراءة B(2) لواصف ملف inotify هما قناعا بتات يُحددان أحداث " "inotify. يمكن تحديد البتات التالية في I عند استدعاء " "B(2) وقد تُعاد في حقل I المُعاد بواسطة 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-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "File was accessed (e.g., B(2), B(2))." msgstr "تم الوصول إلى الملف (مثل B(2)، 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 (*)" #. #-#-#-#-# archlinux: inotify.7.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . #. Events do not occur for link count changes on a file inside a monitored #. directory. This differs from other metadata changes for files inside #. a monitored directory. #. type: Plain text #. #-#-#-#-# debian-trixie: inotify.7.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . #. Events do not occur for link count changes on a file inside a monitored #. directory. This differs from other metadata changes for files inside #. a monitored directory. #. type: Plain text #. #-#-#-#-# debian-unstable: inotify.7.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . #. Events do not occur for link count changes on a file inside a monitored #. directory. This differs from other metadata changes for files inside #. a monitored directory. #. type: Plain text #. #-#-#-#-# fedora-44: inotify.7.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . #. Events do not occur for link count changes on a file inside a monitored #. directory. This differs from other metadata changes for files inside #. a monitored directory. #. type: Plain text #. #-#-#-#-# fedora-rawhide: inotify.7.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . #. Events do not occur for link count changes on a file inside a monitored #. directory. This differs from other metadata changes for files inside #. a monitored directory. #. type: Plain text #. #-#-#-#-# mageia-cauldron: inotify.7.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . #. Events do not occur for link count changes on a file inside a monitored #. directory. This differs from other metadata changes for files inside #. a monitored directory. #. type: Plain text #. #-#-#-#-# opensuse-leap-16-1: inotify.7.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . #. Events do not occur for link count changes on a file inside a monitored #. directory. This differs from other metadata changes for files inside #. a monitored directory. #. type: Plain text #. #-#-#-#-# opensuse-tumbleweed: inotify.7.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . #. Events do not occur for link count changes on a file inside a monitored #. directory. This differs from other metadata changes for files inside #. a monitored directory. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Metadata changed\\[em]for example, permissions (e.g., B(2)), " "timestamps (e.g., B(2)), extended attributes (B(2)), " "link count (since Linux 2.6.25; e.g., for the target of B(2) and for " "B(2)), and user/group ID (e.g., B(2))." msgstr "" "تغيرت البيانات الوصفية\\[em]على سبيل المثال، الأذونات (مثل B(2))، " "الطوابع الزمنية (مثل B(2))، السمات الموسعة (B(2))، عدد " "الروابط (منذ Linux 2.6.25؛ مثل لهدف B(2) و B(2))، ومعرف " "المستخدم/المجموعة (مثل 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-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "File opened for writing was closed." 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 "File or directory not opened for writing was closed." 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 "" "File/directory created in watched directory (e.g., B(2) B, " "B(2), B(2), B(2), B(2) on a UNIX domain socket)." msgstr "" "أنشئ ملف/دليل في الدليل المراقب (مثل B(2) B، B(2)، " "B(2)، B(2)، B(2) على مقبس نطاق UNIX)." #. 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 "File/directory deleted from watched directory." 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 "" "Watched file/directory was itself deleted. (This event also occurs if an " "object is moved to another filesystem, since B(1) in effect copies the " "file to the other filesystem and then deletes it from the original " "filesystem.) In addition, an B event will subsequently be " "generated for the watch descriptor." msgstr "" "حذف الملف/الدليل المراقب نفسه. (يحدث هذا الحدث أيضًا إذا نقل كائن إلى نظام " "ملفات آخر، لأن B(1) ينسخ الملف فعليًا إلى نظام الملفات الآخر ثم يحذفه من " "نظام الملفات الأصلي.) بالإضافة إلى ذلك، سيولد حدث 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 "File was modified (e.g., B(2), B(2))." msgstr "عدل الملف (مثل B(2)، 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-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Watched file/directory was itself moved." 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 "" "Generated for the directory containing the old filename when a file is " "renamed." 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 "" "Generated for the directory containing the new filename when a file is " "renamed." 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 "File or directory was opened." msgstr "فتح الملف أو الدليل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Inotify monitoring is inode-based: when monitoring a file (but not when " "monitoring the directory containing a file), an event can be generated for " "activity on any link to the file (in the same or a different directory)." msgstr "" "مراقبة Inotify قائمة على inode: عند مراقبة ملف (ولكن ليس عند مراقبة الدليل " "الذي يحتوي على ملف)، يمكن توليد حدث لنشاط على أي رابط للملف (في نفس الدليل " "أو دليل مختلف)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "When monitoring a directory:" msgstr "عند مراقبة دليل:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "the events marked above with an asterisk (*) can occur both for the " "directory itself and for objects inside the directory; and" msgstr "" "الأحداث المميزة أعلاه بعلامة النجمة (*) يمكن أن تحدث لكل من الدليل نفسه " "وللكائنات داخل الدليل؛ و" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "the events marked with a plus sign (+) occur only for objects inside the " "directory (not for the directory itself)." msgstr "" "الأحداث المميزة بعلامة الجمع (+) تحدث فقط للكائنات داخل الدليل (وليس للدليل " "نفسه)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "I: when monitoring a directory, events are not generated for the files " "inside the directory when the events are performed via a pathname (i.e., a " "link) that lies outside the monitored directory." msgstr "" "I<ملاحظة>: عند مراقبة دليل، لا تُنشأ أحداث للملفات داخل الدليل عندما تُنفذ " "الأحداث عبر اسم مسار (أي رابط) يقع خارج الدليل المراقب." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When events are generated for objects inside a watched directory, the " "I field in the returned I structure identifies the name " "of the file within the directory." 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 B macro is defined as a bit mask of all of the above " "events. This macro can be used as the I argument when calling " "B(2)." msgstr "" "عُرفت الكلية B كقناع بت لجميع الأحداث أعلاه. يمكن استخدام هذه " "الكلية كوسيط I عند استدعاء B(2)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Two additional convenience macros are defined:" 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 "Equates 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 "Equates to 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 following further bits can be specified in I when calling " "B(2):" msgstr "" "يمكن تحديد البتات الإضافية التالية في I عند استدعاء " "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 (since Linux 2.6.15)" msgstr "B (منذ Linux 2.6.15)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Don't dereference I if it is a symbolic link." 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 (since Linux 2.6.36)" msgstr "B (منذ Linux 2.6.36)" #. commit 8c1934c8d70b22ca8333b216aec6c7d09fdbd6a6 #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "By default, when watching events on the children of a directory, events are " "generated for children even after they have been unlinked from the " "directory. This can result in large numbers of uninteresting events for " "some applications (e.g., if watching I, in which many applications " "create temporary files whose names are immediately unlinked). Specifying " "B changes the default behavior, so that events are not " "generated for children after they have been unlinked from the watched " "directory." msgstr "" "مبدئيًا، عند مراقبة أحداث على أبناء دليل، تُنشأ أحداث للأبناء حتى بعد فصلهم عن " "الدليل. قد ينتج عن هذا أعداد كبيرة من الأحداث غير المهمة لبعض التطبيقات " "(مثلًا، عند مراقبة 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 "" "If a watch instance already exists for the filesystem object corresponding " "to I, add (OR) the events in I to the watch mask (instead of " "replacing the mask); the error B results if B is " "also specified." msgstr "" "إذا وُجدت نسخة مراقبة مسبقًا لكائن نظام الملفات المطابق لـ I، أضف " "(OR) الأحداث في I إلى قناع المراقبة (بدل استبدال القناع)؛ ينتج الخطأ " "B إذا حُدد 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 "" "Monitor the filesystem object corresponding to I for one event, " "then remove from watch list." 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 (since Linux 2.6.15)" msgstr "B (منذ Linux 2.6.15)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Watch I only if it is a directory; the error B results if " "I is not a directory. Using this flag provides an application " "with a race-free way of ensuring that the monitored object is a directory." msgstr "" "راقب I فقط إذا كان دليلًا؛ ينتج الخطأ B إذا لم يكن " "I دليلًا. يوفر استخدام هذه العلامة للتطبيق طريقة خالية من السباق " "لضمان أن الكائن المراقب هو دليل." #. 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 4.18)" msgstr "B (منذ Linux 4.18)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Watch I only if it does not already have a watch associated with " "it; the error B results if I is already being watched." msgstr "" "راقب I فقط إذا لم يكن لديه مراقبة مرتبطة به بالفعل؛ ينتج الخطأ " "B إذا كان I مراقبًا بالفعل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Using this flag provides an application with a way of ensuring that new " "watches do not modify existing ones. This is useful because multiple paths " "may refer to the same inode, and multiple calls to B(2) " "without this flag may clobber existing watch masks." msgstr "" "يوفر استخدام هذه العلامة للتطبيق طريقة لضمان أن المراقبات الجديدة لا تعدل " "الموجودة. هذا مفيد لأن مسارات متعددة قد تشير إلى نفس inode، وقد تؤدي " "الاستدعاءات المتعددة لـ B(2) بدون هذه العلامة إلى إتلاف " "أقنعة المراقبة الموجودة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The following bits may be set in the I field returned by B(2):" msgstr "قد تُضبط البتات التالية في حقل I المعاد بواسطة 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-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Watch was removed explicitly (B(2)) or automatically " "(file was deleted, or filesystem was unmounted). See also BUGS." msgstr "" "أزيلت المراقبة صراحة (B(2)) أو آليًا (حُذف الملف، أو فُصل " "نظام الملفات). انظر أيضًا BUGS." #. 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 "Subject of this event is a directory." 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 "Event queue overflowed (I is -1 for this event)." msgstr "فاضت قائمة انتظار الأحداث (I يساوي -1 لهذا الحدث)." #. 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 "" "Filesystem containing watched object was unmounted. In addition, an " "B event will subsequently be generated for the watch descriptor." msgstr "" "نظام الملفات الذي يحتوي على الكائن المراقب فُصل. بالإضافة إلى ذلك، يُولد حدث " "B لاحقًا لواصف المراقبة." #. type: SS #: 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 "" "Suppose an application is watching the directory I and the file I for all events. The examples below show some events that will be " "generated for these two objects." 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 "fd = open(\"dir/myfile\", O_RDWR);" msgstr "fd = open(\"dir/myfile\", O_RDWR);" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Generates B events for both I and I." msgstr "يُولد أحداث B لكل من I و I." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "read(fd, buf, count);" msgstr "read(fd, buf, count);" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Generates B events for both I and I." msgstr "يُولد أحداث B لكل من I و I." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "write(fd, buf, count);" msgstr "write(fd, buf, count);" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Generates B events for both I and I." msgstr "يُولد أحداث B لكل من I و I." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "fchmod(fd, mode);" msgstr "fchmod(fd, mode);" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Generates B events for both I and I." msgstr "يُولد أحداث B لكل من I و I." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "close(fd);" msgstr "close(fd);" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Generates B events for both I and I." 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 "" "Suppose an application is watching the directories I and I, and " "the file I. The following examples show some events that may " "be generated." msgstr "" "افترض أن تطبيقًا يراقب الدليلين I و I، والملف I. " "الأمثلة التالية تُظهر بعض الأحداث التي قد تُولد." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "link(\"dir1/myfile\", \"dir2/new\");" msgstr "link(\"dir1/myfile\", \"dir2/new\");" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Generates an B event for I and an B event for " "I." msgstr "يُولد حدث B لـ I وحدث B لـ I." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "rename(\"dir1/myfile\", \"dir2/myfile\");" msgstr "rename(\"dir1/myfile\", \"dir2/myfile\");" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Generates an B event for I, an B event for " "I, and an B event for I. The B " "and B events will have the same I value." msgstr "" "يُولد حدث B لـ I، وحدث B لـ I، وحدث " "B لـ I. أحداث B و B سيكون " "لها نفس قيمة I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Suppose that I and I are (the only) links to the same " "file, and an application is watching I, I, I, and " "I. Executing the following calls in the order given below will " "generate the following events:" msgstr "" "افترض أن I و I هما (الروابط الوحيدة) لنفس الملف، وتطبيق " "يراقب I و I و I و I. تنفيذ الاستدعاءات التالية " "بالترتيب المعطى أدناه سيُولد الأحداث التالية:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "unlink(\"dir2/yy\");" msgstr "unlink(\"dir2/yy\");" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Generates an B event for I (because its link count changes) " "and an B event for I." msgstr "" "يُولد حدث B لـ I (لأن عدد روابطه يتغير) وحدث B لـ " "I." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "unlink(\"dir1/xx\");" msgstr "unlink(\"dir1/xx\");" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Generates B, B, and B events for " "I, and an B event for I." msgstr "" "يُولّد أحداث B وB وB لـ I، وحدث " "B لـ I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Suppose an application is watching the directory I and (the empty) " "directory I. The following examples show some events that may " "be generated." 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 "mkdir(\"dir/new\", mode);" msgstr "mkdir(\"dir/new\", mode);" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Generates an B event for I." msgstr "يُولّد حدث B لـ I." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "rmdir(\"dir/subdir\");" msgstr "rmdir(\"dir/subdir\");" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Generates B and B events for I, and an " "B event for I." msgstr "" "يُولّد أحداث B وB لـ I، وحدث B لـ I." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "/proc interfaces" msgstr "واجهات /proc" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The following interfaces can be used to limit the amount of kernel memory " "consumed by inotify:" msgstr "" "الواجهات التالية يمكن استخدامها لتحديد كمية ذاكرة النواة التي يستهلكها " "inotify:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The value in this file is used when an application calls B(2) " "to set an upper limit on the number of events that can be queued to the " "corresponding inotify instance. Events in excess of this limit are dropped, " "but an B event is always generated." msgstr "" "القيمة في هذا الملف تُستخدم عندما يستدعي تطبيق B(2) لتعيين حد " "أعلى لعدد الأحداث التي يمكن وضعها في طابور لنفس نسخة inotify. الأحداث التي " "تتجاوز هذا الحد تُسقط، لكن حدث B يُولّد دائمًا." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This specifies an upper limit on the number of inotify instances that can be " "created per real user ID." msgstr "" "هذا يُحدد حدًا أعلى لعدد نسخ inotify التي يمكن إنشاؤها لكل معرف مستخدم حقيقي." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This specifies an upper limit on the number of watches that can be created " "per real user ID." msgstr "" "هذا يُحدد حدًا أعلى لعدد المراقبات التي يمكن إنشاؤها لكل معرف مستخدم حقيقي." #. 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 "Linux." msgstr "لينكس." #. 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 "" "Inotify was merged into Linux 2.6.13. The required library interfaces were " "added in glibc 2.4. (B, B, and B " "were added in glibc 2.5.)" msgstr "" "Inotify دُمج في Linux 2.6.13. واجهات المكتبة المطلوبة أُضيفت في glibc 2.4. " "(B وB وB أُضيفت في glibc 2.5.)" #. 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 "" "Inotify file descriptors can be monitored using B(2) وB(2) " "وB(7). عندما يكون حدث متاحًا، يُشير مُعرّف الملف إلى أنه قابل للقراءة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Since Linux 2.6.25, signal-driven I/O notification is available for inotify " "file descriptors; see the discussion of B (for setting the " "B flag), B, and B in B(2). The " "I structure (described in B(2)) that is passed to the " "signal handler has the following fields set: I is set to the inotify " "file descriptor number; I is set to the signal number; I " "is set to B; and B is set in I." msgstr "" "منذ Linux 2.6.25، إعلام الإدخال/الإخراج المُوجّه بالإشارة متاح لمُعرّفات ملفات " "inotify؛ انظر مناقشة B (لتعيين علامة B) وB " "وB في B(2). بنية I (الموصوفة في " "B(2)) التي تُمرّر إلى معالج الإشارة تحتوي على الحقول التالية " "المُعيّنة: I يُعيّن إلى رقم مُعرّف ملف inotify؛ I يُعيّن إلى رقم " "الإشارة؛ I يُعيّن إلى B؛ وB يُعيّن في I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If successive output inotify events produced on the inotify file descriptor " "are identical (same I, I, I, and I), then they are " "coalesced into a single event if the older event has not yet been read (but " "see BUGS). This reduces the amount of kernel memory required for the event " "queue, but also means that an application can't use inotify to reliably " "count file events." msgstr "" "إذا كانت أحداث inotify الناتجة المتتالية على مُعرّف ملف inotify متطابقة (نفس " "I وI وI وI)، فإنها تُدمج في حدث واحد إذا لم يُقرأ " "الحدث الأقدم بعد (لكن انظر BUGS). هذا يُقلل كمية ذاكرة النواة المطلوبة " "لطابور الأحداث، لكنه يعني أيضًا أن التطبيق لا يمكنه استخدام inotify لعد أحداث " "الملفات بشكل موثوق." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The events returned by reading from an inotify file descriptor form an " "ordered queue. Thus, for example, it is guaranteed that when renaming from " "one directory to another, events will be produced in the correct order on " "the inotify file descriptor." msgstr "" "الأحداث المُعادة بالقراءة من مُعرّف ملف inotify تُشكّل طابورًا مُرتّبًا. وبالتالي، " "على سبيل المثال، مضمون أنه عند إعادة التسمية من دليل إلى آخر، ستُنتج الأحداث " "بالترتيب الصحيح على مُعرّف ملف inotify." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The set of watch descriptors that is being monitored via an inotify file " "descriptor can be viewed via the entry for the inotify file descriptor in " "the process's IpidI directory. See B(5) for further " "details. The B B(2) returns the number of bytes available " "to read from an inotify file descriptor." msgstr "" "مجموعة مُعرّفات المراقبة التي تُراقب عبر مُعرّف ملف inotify يمكن عرضها عبر " "الإدخال لمُعرّف ملف inotify في دليل العملية IpidI. انظر " "B(5) لمزيد من التفاصيل. B B(2) يُعيد عدد البايتات " "المتاحة للقراءة من مُعرّف ملف inotify." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Limitations and caveats" msgstr "القيود والتحذيرات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The inotify API provides no information about the user or process that " "triggered the inotify event. In particular, there is no easy way for a " "process that is monitoring events via inotify to distinguish events that it " "triggers itself from those that are triggered by other processes." msgstr "" "واجهة برمجة inotify لا تُوفّر معلومات عن المستخدم أو العملية التي أثارت حدث " "inotify. على وجه الخصوص، لا توجد طريقة سهلة لعملية تُراقب الأحداث عبر " "inotify لتمييز الأحداث التي تُثيرها بنفسها عن تلك التي تُثار بواسطة عمليات " "أخرى." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Inotify reports only events that a user-space program triggers through the " "filesystem API. As a result, it does not catch remote events that occur on " "network filesystems. (Applications must fall back to polling the filesystem " "to catch such events.) Furthermore, various pseudo-filesystems such as I, I, and I are not monitorable with inotify." msgstr "" "Inotify يُبلغ فقط عن الأحداث التي يُثيرها برنامج في مساحة المستخدم عبر واجهة " "برمجة نظام الملفات. نتيجة لذلك، لا يلتقط الأحداث البعيدة التي تحدث على " "أنظمة ملفات الشبكة. (يجب على التطبيقات العودة إلى استقصاء نظام الملفات " "لالتقاط مثل هذه الأحداث.) علاوة على ذلك، أنظمة ملفات زائفة متنوعة مثل I وI وI غير قابلة للمراقبة باستخدام inotify." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The inotify API does not report file accesses and modifications that may " "occur because of B(2), B(2), and B(2)." msgstr "" "واجهة برمجة inotify لا تُبلغ عن وصولات وتعديلات الملفات التي قد تحدث بسبب " "B(2) وB(2) وB(2)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The inotify API identifies affected files by filename. However, by the time " "an application processes an inotify event, the filename may already have " "been deleted or renamed." msgstr "" "واجهة برمجة inotify تُحدد الملفات المتأثرة باسم الملف. ومع ذلك، بحلول الوقت " "الذي يعالج فيه تطبيق حدث inotify، قد يكون اسم الملف قد حُذف أو أُعيدت تسميته " "بالفعل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The inotify API identifies events via watch descriptors. It is the " "application's responsibility to cache a mapping (if one is needed) between " "watch descriptors and pathnames. Be aware that directory renamings may " "affect multiple cached pathnames." msgstr "" "واجهة برمجة inotify تُحدد الأحداث عبر مُعرّفات المراقبة. من مسؤولية التطبيق " "تخزين تعيين (إذا كان مطلوبًا) بين مُعرّفات المراقبة وأسماء المسارات. كن على " "علم بأن إعادة تسمية الدلائل قد تؤثر على أسماء مسارات مخزنة متعددة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Inotify monitoring of directories is not recursive: to monitor " "subdirectories under a directory, additional watches must be created. This " "can take a significant amount time for large directory trees." msgstr "" "مراقبة الأدلة باستخدام inotify ليست متكررة: لمراقبة الأدلة الفرعية ضمن دليل، " "يجب إنشاء مراقبات إضافية. قد يستغرق هذا وقتًا كبيرًا لأشجار الأدلة الكبيرة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If monitoring an entire directory subtree, and a new subdirectory is created " "in that tree or an existing directory is renamed into that tree, be aware " "that by the time you create a watch for the new subdirectory, new files (and " "subdirectories) may already exist inside the subdirectory. Therefore, you " "may want to scan the contents of the subdirectory immediately after adding " "the watch (and, if desired, recursively add watches for any subdirectories " "that it contains)." msgstr "" "إذا كنت تراقب شجرة دليل كاملة، وتم إنشاء دليل فرعي جديد في تلك الشجرة أو تمت " "إعادة تسمية دليل موجود إلى تلك الشجرة، فاعلم أنه بحلول الوقت الذي تنشئ فيه " "مراقبة للدليل الفرعي الجديد، قد تكون الملفات (والأدلة الفرعية) الجديدة " "موجودة بالفعل داخل الدليل الفرعي. لذلك، قد ترغب في مسح محتويات الدليل الفرعي " "فورًا بعد إضافة المراقبة (وإذا رغبت، أضف مراقبات بشكل متكرر لأي أدلة فرعية " "يحتويها)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Note that the event queue can overflow. In this case, events are lost. " "Robust applications should handle the possibility of lost events " "gracefully. For example, it may be necessary to rebuild part or all of the " "application cache. (One simple, but possibly expensive, approach is to " "close the inotify file descriptor, empty the cache, create a new inotify " "file descriptor, and then re-create watches and cache entries for the " "objects to be monitored.)" msgstr "" "لاحظ أن قائمة انتظار الأحداث قد تفيض. في هذه الحالة، تُفقد الأحداث. يجب على " "التطبيقات القوية التعامل مع احتمال فقدان الأحداث بلطف. على سبيل المثال، قد " "يكون من الضروري إعادة بناء جزء أو كل الخبيئة الخاصة بالتطبيق. (أحد الأساليب " "البسيطة، ولكن ربما المكلفة، هو إغلاق واصف ملف inotify، وتفريغ الخبيئة، " "وإنشاء واصف ملف inotify جديد، ثم إعادة إنشاء المراقبات وإدخالات الخبيئة " "للكائنات المراد مراقبتها.)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If a filesystem is mounted on top of a monitored directory, no event is " "generated, and no events are generated for objects immediately under the new " "mount point. If the filesystem is subsequently unmounted, events will " "subsequently be generated for the directory and the objects it contains." msgstr "" "إذا تم وصل نظام ملفات فوق دليل مراقَب، لا يتم إنشاء أي حدث، ولا يتم إنشاء " "أحداث للكائنات الموجودة مباشرة تحت نقطة الوصل الجديدة. إذا تم فك وصل نظام " "الملفات لاحقًا، فسيتم إنشاء أحداث لاحقًا للدليل والكائنات التي يحتويها." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Dealing with rename() events" msgstr "التعامل مع أحداث rename()" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "As noted above, the B and B event pair that is " "generated by B(2) can be matched up via their shared cookie value. " "However, the task of matching has some challenges." msgstr "" "كما ذكر أعلاه، يمكن مطابقة زوج الأحداث B و B " "الذي يولده B(2) من خلال قيمة الكوكي المشتركة. ومع ذلك، فإن مهمة " "المطابقة تواجه بعض التحديات." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "These two events are usually consecutive in the event stream available when " "reading from the inotify file descriptor. However, this is not guaranteed. " "If multiple processes are triggering events for monitored objects, then (on " "rare occasions) an arbitrary number of other events may appear between the " "B and B events. Furthermore, it is not " "guaranteed that the event pair is atomically inserted into the queue: there " "may be a brief interval where the B has appeared, but the " "B has not." msgstr "" "عادةً ما يكون هذان الحدثان متتاليين في تدفق الأحداث المتاح عند القراءة من " "واصف ملف inotify. ومع ذلك، هذا غير مضمون. إذا كانت عمليات متعددة تُطلق أحداثًا " "لكائنات مراقَبة، فقد تظهر (في حالات نادرة) عدد عشوائي من الأحداث الأخرى بين " "حدثي B و B. علاوة على ذلك، ليس مضمونًا أن يتم " "إدراج زوج الأحداث بشكل ذري في قائمة الانتظار: قد تكون هناك فترة وجيزة حيث " "يظهر B، ولكن B لم يظهر بعد." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Matching up the B and B event pair generated by " "B(2) is thus inherently racy. (Don't forget that if an object is " "renamed outside of a monitored directory, there may not even be an " "B event.) Heuristic approaches (e.g., assume the events are " "always consecutive) can be used to ensure a match in most cases, but will " "inevitably miss some cases, causing the application to perceive the " "B and B events as being unrelated. If watch " "descriptors are destroyed and re-created as a result, then those watch " "descriptors will be inconsistent with the watch descriptors in any pending " "events. (Re-creating the inotify file descriptor and rebuilding the cache " "may be useful to deal with this scenario.)" msgstr "" "وبالتالي، فإن مطابقة زوج الأحداث B و B الذي " "يولده B(2) هو أمر محفوف بالمخاطر بطبيعته. (لا تنس أنه إذا تمت إعادة " "تسمية كائن خارج دليل مراقَب، فقد لا يكون هناك حتى حدث B.) يمكن " "استخدام الأساليب الاستكشافية (مثل افتراض أن الأحداث متتالية دائمًا) لضمان " "تطابق في معظم الحالات، لكنها ستفتقد حتمًا بعض الحالات، مما يتسبب في أن يرى " "التطبيق حدثي B و B كحدثين غير مرتبطين. إذا تم " "تدمير واصفات المراقبة وإعادة إنشائها نتيجة لذلك، فإن واصفات المراقبة هذه " "ستكون غير متسقة مع واصفات المراقبة في أي أحداث معلقة. (قد تكون إعادة إنشاء " "واصف ملف inotify وإعادة بناء الخبيئة مفيدة للتعامل مع هذا السيناريو.)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Applications should also allow for the possibility that the B " "event was the last event that could fit in the buffer returned by the " "current call to B(2), and the accompanying B event might " "be fetched only on the next B(2), which should be done with a (small) " "timeout to allow for the fact that insertion of the " "B+B event pair is not atomic, and also the " "possibility that there may not be any B event." msgstr "" "يجب على التطبيقات أيضًا أن تسمح باحتمال أن يكون حدث B هو آخر " "حدث يمكن وضعه في المخزن المؤقت الذي أرجعته الاستدعاء الحالي لـ B(2)، " "وأن حدث B المصاحب قد يتم جلبه فقط في استدعاء B(2) التالي، " "والذي يجب أن يتم مع مهلة (صغيرة) لمراعاة حقيقة أن إدراج زوج الأحداث " "B+B ليس ذريًا، وأيضًا احتمال عدم وجود أي حدث " "B." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "BUGS" msgstr "العلل" #. commit 820c12d5d6c0890bc93dd63893924a13041fdc35 #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Before Linux 3.19, B(2) did not create any inotify events. " "Since Linux 3.19, calls to B(2) generate B events." msgstr "" "قبل لينكس 3.19، لم ينشئ B(2) أي أحداث inotify. منذ لينكس 3.19، " "تولد استدعاءات B(2) أحداث B." #. FIXME . kernel commit 611da04f7a31b2208e838be55a42c7a1310ae321 #. implies that unmount events were buggy since Linux 2.6.11 to Linux 2.6.36 #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Before Linux 2.6.16, the B I flag does not work." msgstr "قبل لينكس 2.6.16، لا تعمل علامة B I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "As originally designed and implemented, the B flag did not cause " "an B event to be generated when the watch was dropped after one " "event. However, as an unintended effect of other changes, since Linux " "2.6.36, an B event is generated in this case." msgstr "" "كما تم تصميمه وتنفيذه أصلاً، لم تتسبب علامة B في إنشاء حدث " "B عند إسقاط المراقبة بعد حدث واحد. ومع ذلك، كأثر غير مقصود " "لتغييرات أخرى، منذ لينكس 2.6.36، يتم إنشاء حدث B في هذه الحالة." #. commit 1c17d18e3775485bf1e0ce79575eb637a94494a2 #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Before Linux 2.6.25, the kernel code that was intended to coalesce " "successive identical events (i.e., the two most recent events could " "potentially be coalesced if the older had not yet been read) instead " "checked if the most recent event could be coalesced with the I " "unread event." msgstr "" "قبل لينكس 2.6.25، كان رمز النواة الذي كان يهدف إلى دمج الأحداث المتطابقة " "المتتالية (أي، كان من الممكن دمج أحدث حدثين إذا لم يتم قراءة الأقدم بعد) " "يتحقق بدلاً من ذلك مما إذا كان يمكن دمج أحدث حدث مع I<أقدم> حدث غير مقروء." #. FIXME . https://bugzilla.kernel.org/show_bug.cgi?id=77111 #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When a watch descriptor is removed by calling B(2) (or " "because a watch file is deleted or the filesystem that contains it is " "unmounted), any pending unread events for that watch descriptor remain " "available to read. As watch descriptors are subsequently allocated with " "B(2), the kernel cycles through the range of possible " "watch descriptors (1 to B) incrementally. When allocating a free " "watch descriptor, no check is made to see whether that watch descriptor " "number has any pending unread events in the inotify queue. Thus, it can " "happen that a watch descriptor is reallocated even when pending unread " "events exist for a previous incarnation of that watch descriptor number, " "with the result that the application might then read those events and " "interpret them as belonging to the file associated with the newly recycled " "watch descriptor. In practice, the likelihood of hitting this bug may be " "extremely low, since it requires that an application cycle through " "B watch descriptors, release a watch descriptor while leaving " "unread events for that watch descriptor in the queue, and then recycle that " "watch descriptor. For this reason, and because there have been no reports " "of the bug occurring in real-world applications, as of Linux 3.15, no kernel " "changes have yet been made to eliminate this possible bug." msgstr "" "عند إزالة واصف مراقبة عن طريق استدعاء B(2) (أو بسبب حذف " "ملف مراقَب أو فك وصل نظام الملفات الذي يحتويه)، تظل أي أحداث معلقة غير مقروءة " "لواصف المراقبة هذا متاحة للقراءة. نظرًا لأنه يتم تخصيص واصفات المراقبة لاحقًا " "باستخدام B(2)، تقوم النواة بالتنقل عبر نطاق واصفات " "المراقبة الممكنة (من 1 إلى B) بشكل تدريجي. عند تخصيص واصف مراقبة " "حر، لا يتم إجراء أي فحص لمعرفة ما إذا كان رقم واصف المراقبة هذا يحتوي على أي " "أحداث معلقة غير مقروءة في قائمة انتظار inotify. وبالتالي، يمكن أن يحدث أن " "يتم إعادة تخصيص واصف مراقبة حتى عندما توجد أحداث معلقة غير مقروءة لتجسيد " "سابق لرقم واصف المراقبة ذلك، مما يؤدي إلى أن التطبيق قد يقرأ تلك الأحداث " "ويفسرها على أنها تنتمي إلى الملف المرتبط بواصف المراقبة المعاد تدويره حديثًا. " "من الناحية العملية، قد يكون احتمال الوصول إلى هذا الخطأ منخفضًا للغاية، لأنه " "يتطلب أن يتنقل التطبيق عبر B من واصفات المراقبة، ويحرر واصف مراقبة " "مع ترك أحداث غير مقروءة لواصف المراقبة ذلك في قائمة الانتظار، ثم يعيد تدوير " "واصف المراقبة ذلك. لهذا السبب، ولأنه لم ترد تقارير عن حدوث الخطأ في " "التطبيقات الواقعية، فاعتبارًا من لينكس 3.15، لم يتم إجراء أي تغييرات على " "النواة بعد لإزالة هذا الخطأ المحتمل." #. 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 following program demonstrates the usage of the inotify API. It marks " "the directories passed as a command-line arguments and waits for events of " "type B, B, and B." msgstr "" "يُظهر البرنامج التالي استخدام واجهة برمجة تطبيقات inotify. يحدد الأدلة التي " "تم تمريرها كوسائط سطر أوامر وينتظر أحداثًا من النوع 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 following output was recorded while editing the file I and listing directory I. Before the file and the directory were " "opened, B events occurred. After the file was closed, an " "B event occurred. After the directory was closed, an " "B event occurred. Execution of the program ended when the " "user pressed the ENTER key." msgstr "" "تم تسجيل المخرجات التالية أثناء تحرير الملف I وسرد " "الدليل I. قبل فتح الملف والدليل، حدثت أحداث B. بعد إغلاق " "الملف، حدث حدث B. بعد إغلاق الدليل، حدث حدث " "B. انتهى تنفيذ البرنامج عندما ضغط المستخدم على مفتاح ENTER." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Example output" msgstr "مثال على الخرج" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "$B< ./a.out /tmp /home/user/temp>;\n" "Press enter key to terminate.\n" "Listening for events.\n" "IN_OPEN: /home/user/temp/foo [file]\n" "IN_CLOSE_WRITE: /home/user/temp/foo [file]\n" "IN_OPEN: /tmp/ [directory]\n" "IN_CLOSE_NOWRITE: /tmp/ [directory]\n" "\\&\n" "Listening for events stopped.\n" msgstr "" "$B< ./a.out /tmp /home/user/temp>;\n" "Press enter key to terminate.\n" "Listening for events.\n" "IN_OPEN: /home/user/temp/foo [file]\n" "IN_CLOSE_WRITE: /home/user/temp/foo [file]\n" "IN_OPEN: /tmp/ [directory]\n" "IN_CLOSE_NOWRITE: /tmp/ [directory]\n" "\\&\n" "Listening for events stopped.\n" #. 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 opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "#include Eerrno.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/inotify.hE\n" "#include Eunistd.hE\n" "#include Estring.hE\n" "\\&\n" "/* Read all available inotify events from the file descriptor \\[aq]fd\\[aq].\n" " wd is the table of watch descriptors for the directories in argv.\n" " argc is the size of wd and argv.\n" " argv is the list of watched directories.\n" " Entry 0 of wd and argv is unused. */\n" "\\&\n" "static void\n" "handle_events(int fd, int *wd, int argc, char* argv[])\n" "{\n" " /* Some systems cannot read integer variables if they are not\n" " properly aligned. On other systems, incorrect alignment may\n" " decrease performance. Hence, the buffer used for reading from\n" " the inotify file descriptor should have the same alignment as\n" " struct inotify_event. */\n" "\\&\n" " char buf[4096]\n" " __attribute__ ((aligned(__alignof__(struct inotify_event))));\n" " const struct inotify_event *event;\n" " ssize_t size;\n" "\\&\n" " /* Loop while events can be read from inotify file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Read some events. */\n" "\\&\n" " size = read(fd, buf, sizeof(buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* If the nonblocking read() found no events to read, then\n" " it returns -1 with errno set to EAGAIN. In that case,\n" " we exit the loop. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " for (char *ptr = buf; ptr E buf + size;\n" " ptr += sizeof(struct inotify_event) + event-Elen) {\n" "\\&\n" " event = (const struct inotify_event *) ptr;\n" "\\&\n" " /* Print event type. */\n" "\\&\n" " if (event-Emask & IN_OPEN)\n" " printf(\"IN_OPEN: \");\n" " if (event-Emask & IN_CLOSE_NOWRITE)\n" " printf(\"IN_CLOSE_NOWRITE: \");\n" " if (event-Emask & IN_CLOSE_WRITE)\n" " printf(\"IN_CLOSE_WRITE: \");\n" "\\&\n" " /* Print the name of the watched directory. */\n" "\\&\n" " for (size_t i = 1; i E argc; ++i) {\n" " if (wd[i] == event-Ewd) {\n" " printf(\"%s/\", argv[i]);\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Print the name of the file. */\n" "\\&\n" " if (event-Elen)\n" " printf(\"%s\", event-Ename);\n" "\\&\n" " /* Print type of filesystem object. */\n" "\\&\n" " if (event-Emask & IN_ISDIR)\n" " printf(\" [directory]\\[rs]n\");\n" " else\n" " printf(\" [file]\\[rs]n\");\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char* argv[])\n" "{\n" " char buf;\n" " int fd, i, poll_num;\n" " int *wd;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " if (argc E 2) {\n" " printf(\"Usage: %s PATH [PATH ...]\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press ENTER key to terminate.\\[rs]n\");\n" "\\&\n" " /* Create the file descriptor for accessing the inotify API. */\n" "\\&\n" " fd = inotify_init1(IN_NONBLOCK);\n" " if (fd == -1) {\n" " perror(\"inotify_init1\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Allocate memory for watch descriptors. */\n" "\\&\n" " wd = calloc(argc, sizeof(int));\n" " if (wd == NULL) {\n" " perror(\"calloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark directories for events\n" " - file was opened\n" " - file was closed */\n" "\\&\n" " for (i = 1; i E argc; i++) {\n" " wd[i] = inotify_add_watch(fd, argv[i],\n" " IN_OPEN | IN_CLOSE);\n" " if (wd[i] == -1) {\n" " fprintf(stderr, \"Cannot watch \\[aq]%s\\[aq]: %s\\[rs]n\",\n" " argv[i], strerror(errno));\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " /* Prepare for polling. */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* Console input */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* Inotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* Wait for events and/or terminal input. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" " for (;;) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR)\n" " continue;\n" " perror(\"poll\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" "\\&\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* Console input is available. Empty stdin and quit. */\n" "\\&\n" " while (read(STDIN_FILENO, &buf, 1) E 0 && buf != \\[aq]\\[rs]n\\[aq])\n" " continue;\n" " break;\n" " }\n" "\\&\n" " if (fds[1].revents & POLLIN) {\n" "\\&\n" " /* Inotify events are available. */\n" "\\&\n" " handle_events(fd, wd, argc, argv);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" "\\&\n" " /* Close inotify file descriptor. */\n" "\\&\n" " close(fd);\n" "\\&\n" " free(wd);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#include Eerrno.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/inotify.hE\n" "#include Eunistd.hE\n" "#include Estring.hE\n" "\\&\n" "/* Read all available inotify events from the file descriptor \\[aq]fd\\[aq].\n" " wd is the table of watch descriptors for the directories in argv.\n" " argc is the size of wd and argv.\n" " argv is the list of watched directories.\n" " Entry 0 of wd and argv is unused. */\n" "\\&\n" "static void\n" "handle_events(int fd, int *wd, int argc, char* argv[])\n" "{\n" " /* Some systems cannot read integer variables if they are not\n" " properly aligned. On other systems, incorrect alignment may\n" " decrease performance. Hence, the buffer used for reading from\n" " the inotify file descriptor should have the same alignment as\n" " struct inotify_event. */\n" "\\&\n" " char buf[4096]\n" " __attribute__ ((aligned(__alignof__(struct inotify_event))));\n" " const struct inotify_event *event;\n" " ssize_t size;\n" "\\&\n" " /* Loop while events can be read from inotify file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Read some events. */\n" "\\&\n" " size = read(fd, buf, sizeof(buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* If the nonblocking read() found no events to read, then\n" " it returns -1 with errno set to EAGAIN. In that case,\n" " we exit the loop. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " for (char *ptr = buf; ptr E buf + size;\n" " ptr += sizeof(struct inotify_event) + event-Elen) {\n" "\\&\n" " event = (const struct inotify_event *) ptr;\n" "\\&\n" " /* Print event type. */\n" "\\&\n" " if (event-Emask & IN_OPEN)\n" " printf(\"IN_OPEN: \");\n" " if (event-Emask & IN_CLOSE_NOWRITE)\n" " printf(\"IN_CLOSE_NOWRITE: \");\n" " if (event-Emask & IN_CLOSE_WRITE)\n" " printf(\"IN_CLOSE_WRITE: \");\n" "\\&\n" " /* Print the name of the watched directory. */\n" "\\&\n" " for (size_t i = 1; i E argc; ++i) {\n" " if (wd[i] == event-Ewd) {\n" " printf(\"%s/\", argv[i]);\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Print the name of the file. */\n" "\\&\n" " if (event-Elen)\n" " printf(\"%s\", event-Ename);\n" "\\&\n" " /* Print type of filesystem object. */\n" "\\&\n" " if (event-Emask & IN_ISDIR)\n" " printf(\" [directory]\\[rs]n\");\n" " else\n" " printf(\" [file]\\[rs]n\");\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char* argv[])\n" "{\n" " char buf;\n" " int fd, i, poll_num;\n" " int *wd;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " if (argc E 2) {\n" " printf(\"Usage: %s PATH [PATH ...]\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press ENTER key to terminate.\\[rs]n\");\n" "\\&\n" " /* Create the file descriptor for accessing the inotify API. */\n" "\\&\n" " fd = inotify_init1(IN_NONBLOCK);\n" " if (fd == -1) {\n" " perror(\"inotify_init1\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Allocate memory for watch descriptors. */\n" "\\&\n" " wd = calloc(argc, sizeof(int));\n" " if (wd == NULL) {\n" " perror(\"calloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark directories for events\n" " - file was opened\n" " - file was closed */\n" "\\&\n" " for (i = 1; i E argc; i++) {\n" " wd[i] = inotify_add_watch(fd, argv[i],\n" " IN_OPEN | IN_CLOSE);\n" " if (wd[i] == -1) {\n" " fprintf(stderr, \"Cannot watch \\[aq]%s\\[aq]: %s\\[rs]n\",\n" " argv[i], strerror(errno));\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " /* Prepare for polling. */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* Console input */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* Inotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* Wait for events and/or terminal input. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" " for (;;) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR)\n" " continue;\n" " perror(\"poll\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" "\\&\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* Console input is available. Empty stdin and quit. */\n" "\\&\n" " while (read(STDIN_FILENO, &buf, 1) E 0 && buf != \\[aq]\\[rs]n\\[aq])\n" " continue;\n" " break;\n" " }\n" "\\&\n" " if (fds[1].revents & POLLIN) {\n" "\\&\n" " /* Inotify events are available. */\n" "\\&\n" " handle_events(fd, wd, argc, argv);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" "\\&\n" " /* Close inotify file descriptor. */\n" "\\&\n" " close(fd);\n" "\\&\n" " free(wd);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. 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(1), B(1), B(2), " "B(2), B(2), B(2), B(2), " "B(2), B(7)" msgstr "" "B(1), B(1), B(2), " "B(2), B(2), B(2), B(2), " "B(2), B(7)" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "I in the Linux kernel source tree" msgstr "I في شجرة مصدر نواة لينكس" #. 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" #. FIXME . The type of the 'wd' field should probably be "int32_t". #. I submitted a patch to fix this. See the LKML thread #. "[patch] Fix type errors in inotify interfaces", 18 Nov 2008 #. glibc bug filed: https://www.sourceware.org/bugzilla/show_bug.cgi?id=7040 #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "struct inotify_event {\n" " int wd; /* Watch descriptor */\n" " uint32_t mask; /* Mask describing event */\n" " uint32_t cookie; /* Unique cookie associating related\n" " events (for rename(2)) */\n" " uint32_t len; /* Size of I field */\n" " char name[]; /* Optional null-terminated name */\n" "};\n" msgstr "" "struct inotify_event {\n" " int wd; /* Watch descriptor */\n" " uint32_t mask; /* Mask describing event */\n" " uint32_t cookie; /* Unique cookie associating related\n" " events (for rename(2)) */\n" " uint32_t len; /* Size of I field */\n" " char name[]; /* Optional null-terminated name */\n" "};\n" #. type: Plain text #: debian-trixie msgid "" "The I field counts all of the bytes in I, including the null " "bytes; the length of each I structure is thus I." msgstr "" "يحسب الحقل I إجمالي عدد البايتات الموجودة في I، بما في ذلك " "البايتات الفارغة؛ وبالتالي، فإن طول كل بنية I يساوي " "I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "$ B<./a.out /tmp /home/user/temp>\n" "Press enter key to terminate.\n" "Listening for events.\n" "IN_OPEN: /home/user/temp/foo [file]\n" "IN_CLOSE_WRITE: /home/user/temp/foo [file]\n" "IN_OPEN: /tmp/ [directory]\n" "IN_CLOSE_NOWRITE: /tmp/ [directory]\n" "\\&\n" "Listening for events stopped.\n" msgstr "" "$ B<./a.out /tmp /home/user/temp>\n" "Press enter key to terminate.\n" "Listening for events.\n" "IN_OPEN: /home/user/temp/foo [file]\n" "IN_CLOSE_WRITE: /home/user/temp/foo [file]\n" "IN_OPEN: /tmp/ [directory]\n" "IN_CLOSE_NOWRITE: /tmp/ [directory]\n" "\\&\n" "Listening for events stopped.\n" #. type: Plain text #: debian-trixie #, no-wrap msgid "" "#include Eerrno.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/inotify.hE\n" "#include Eunistd.hE\n" "#include Estring.hE\n" "\\&\n" "/* Read all available inotify events from the file descriptor \\[aq]fd\\[aq].\n" " wd is the table of watch descriptors for the directories in argv.\n" " argc is the length of wd and argv.\n" " argv is the list of watched directories.\n" " Entry 0 of wd and argv is unused. */\n" "\\&\n" "static void\n" "handle_events(int fd, int *wd, int argc, char* argv[])\n" "{\n" " /* Some systems cannot read integer variables if they are not\n" " properly aligned. On other systems, incorrect alignment may\n" " decrease performance. Hence, the buffer used for reading from\n" " the inotify file descriptor should have the same alignment as\n" " struct inotify_event. */\n" "\\&\n" " char buf[4096]\n" " __attribute__ ((aligned(__alignof__(struct inotify_event))));\n" " const struct inotify_event *event;\n" " ssize_t len;\n" "\\&\n" " /* Loop while events can be read from inotify file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Read some events. */\n" "\\&\n" " len = read(fd, buf, sizeof(buf));\n" " if (len == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* If the nonblocking read() found no events to read, then\n" " it returns -1 with errno set to EAGAIN. In that case,\n" " we exit the loop. */\n" "\\&\n" " if (len E= 0)\n" " break;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " for (char *ptr = buf; ptr E buf + len;\n" " ptr += sizeof(struct inotify_event) + event-Elen) {\n" "\\&\n" " event = (const struct inotify_event *) ptr;\n" "\\&\n" " /* Print event type. */\n" "\\&\n" " if (event-Emask & IN_OPEN)\n" " printf(\"IN_OPEN: \");\n" " if (event-Emask & IN_CLOSE_NOWRITE)\n" " printf(\"IN_CLOSE_NOWRITE: \");\n" " if (event-Emask & IN_CLOSE_WRITE)\n" " printf(\"IN_CLOSE_WRITE: \");\n" "\\&\n" " /* Print the name of the watched directory. */\n" "\\&\n" " for (size_t i = 1; i E argc; ++i) {\n" " if (wd[i] == event-Ewd) {\n" " printf(\"%s/\", argv[i]);\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Print the name of the file. */\n" "\\&\n" " if (event-Elen)\n" " printf(\"%s\", event-Ename);\n" "\\&\n" " /* Print type of filesystem object. */\n" "\\&\n" " if (event-Emask & IN_ISDIR)\n" " printf(\" [directory]\\[rs]n\");\n" " else\n" " printf(\" [file]\\[rs]n\");\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char* argv[])\n" "{\n" " char buf;\n" " int fd, i, poll_num;\n" " int *wd;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " if (argc E 2) {\n" " printf(\"Usage: %s PATH [PATH ...]\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press ENTER key to terminate.\\[rs]n\");\n" "\\&\n" " /* Create the file descriptor for accessing the inotify API. */\n" "\\&\n" " fd = inotify_init1(IN_NONBLOCK);\n" " if (fd == -1) {\n" " perror(\"inotify_init1\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Allocate memory for watch descriptors. */\n" "\\&\n" " wd = calloc(argc, sizeof(int));\n" " if (wd == NULL) {\n" " perror(\"calloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark directories for events\n" " - file was opened\n" " - file was closed */\n" "\\&\n" " for (i = 1; i E argc; i++) {\n" " wd[i] = inotify_add_watch(fd, argv[i],\n" " IN_OPEN | IN_CLOSE);\n" " if (wd[i] == -1) {\n" " fprintf(stderr, \"Cannot watch \\[aq]%s\\[aq]: %s\\[rs]n\",\n" " argv[i], strerror(errno));\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " /* Prepare for polling. */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* Console input */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* Inotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* Wait for events and/or terminal input. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR)\n" " continue;\n" " perror(\"poll\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" "\\&\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* Console input is available. Empty stdin and quit. */\n" "\\&\n" " while (read(STDIN_FILENO, &buf, 1) E 0 && buf != \\[aq]\\[rs]n\\[aq])\n" " continue;\n" " break;\n" " }\n" "\\&\n" " if (fds[1].revents & POLLIN) {\n" "\\&\n" " /* Inotify events are available. */\n" "\\&\n" " handle_events(fd, wd, argc, argv);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" "\\&\n" " /* Close inotify file descriptor. */\n" "\\&\n" " close(fd);\n" "\\&\n" " free(wd);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#include Eerrno.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/inotify.hE\n" "#include Eunistd.hE\n" "#include Estring.hE\n" "\\&\n" "/* قراءة جميع أحداث inotify المتاحة من واصف الملف \\[aq]fd\\[aq].\n" " wd هو جدول واصفات المراقبة الخاصة بالدلائل الموجودة في argv.\n" " argc هو طول كل من wd و argv.\n" " argv هي قائمة الدلائل الخاضعة للمراقبة.\n" " البند رقم 0 في كل من wd و argv غير مستخدم. */\n" "\\&\n" "static void\n" "handle_events(int fd, int *wd, int argc, char* argv[])\n" "{\n" " /* لا تستطيع بعض الأنظمة قراءة المتغيرات الصحيحة إذا لم تكن\n" " محاذاة بشكل صحيح. وفي أنظمة أخرى، قد تؤدي المحاذاة غير الصحيحة\n" " إلى انخفاض الأداء. ولذلك، يجب أن يكون للمخزن المؤقت المستخدم للقراءة من\n" " واصف ملف inotify نفس محاذاة\n" " struct inotify_event. */\n" "\\&\n" " char buf[4096]\n" " __attribute__ ((aligned(__alignof__(struct inotify_event))));\n" " const struct inotify_event *event;\n" " ssize_t len;\n" "\\&\n" " /* Loop while events can be read from inotify file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Read some events. */\n" "\\&\n" " len = read(fd, buf, sizeof(buf));\n" " if (len == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* إذا لم تعثر دالة القراءة غير المعطلة (read()) على أي أحداث لقراءتها، فإنها\n" " تُرجع القيمة -1 مع تعيين errno إلى EAGAIN. وفي هذه الحالة،\n" " نخرج من الحلقة. */\n" "\\&\n" " if (len E= 0)\n" " break;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " for (char *ptr = buf; ptr E buf + len;\n" " ptr += sizeof(struct inotify_event) + event-Elen) {\n" "\\&\n" " event = (const struct inotify_event *) ptr;\n" "\\&\n" " /* Print event type. */\n" "\\&\n" " if (event-Emask & IN_OPEN)\n" " printf(\"IN_OPEN: \");\n" " if (event-Emask & IN_CLOSE_NOWRITE)\n" " printf(\"IN_CLOSE_NOWRITE: \");\n" " if (event-Emask & IN_CLOSE_WRITE)\n" " printf(\"IN_CLOSE_WRITE: \");\n" "\\&\n" " /* Print the name of the watched directory. */\n" "\\&\n" " for (size_t i = 1; i E argc; ++i) {\n" " if (wd[i] == event-Ewd) {\n" " printf(\"%s/\", argv[i]);\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Print the name of the file. */\n" "\\&\n" " if (event-Elen)\n" " printf(\"%s\", event-Ename);\n" "\\&\n" " /* Print type of filesystem object. */\n" "\\&\n" " if (event-Emask & IN_ISDIR)\n" " printf(\" [directory]\\[rs]n\");\n" " else\n" " printf(\" [file]\\[rs]n\");\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char* argv[])\n" "{\n" " char buf;\n" " int fd, i, poll_num;\n" " int *wd;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " if (argc E 2) {\n" " printf(\"Usage: %s PATH [PATH ...]\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press ENTER key to terminate.\\[rs]n\");\n" "\\&\n" " /* Create the file descriptor for accessing the inotify API. */\n" "\\&\n" " fd = inotify_init1(IN_NONBLOCK);\n" " if (fd == -1) {\n" " perror(\"inotify_init1\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Allocate memory for watch descriptors. */\n" "\\&\n" " wd = calloc(argc, sizeof(int));\n" " if (wd == NULL) {\n" " perror(\"calloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark directories for events\n" " - file was opened\n" " - file was closed */\n" "\\&\n" " for (i = 1; i E argc; i++) {\n" " wd[i] = inotify_add_watch(fd, argv[i],\n" " IN_OPEN | IN_CLOSE);\n" " if (wd[i] == -1) {\n" " fprintf(stderr, \"Cannot watch \\[aq]%s\\[aq]: %s\\[rs]n\",\n" " argv[i], strerror(errno));\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " /* Prepare for polling. */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* Console input */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* Inotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* Wait for events and/or terminal input. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR)\n" " continue;\n" " perror(\"poll\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" "\\&\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* Console input is available. Empty stdin and quit. */\n" "\\&\n" " while (read(STDIN_FILENO, &buf, 1) E 0 && buf != \\[aq]\\[rs]n\\[aq])\n" " continue;\n" " break;\n" " }\n" "\\&\n" " if (fds[1].revents & POLLIN) {\n" "\\&\n" " /* Inotify events are available. */\n" "\\&\n" " handle_events(fd, wd, argc, argv);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" "\\&\n" " /* Close inotify file descriptor. */\n" "\\&\n" " close(fd);\n" "\\&\n" " free(wd);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "I in the Linux kernel source tree" msgstr "I في شجرة مصدر نواة لينكس" #. 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 "" "#include Eerrno.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/inotify.hE\n" "#include Eunistd.hE\n" "#include Estring.hE\n" "\\&\n" "/* Read all available inotify events from the file descriptor \\[aq]fd\\[aq].\n" " wd is the table of watch descriptors for the directories in argv.\n" " argc is the size of wd and argv.\n" " argv is the list of watched directories.\n" " Entry 0 of wd and argv is unused. */\n" "\\&\n" "static void\n" "handle_events(int fd, int *wd, int argc, char* argv[])\n" "{\n" " /* Some systems cannot read integer variables if they are not\n" " properly aligned. On other systems, incorrect alignment may\n" " decrease performance. Hence, the buffer used for reading from\n" " the inotify file descriptor should have the same alignment as\n" " struct inotify_event. */\n" "\\&\n" " char buf[4096]\n" " __attribute__ ((aligned(__alignof__(struct inotify_event))));\n" " const struct inotify_event *event;\n" " ssize_t size;\n" "\\&\n" " /* Loop while events can be read from inotify file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Read some events. */\n" "\\&\n" " size = read(fd, buf, sizeof(buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* If the nonblocking read() found no events to read, then\n" " it returns -1 with errno set to EAGAIN. In that case,\n" " we exit the loop. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " for (char *ptr = buf; ptr E buf + size;\n" " ptr += sizeof(struct inotify_event) + event-Elen) {\n" "\\&\n" " event = (const struct inotify_event *) ptr;\n" "\\&\n" " /* Print event type. */\n" "\\&\n" " if (event-Emask & IN_OPEN)\n" " printf(\"IN_OPEN: \");\n" " if (event-Emask & IN_CLOSE_NOWRITE)\n" " printf(\"IN_CLOSE_NOWRITE: \");\n" " if (event-Emask & IN_CLOSE_WRITE)\n" " printf(\"IN_CLOSE_WRITE: \");\n" "\\&\n" " /* Print the name of the watched directory. */\n" "\\&\n" " for (size_t i = 1; i E argc; ++i) {\n" " if (wd[i] == event-Ewd) {\n" " printf(\"%s/\", argv[i]);\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Print the name of the file. */\n" "\\&\n" " if (event-Elen)\n" " printf(\"%s\", event-Ename);\n" "\\&\n" " /* Print type of filesystem object. */\n" "\\&\n" " if (event-Emask & IN_ISDIR)\n" " printf(\" [directory]\\[rs]n\");\n" " else\n" " printf(\" [file]\\[rs]n\");\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char* argv[])\n" "{\n" " char buf;\n" " int fd, i, poll_num;\n" " int *wd;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " if (argc E 2) {\n" " printf(\"Usage: %s PATH [PATH ...]\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press ENTER key to terminate.\\[rs]n\");\n" "\\&\n" " /* Create the file descriptor for accessing the inotify API. */\n" "\\&\n" " fd = inotify_init1(IN_NONBLOCK);\n" " if (fd == -1) {\n" " perror(\"inotify_init1\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Allocate memory for watch descriptors. */\n" "\\&\n" " wd = calloc(argc, sizeof(int));\n" " if (wd == NULL) {\n" " perror(\"calloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark directories for events\n" " - file was opened\n" " - file was closed */\n" "\\&\n" " for (i = 1; i E argc; i++) {\n" " wd[i] = inotify_add_watch(fd, argv[i],\n" " IN_OPEN | IN_CLOSE);\n" " if (wd[i] == -1) {\n" " fprintf(stderr, \"Cannot watch \\[aq]%s\\[aq]: %s\\[rs]n\",\n" " argv[i], strerror(errno));\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " /* Prepare for polling. */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* Console input */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* Inotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* Wait for events and/or terminal input. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR)\n" " continue;\n" " perror(\"poll\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" "\\&\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* Console input is available. Empty stdin and quit. */\n" "\\&\n" " while (read(STDIN_FILENO, &buf, 1) E 0 && buf != \\[aq]\\[rs]n\\[aq])\n" " continue;\n" " break;\n" " }\n" "\\&\n" " if (fds[1].revents & POLLIN) {\n" "\\&\n" " /* Inotify events are available. */\n" "\\&\n" " handle_events(fd, wd, argc, argv);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" "\\&\n" " /* Close inotify file descriptor. */\n" "\\&\n" " close(fd);\n" "\\&\n" " free(wd);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#include Eerrno.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/inotify.hE\n" "#include Eunistd.hE\n" "#include Estring.hE\n" "\\&\n" "/* Read all available inotify events from the file descriptor \\[aq]fd\\[aq].\n" " wd is the table of watch descriptors for the directories in argv.\n" " argc is the size of wd and argv.\n" " argv is the list of watched directories.\n" " Entry 0 of wd and argv is unused. */\n" "\\&\n" "static void\n" "handle_events(int fd, int *wd, int argc, char* argv[])\n" "{\n" " /* Some systems cannot read integer variables if they are not\n" " properly aligned. On other systems, incorrect alignment may\n" " decrease performance. Hence, the buffer used for reading from\n" " the inotify file descriptor should have the same alignment as\n" " struct inotify_event. */\n" "\\&\n" " char buf[4096]\n" " __attribute__ ((aligned(__alignof__(struct inotify_event))));\n" " const struct inotify_event *event;\n" " ssize_t size;\n" "\\&\n" " /* Loop while events can be read from inotify file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Read some events. */\n" "\\&\n" " size = read(fd, buf, sizeof(buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* If the nonblocking read() found no events to read, then\n" " it returns -1 with errno set to EAGAIN. In that case,\n" " we exit the loop. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " for (char *ptr = buf; ptr E buf + size;\n" " ptr += sizeof(struct inotify_event) + event-Elen) {\n" "\\&\n" " event = (const struct inotify_event *) ptr;\n" "\\&\n" " /* Print event type. */\n" "\\&\n" " if (event-Emask & IN_OPEN)\n" " printf(\"IN_OPEN: \");\n" " if (event-Emask & IN_CLOSE_NOWRITE)\n" " printf(\"IN_CLOSE_NOWRITE: \");\n" " if (event-Emask & IN_CLOSE_WRITE)\n" " printf(\"IN_CLOSE_WRITE: \");\n" "\\&\n" " /* Print the name of the watched directory. */\n" "\\&\n" " for (size_t i = 1; i E argc; ++i) {\n" " if (wd[i] == event-Ewd) {\n" " printf(\"%s/\", argv[i]);\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Print the name of the file. */\n" "\\&\n" " if (event-Elen)\n" " printf(\"%s\", event-Ename);\n" "\\&\n" " /* Print type of filesystem object. */\n" "\\&\n" " if (event-Emask & IN_ISDIR)\n" " printf(\" [directory]\\[rs]n\");\n" " else\n" " printf(\" [file]\\[rs]n\");\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char* argv[])\n" "{\n" " char buf;\n" " int fd, i, poll_num;\n" " int *wd;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " if (argc E 2) {\n" " printf(\"Usage: %s PATH [PATH ...]\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press ENTER key to terminate.\\[rs]n\");\n" "\\&\n" " /* Create the file descriptor for accessing the inotify API. */\n" "\\&\n" " fd = inotify_init1(IN_NONBLOCK);\n" " if (fd == -1) {\n" " perror(\"inotify_init1\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Allocate memory for watch descriptors. */\n" "\\&\n" " wd = calloc(argc, sizeof(int));\n" " if (wd == NULL) {\n" " perror(\"calloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark directories for events\n" " - file was opened\n" " - file was closed */\n" "\\&\n" " for (i = 1; i E argc; i++) {\n" " wd[i] = inotify_add_watch(fd, argv[i],\n" " IN_OPEN | IN_CLOSE);\n" " if (wd[i] == -1) {\n" " fprintf(stderr, \"Cannot watch \\[aq]%s\\[aq]: %s\\[rs]n\",\n" " argv[i], strerror(errno));\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " /* Prepare for polling. */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* Console input */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* Inotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* Wait for events and/or terminal input. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR)\n" " continue;\n" " perror(\"poll\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" "\\&\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* Console input is available. Empty stdin and quit. */\n" "\\&\n" " while (read(STDIN_FILENO, &buf, 1) E 0 && buf != \\[aq]\\[rs]n\\[aq])\n" " continue;\n" " break;\n" " }\n" "\\&\n" " if (fds[1].revents & POLLIN) {\n" "\\&\n" " /* Inotify events are available. */\n" "\\&\n" " handle_events(fd, wd, argc, argv);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" "\\&\n" " /* Close inotify file descriptor. */\n" "\\&\n" " close(fd);\n" "\\&\n" " free(wd);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: mageia-cauldron #, no-wrap msgid "2026-02-08" msgstr "8 فبراير 2026" #. type: TH #: mageia-cauldron #, no-wrap msgid "Linux man-pages 6.17" msgstr "صفحات دليل لينكس 6.17" #. type: Plain text #: mageia-cauldron #, no-wrap msgid "" "#include Eerrno.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/inotify.hE\n" "#include Eunistd.hE\n" "#include Estring.hE\n" "\\&\n" "/* Read all available inotify events from the file descriptor \\[aq]fd\\[aq].\n" " wd is the table of watch descriptors for the directories in argv.\n" " argc is the size of wd and argv.\n" " argv is the list of watched directories.\n" " Entry 0 of wd and argv is unused. */\n" "\\&\n" "static void\n" "handle_events(int fd, int *wd, int argc, char* argv[])\n" "{\n" " /* Some systems cannot read integer variables if they are not\n" " properly aligned. On other systems, incorrect alignment may\n" " decrease performance. Hence, the buffer used for reading from\n" " the inotify file descriptor should have the same alignment as\n" " struct inotify_event. */\n" "\\&\n" " char buf[4096]\n" " __attribute__ ((aligned(__alignof__(struct inotify_event))));\n" " const struct inotify_event *event;\n" " ssize_t size;\n" "\\&\n" " /* Loop while events can be read from inotify file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Read some events. */\n" "\\&\n" " size = read(fd, buf, sizeof(buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* If the nonblocking read() found no events to read, then\n" " it returns -1 with errno set to EAGAIN. In that case,\n" " we exit the loop. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " for (char *ptr = buf; ptr E buf + size;\n" " ptr += sizeof(struct inotify_event) + event-Elen) {\n" "\\&\n" " event = (const struct inotify_event *) ptr;\n" "\\&\n" " /* Print event type. */\n" "\\&\n" " if (event-Emask & IN_OPEN)\n" " printf(\"IN_OPEN: \");\n" " if (event-Emask & IN_CLOSE_NOWRITE)\n" " printf(\"IN_CLOSE_NOWRITE: \");\n" " if (event-Emask & IN_CLOSE_WRITE)\n" " printf(\"IN_CLOSE_WRITE: \");\n" "\\&\n" " /* Print the name of the watched directory. */\n" "\\&\n" " for (size_t i = 1; i E argc; ++i) {\n" " if (wd[i] == event-Ewd) {\n" " printf(\"%s/\", argv[i]);\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Print the name of the file. */\n" "\\&\n" " if (event-Elen)\n" " printf(\"%s\", event-Ename);\n" "\\&\n" " /* Print type of filesystem object. */\n" "\\&\n" " if (event-Emask & IN_ISDIR)\n" " printf(\" [directory]\\[rs]n\");\n" " else\n" " printf(\" [file]\\[rs]n\");\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char* argv[])\n" "{\n" " char buf;\n" " int fd, i, poll_num;\n" " int *wd;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " if (argc E 2) {\n" " printf(\"Usage: %s PATH [PATH ...]\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press ENTER key to terminate.\\[rs]n\");\n" "\\&\n" " /* Create the file descriptor for accessing the inotify API. */\n" "\\&\n" " fd = inotify_init1(IN_NONBLOCK);\n" " if (fd == -1) {\n" " perror(\"inotify_init1\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Allocate memory for watch descriptors. */\n" "\\&\n" " wd = calloc(argc, sizeof(int));\n" " if (wd == NULL) {\n" " perror(\"calloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark directories for events\n" " - file was opened\n" " - file was closed */\n" "\\&\n" " for (i = 1; i E argc; i++) {\n" " wd[i] = inotify_add_watch(fd, argv[i],\n" " IN_OPEN | IN_CLOSE);\n" " if (wd[i] == -1) {\n" " fprintf(stderr, \"Cannot watch \\[aq]%s\\[aq]: %s\\[rs]n\",\n" " argv[i], strerror(errno));\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " /* Prepare for polling. */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* Console input */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* Inotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* Wait for events and/or terminal input. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR)\n" " continue;\n" " perror(\"poll\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" "\\&\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* Console input is available. Empty stdin and quit. */\n" "\\&\n" " while (read(STDIN_FILENO, &buf, 1) E 0 && buf != \\[aq]\\[rs]n\\[aq])\n" " continue;\n" " break;\n" " }\n" "\\&\n" " if (fds[1].revents & POLLIN) {\n" "\\&\n" " /* Inotify events are available. */\n" "\\&\n" " handle_events(fd, wd, argc, argv);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" "\\&\n" " /* Close inotify file descriptor. */\n" "\\&\n" " close(fd);\n" "\\&\n" " free(wd);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#include Eerrno.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/inotify.hE\n" "#include Eunistd.hE\n" "#include Estring.hE\n" "\\&\n" "/* Read all available inotify events from the file descriptor \\[aq]fd\\[aq].\n" " wd is the table of watch descriptors for the directories in argv.\n" " argc is the size of wd and argv.\n" " argv is the list of watched directories.\n" " Entry 0 of wd and argv is unused. */\n" "\\&\n" "static void\n" "handle_events(int fd, int *wd, int argc, char* argv[])\n" "{\n" " /* Some systems cannot read integer variables if they are not\n" " properly aligned. On other systems, incorrect alignment may\n" " decrease performance. Hence, the buffer used for reading from\n" " the inotify file descriptor should have the same alignment as\n" " struct inotify_event. */\n" "\\&\n" " char buf[4096]\n" " __attribute__ ((aligned(__alignof__(struct inotify_event))));\n" " const struct inotify_event *event;\n" " ssize_t size;\n" "\\&\n" " /* Loop while events can be read from inotify file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Read some events. */\n" "\\&\n" " size = read(fd, buf, sizeof(buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* If the nonblocking read() found no events to read, then\n" " it returns -1 with errno set to EAGAIN. In that case,\n" " we exit the loop. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " for (char *ptr = buf; ptr E buf + size;\n" " ptr += sizeof(struct inotify_event) + event-Elen) {\n" "\\&\n" " event = (const struct inotify_event *) ptr;\n" "\\&\n" " /* Print event type. */\n" "\\&\n" " if (event-Emask & IN_OPEN)\n" " printf(\"IN_OPEN: \");\n" " if (event-Emask & IN_CLOSE_NOWRITE)\n" " printf(\"IN_CLOSE_NOWRITE: \");\n" " if (event-Emask & IN_CLOSE_WRITE)\n" " printf(\"IN_CLOSE_WRITE: \");\n" "\\&\n" " /* Print the name of the watched directory. */\n" "\\&\n" " for (size_t i = 1; i E argc; ++i) {\n" " if (wd[i] == event-Ewd) {\n" " printf(\"%s/\", argv[i]);\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Print the name of the file. */\n" "\\&\n" " if (event-Elen)\n" " printf(\"%s\", event-Ename);\n" "\\&\n" " /* Print type of filesystem object. */\n" "\\&\n" " if (event-Emask & IN_ISDIR)\n" " printf(\" [directory]\\[rs]n\");\n" " else\n" " printf(\" [file]\\[rs]n\");\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char* argv[])\n" "{\n" " char buf;\n" " int fd, i, poll_num;\n" " int *wd;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " if (argc E 2) {\n" " printf(\"Usage: %s PATH [PATH ...]\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press ENTER key to terminate.\\[rs]n\");\n" "\\&\n" " /* Create the file descriptor for accessing the inotify API. */\n" "\\&\n" " fd = inotify_init1(IN_NONBLOCK);\n" " if (fd == -1) {\n" " perror(\"inotify_init1\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Allocate memory for watch descriptors. */\n" "\\&\n" " wd = calloc(argc, sizeof(int));\n" " if (wd == NULL) {\n" " perror(\"calloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark directories for events\n" " - file was opened\n" " - file was closed */\n" "\\&\n" " for (i = 1; i E argc; i++) {\n" " wd[i] = inotify_add_watch(fd, argv[i],\n" " IN_OPEN | IN_CLOSE);\n" " if (wd[i] == -1) {\n" " fprintf(stderr, \"Cannot watch \\[aq]%s\\[aq]: %s\\[rs]n\",\n" " argv[i], strerror(errno));\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " /* Prepare for polling. */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* Console input */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* Inotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* Wait for events and/or terminal input. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR)\n" " continue;\n" " perror(\"poll\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" "\\&\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* Console input is available. Empty stdin and quit. */\n" "\\&\n" " while (read(STDIN_FILENO, &buf, 1) E 0 && buf != \\[aq]\\[rs]n\\[aq])\n" " continue;\n" " break;\n" " }\n" "\\&\n" " if (fds[1].revents & POLLIN) {\n" "\\&\n" " /* Inotify events are available. */\n" "\\&\n" " handle_events(fd, wd, argc, argv);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" "\\&\n" " /* Close inotify file descriptor. */\n" "\\&\n" " close(fd);\n" "\\&\n" " free(wd);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "صفحات دليل لينكس (لم تصدر بعد)"