# Arabic translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # زايد السعيدي , 2026. msgid "" msgstr "" "Project-Id-Version: manpages-l10n 4.30.1\n" "POT-Creation-Date: 2026-06-05 06:24+0200\n" "PO-Revision-Date: 2026-05-11 17:44+0400\n" "Last-Translator: Zayed Al-Saidi \n" "Language-Team: Arabic \n" "Language: ar\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " "&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" "X-Generator: Lokalize 23.08.5\n" #. type: TH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "fanotify" msgstr "fanotify" #. 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 "fanotify - monitoring filesystem events" msgstr "fanotify - مراقبة أحداث نظام الملفات" #. 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 fanotify API provides notification and interception of filesystem " "events. Use cases include virus scanning and hierarchical storage " "management. In the original fanotify API, only a limited set of events was " "supported. In particular, there was no support for create, delete, and move " "events. The support for those events was added in Linux 5.1. (See " "B(7) for details of an API that did notify those events pre Linux " "5.1.)" msgstr "" "توفر واجهة برمجة تطبيقات fanotify إشعارات واعتراضًا لأحداث نظام الملفات. تشمل " "حالات الاستخدام فحص الفيروسات وإدارة التخزين الهرمي. في واجهة fanotify " "الأصلية، دُعمت مجموعة محدودة فقط من الأحداث. على وجه الخصوص، لم يتوفر دعم " "لأحداث الإنشاء والحذف والنقل. أُضيف الدعم لهذه الأحداث في لينكس 5.1. (انظر " "B(7) لتفاصيل واجهة برمجة التطبيقات التي كانت تُشعر بتلك الأحداث قبل " "إصدار لينكس 5.1.)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Additional capabilities compared to the B(7) API include the " "ability to monitor all of the objects in a mounted filesystem, the ability " "to make access permission decisions, and the possibility to read or modify " "files before access by other applications." msgstr "" "تشمل القدرات الإضافية مقارنة بواجهة B(7) القدرة على مراقبة جميع " "الكائنات في نظام ملفات موصول، والقدرة على اتخاذ قرارات أذونات الوصول، " "وإمكانية قراءة الملفات أو تعديلها قبل وصول التطبيقات الأخرى إليها." #. 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: B(2), " "B(2), B(2), B(2), and B(2)." msgstr "" "تُستخدم استدعاءات النظام التالية مع هذه الواجهة: B(2)، و " "B(2)، و B(2)، و B(2)، و B(2)." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "fanotify_init(), fanotify_mark(), and notification groups" msgstr "fanotify_init()‎، و fanotify_mark()‎، ومجموعات الإشعارات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B(2) system call creates and initializes an fanotify " "notification group and returns a file descriptor referring to it." msgstr "" "يُنشئ استدعاء النظام B(2) مجموعة إشعارات fanotify ويُهيئها " "ويعيد واصف ملف يشير إليها." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "An fanotify notification group is a kernel-internal object that holds a list " "of files, directories, filesystems, and mounts for which events shall be " "created." msgstr "" "مجموعة إشعارات fanotify هي كائن داخلي في النواة يحمل قائمة بالملفات، " "والأدلة، وأنظمة الملفات، والوصولات التي يجب إنشاء أحداث لها." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For each entry in an fanotify notification group, two bit masks exist: the " "I mask and the I mask. The mark mask defines file activities " "for which an event shall be created. The ignore mask defines activities for " "which no event shall be generated. Having these two types of masks permits " "a filesystem, mount, or directory to be marked for receiving events, while " "at the same time ignoring events for specific objects under a mount or " "directory." msgstr "" "لكل مدخلة في مجموعة إشعارات fanotify، يوجد قناعان من البتات: قناع I " "وقناع I. يحدد قناع العلامة (mark) أنشطة الملفات التي يجب إنشاء حدث " "لها. ويحدد قناع التجاهل (ignore) الأنشطة التي لا يجب توليد أحداث لها. يسمح " "وجود هذين النوعين من الأقنعة بوسم نظام ملفات أو وصلة أو دليل لاستلام " "الأحداث، وفي الوقت نفسه تجاهل الأحداث لكائنات محددة تحت تلك الوصلة أو الدليل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B(2) system call adds a file, directory, filesystem, or " "mount to a notification group and specifies which events shall be reported " "(or ignored), or removes or modifies such an entry." msgstr "" "يضيف استدعاء النظام B(2) ملفًا أو دليلاً أو نظام ملفات أو وصلة " "إلى مجموعة إشعارات ويحدد الأحداث التي يجب الإبلاغ عنها (أو تجاهلها)، أو يزيل " "أو يعدل مثل هذه المدخلة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A possible usage of the ignore mask is for a file cache. Events of interest " "for a file cache are modification of a file and closing of the same. Hence, " "the cached directory or mount is to be marked to receive these events. " "After receiving the first event informing that a file has been modified, the " "corresponding cache entry will be invalidated. No further modification " "events for this file are of interest until the file is closed. Hence, the " "modify event can be added to the ignore mask. Upon receiving the close " "event, the modify event can be removed from the ignore mask and the file " "cache entry can be updated." msgstr "" "من الاستخدامات الممكنة لقناع التجاهل هي خبيئة الملفات. الأحداث المهمة لخبيئة " "الملفات هي تعديل الملف وإغلاقه. لذا، يوسم الدليل أو الوصلة المخبأة لاستلام " "هذه الأحداث. بعد استلام أول حدث يفيد بتعديل ملف ما، ستُبطل مدخلة الخبيئة " "المقابلة. لا تهم أي أحداث تعديل إضافية لهذا الملف حتى يُغلق. لذا، يمكن إضافة " "حدث التعديل إلى قناع التجاهل. وعند استلام حدث الإغلاق، يمكن إزالة حدث " "التعديل من قناع التجاهل وتحديث مدخلة خبيئة الملف." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The entries in the fanotify notification groups refer to files and " "directories via their inode number and to mounts via their mount ID. If " "files or directories are renamed or moved within the same mount, the " "respective entries survive. If files or directories are deleted or moved to " "another mount or if filesystems or mounts are unmounted, the corresponding " "entries are deleted." msgstr "" "تشير المدخلات في مجموعات إشعارات fanotify إلى الملفات والأدلة عبر رقم inode " "الخاص بها وإلى الوصلات عبر معرف الوصلة (mount ID). إذا أُعيدت تسمية الملفات " "أو الأدلة أو نُقلت ضمن نفس الوصلة، فإن المدخلات المعنية تبقى. أما إذا حُذفت " "الملفات أو الأدلة أو نُقلت إلى وصلة أخرى أو إذا فُصلت أنظمة الملفات أو " "الوصلات، فستُحذف المدخلات المقابلة." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "The event queue" msgstr "طابور الأحداث" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "As events occur on the filesystem objects monitored by a notification group, " "the fanotify system generates events that are collected in a queue. These " "events can then be read (using B(2) or similar) from the fanotify " "file descriptor returned by B(2)." msgstr "" "عند وقوع أحداث على كائنات نظام الملفات المراقبة بواسطة مجموعة إشعارات، يولد " "نظام fanotify أحداثًا تُجمع في طابور. يمكن بعد ذلك قراءة هذه الأحداث (باستخدام " "B(2) أو ما شابه) من واصف ملف fanotify الذي أعاده B(2)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Two types of events are generated: I events and I " "events. Notification events are merely informative and require no action to " "be taken by the receiving application with one exception: if a valid file " "descriptor is provided within a generic event, the file descriptor must be " "closed. Permission events are requests to the receiving application to " "decide whether permission for a file access shall be granted. For these " "events, the recipient must write a response which decides whether access is " "granted or not." msgstr "" "يولَّد نوعان من الأحداث: أحداث I<إشعار> وأحداث I<إذن>. أحداث الإشعار هي " "معلوماتية فقط ولا تتطلب اتخاذ أي إجراء من قبل التطبيق المستلم باستثناء حالة " "واحدة: إذا وُفر واصف ملف صالح ضمن حدث عام، فيجب إغلاق واصف الملف هذا. أحداث " "الإذن هي طلبات للتطبيق المستلم ليقرر ما إذا كان سيُمنح إذن للوصول إلى الملف " "أم لا. بالنسبة لهذه الأحداث، يجب على المستلم كتابة رد يقرر ما إذا كان سيُسمح " "بالوصول أم لا." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "An event is removed from the event queue of the fanotify group when it has " "been read. Permission events that have been read are kept in an internal " "list of the fanotify group until either a permission decision has been taken " "by writing to the fanotify file descriptor or the fanotify file descriptor " "is closed." msgstr "" "يُزال الحدث من طابور أحداث مجموعة fanotify عند قراءته. أحداث الإذن التي قُرئت " "تُحفظ في قائمة داخلية لمجموعة fanotify حتى يتم اتخاذ قرار بشأن الإذن عن طريق " "الكتابة إلى واصف ملف fanotify أو حتى يُغلق واصف ملف fanotify." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Reading fanotify events" msgstr "قراءة أحداث fanotify" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Calling B(2) for the file descriptor returned by B(2) " "blocks (if the flag B is not specified in the call to " "B(2)) until either a file event occurs or the call is " "interrupted by a signal (see B(7))." msgstr "" "استدعاء B(2) لواصف الملف الذي أعاده B(2) يحجب (إذا لم " "يُحدد علم B في استدعاء 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 "" "After a successful B(2), the read buffer contains one or more of the " "following structures:" msgstr "" "بعد نجاح B(2)، ستحتوي مخبأة القراءة على بنية واحدة أو أكثر من البنى " "التالية:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_event_metadata {\n" " __u32 event_len;\n" " __u8 vers;\n" " __u8 reserved;\n" " __u16 metadata_len;\n" " __aligned_u64 mask;\n" " __s32 fd;\n" " __s32 pid;\n" "};\n" msgstr "" "struct fanotify_event_metadata {\n" " __u32 event_len;\n" " __u8 vers;\n" " __u8 reserved;\n" " __u16 metadata_len;\n" " __aligned_u64 mask;\n" " __s32 fd;\n" " __s32 pid;\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Information records are supplemental pieces of information that may be " "provided alongside the generic I structure. The " "I passed to B(2) have influence over the type of " "information records that may be returned for an event. For example, if a " "notification group is initialized with B or " "B, then event listeners should also expect to receive a " "I structure alongside the " "I structure, whereby file handles are used to " "identify filesystem objects rather than file descriptors. Information " "records may also be stacked, meaning that using the various B " "flags in conjunction with one another is supported. In such cases, multiple " "information records can be returned for an event alongside the generic " "I structure. For example, if a notification group " "is initialized with B and B, then " "an event listener should expect to receive up to two " "I information records and one " "I information record alongside the generic " "I structure. Importantly, fanotify provides no " "guarantee around the ordering of information records when a notification " "group is initialized with a stacked based configuration. Each information " "record has a nested structure of type I. It is " "imperative for event listeners to inspect the I field of this " "structure in order to determine the type of information record that had been " "received for a given event." msgstr "" "سجلات المعلومات هي قطع تكميلية من المعلومات التي قد تُوفر جنباً إلى جنب مع " "بنية I العامة. تؤثر الـ I الممررة إلى " "B(2) على نوع سجلات المعلومات التي قد تُعاد لحدث ما. على سبيل " "المثال، إذا هُيئت مجموعة إشعارات باستخدام B أو " "B، فيجب على مستمعي الأحداث توقع استلام بنية " "I مع بنية I، حيث تُستخدم " "مقابض الملفات لتحديد كائنات نظام الملفات بدلاً من واصفات الملفات. يمكن أيضًا " "تكديم سجلات المعلومات، مما يعني أن استخدام أعلام B المتنوعة مع " "بعضها البعض أمر مدعوم. في هذه الحالات، يمكن إعادة سجلات معلومات متعددة لحدث " "ما. على سبيل المثال، إذا هُيئت مجموعة إشعارات باستخدام " "B و B، فيجب على مستمع الأحداث توقع " "استلام ما يصل إلى سجلي معلومات I وسجل معلومات " "I واحد. والأهم من ذلك، لا يوفر fanotify أي ضمانات " "حول ترتيب سجلات المعلومات عند تهيئة مجموعة إشعارات بتكوين مكدس. لكل سجل " "معلومات بنية متداخلة من نوع I. من الضروري " "لمستمعي الأحداث فحص حقل I في هذه البنية لتحديد نوع سجل المعلومات " "الذي استُلم لحدث معين." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In cases where an fanotify group identifies filesystem objects by file " "handles, event listeners should also expect to receive one or more of the " "below information record objects alongside the generic " "I structure within the read buffer:" msgstr "" "في الحالات التي تحدد فيها مجموعة fanotify كائنات نظام الملفات عن طريق مقابض " "الملفات، يجب على مستمعي الأحداث أيضًا توقع استلام واحد أو أكثر من كائنات سجل " "المعلومات أدناه مع بنية I العامة داخل مخبأة القراءة:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_event_info_fid {\n" " struct fanotify_event_info_header hdr;\n" " __kernel_fsid_t fsid;\n" " unsigned char handle[];\n" "};\n" msgstr "" "struct fanotify_event_info_fid {\n" " struct fanotify_event_info_header hdr;\n" " __kernel_fsid_t fsid;\n" " unsigned char handle[];\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In cases where an fanotify group is initialized with B, " "event listeners should expect to receive the below information record object " "alongside the generic I structure within the read " "buffer:" msgstr "" "في الحالات التي تُهيأ فيها مجموعة fanotify باستخدام B، يجب " "على مستمعي الأحداث توقع استلام كائن سجل المعلومات أدناه مع بنية " "I العامة داخل مخبأة القراءة:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_event_info_pidfd {\n" " struct fanotify_event_info_header hdr;\n" " __s32 pidfd;\n" "};\n" msgstr "" "struct fanotify_event_info_pidfd {\n" " struct fanotify_event_info_header hdr;\n" " __s32 pidfd;\n" "};\n" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "In cases where an fanotify group is initialized with B, " "event listeners should expect to receive the below information record object " "alongside the generic I structure within the read " "buffer. This structure is defined as follows:" msgstr "" "في الحالات التي تُهيأ فيها مجموعة fanotify باستخدام B، يجب " "على مستمعي الأحداث توقع استلام كائن سجل المعلومات أدناه مع بنية " "I العامة داخل مخبأة القراءة. تُعرف هذه البنية " "كالتالي:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_event_info_mnt {\n" " struct fanotify_event_info_header hdr;\n" " __u64 mnt_id;\n" "};\n" msgstr "" "struct fanotify_event_info_mnt {\n" " struct fanotify_event_info_header hdr;\n" " __u64 mnt_id;\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In case of a B event, an additional information record " "describing the error that occurred is returned alongside the generic " "I structure within the read buffer. This structure " "is defined as follows:" msgstr "" "في حالة حدث B، يُعاد سجل معلومات إضافي يصف الخطأ الذي حدث مع " "بنية I العامة داخل مخبأة القراءة. تُعرف هذه البنية " "كالتالي:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_event_info_error {\n" " struct fanotify_event_info_header hdr;\n" " __s32 error;\n" " __u32 error_count;\n" "};\n" msgstr "" "struct fanotify_event_info_error {\n" " struct fanotify_event_info_header hdr;\n" " __s32 error;\n" " __u32 error_count;\n" "};\n" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "In case of B events, an additional information record " "describing the access range is returned alongside the generic " "I structure within the read buffer. This structure " "is defined as follows:" msgstr "" "في حالة أحداث B، يُعاد سجل معلومات إضافي يصف نطاق الوصول مع " "بنية I العامة داخل مخبأة القراءة. تُعرف هذه البنية " "كالتالي:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_event_info_range {\n" " struct fanotify_event_info_header hdr;\n" " __u32 pad;\n" " __u64 offset;\n" " __u64 count;\n" "};\n" msgstr "" "struct fanotify_event_info_range {\n" " struct fanotify_event_info_header hdr;\n" " __u32 pad;\n" " __u64 offset;\n" " __u64 count;\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "All information records contain a nested structure of type " "I. This structure holds meta-information about " "the information record that may have been returned alongside the generic " "I structure. This structure is defined as follows:" msgstr "" "تحتوي جميع سجلات المعلومات على بنية متداخلة من نوع " "I. تحمل هذه البنية معلومات وصفية حول سجل " "المعلومات الذي قد يكون قد أعيد مع بنية I العامة. " "تُعرف هذه البنية كالتالي:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_event_info_header {\n" "\t__u8 info_type;\n" "\t__u8 pad;\n" "\t__u16 len;\n" "};\n" msgstr "" "struct fanotify_event_info_header {\n" "\t__u8 info_type;\n" "\t__u8 pad;\n" "\t__u16 len;\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For performance reasons, it is recommended to use a large buffer size (for " "example, 4096 bytes), so that multiple events can be retrieved by a single " "B(2)." msgstr "" "لأسباب تتعلق بالأداء، يوصى باستخدام حجم مخبأة كبير (على سبيل المثال، 4096 " "بايت)، بحيث يمكن جلب أحداث متعددة من خلال استدعاء B(2) واحد." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The return value of B(2) is the number of bytes placed in the buffer, " "or -1 in case of an error (but see BUGS)." msgstr "" "قيمة الإرجاع لـ B(2) هي عدد البايتات التي وُضعت في المخبأة، أو -1 في " "حالة حدوث خطأ (لكن انظر قسم BUGS)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The fields of the I structure are as follows:" msgstr "حقول بنية I هي كما يلي:" #. 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-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This is the size of the data for the current event and the offset to the " "next event in the buffer. Unless the group identifies filesystem objects by " "file handles, the value of I is always " "B. For a group that identifies filesystem objects " "by file handles, I also includes the variable size file " "identifier records." 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 "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 field holds a version number for the structure. It must be compared to " "B to verify that the structures returned at run " "time match the structures defined at compile time. In case of a mismatch, " "the application should abandon trying to use the fanotify file descriptor." msgstr "" "يحمل هذا الحقل رقم إصدار البنية. يجب مقارنته بـ B " "للتحقق من أن البنى التي أُعيدت في وقت التشغيل تطابق البنى المحددة في وقت " "التصريف. في حالة عدم التطابق، يجب على التطبيق التخلي عن محاولة استخدام واصف " "ملف fanotify." #. 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 field is not used." msgstr "هذا الحقل غير مستخدم." #. 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-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This is the size of the structure. The field was introduced to facilitate " "the implementation of optional headers per event type. No such optional " "headers exist in the current implementation." msgstr "" "هذا هو حجم البنية. قُدم هذا الحقل لتسهيل تنفيذ ترويسات اختيارية لكل نوع حدث. " "لا توجد مثل هذه الترويسات الاختيارية في التنفيذ الحالي." #. 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 is a bit mask describing the event (see below)." msgstr "هذا قناع بتات يصف الحدث (انظر أدناه)." #. 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 is an open file descriptor for the object being accessed, or " "B if a queue overflow occurred. With an fanotify group that " "identifies filesystem objects by file handles, applications should expect " "this value to be set to B for each event that is received. The " "file descriptor can be used to access the contents of the monitored file or " "directory. The reading application is responsible for closing this file " "descriptor." msgstr "" "هذا واصف ملف مفتوح للكائن الذي يتم الوصول إليه، أو B في حالة حدوث " "طوفان في الطابور. مع مجموعة fanotify التي تحدد كائنات نظام الملفات عن طريق " "مقابض الملفات، يجب أن تتوقع التطبيقات ضبط هذه القيمة على B لكل حدث " "يُستلم. يمكن استخدام واصف الملف للوصول إلى محتويات الملف أو الدليل المراقب. " "التطبيق القارئ مسؤول عن إغلاق واصف الملف هذا." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When calling B(2), the caller may specify (via the " "I argument) various file status flags that are to be set on " "the open file description that corresponds to this file descriptor. In " "addition, the (kernel-internal) B file status flag is set " "on the open file description. This flag suppresses fanotify event " "generation. Hence, when the receiver of the fanotify event accesses the " "notified file or directory using this file descriptor, no additional events " "will be created." msgstr "" "عند استدعاء B(2)، قد يحدد المستدعِي (عبر وسيط " "I) أعلام حالة ملف متنوعة ليتم ضبطها على وصف الملف المفتوح " "الذي يقابل واصف الملف هذا. بالإضافة إلى ذلك، يُضبط علم حالة الملف " "B (الداخلي للنواة) على وصف الملف المفتوح. هذا العلم يكبح " "توليد أحداث fanotify. ومن ثم، عندما يصل مستلم حدث fanotify إلى الملف أو " "الدليل المُشعر به باستخدام واصف الملف هذا، لن تُنشأ أي أحداث إضافية." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "When an fanotify group is initialized using B, this " "field will contain a negative error value in case a file descriptor could " "not be opened and in case of a queue overflow, the value will be B<-EBADF>." msgstr "" "عند تهيئة مجموعة fanotify باستخدام B، سيحتوي هذا الحقل " "على قيمة خطأ سالبة في حالة تعذر فتح واصف ملف، وفي حالة طوفان الطابور، ستكون " "القيمة B<-EBADF>." #. 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 "" "If flag B was set in B(2), this is the TID of " "the thread that caused the event. Otherwise, this the PID of the process " "that caused the event." msgstr "" "إذا ضُبط العلم B في B(2)، فهذا هو معرف الخيط " "(TID) للخيط الذي تسبب في الحدث. وإلا، فهذا هو معرف العملية (PID) للعملية " "التي تسببت في الحدث." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A program listening to fanotify events can compare this PID to the PID " "returned by B(2), to determine whether the event is caused by the " "listener itself, or is due to a file access by another process." msgstr "" "يمكن لبرنامج يستمع إلى أحداث fanotify مقارنة معرف العملية (PID) هذا بالمعرف " "الذي يعيده B(2)، لتحديد ما إذا كان الحدث ناتجاً عن المستمع نفسه، أو " "بسبب وصول لملف من قبل عملية أخرى." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The bit mask in I indicates which events have occurred for a single " "filesystem object. Multiple bits may be set in this mask, if more than one " "event occurred for the monitored filesystem object. In particular, " "consecutive events for the same filesystem object and originating from the " "same process may be merged into a single event, with the exception that two " "permission events are never merged into one queue entry." msgstr "" "يشير قناع البتات في I إلى الأحداث التي وقعت لكائن نظام ملفات واحد. قد " "تُضبط بتات متعددة في هذا القناع إذا وقع أكثر من حدث لكائن نظام الملفات " "المراقب. على وجه الخصوص، قد تُدمج الأحداث المتتالية لنفس كائن نظام الملفات " "والناتجة عن نفس العملية في حدث واحد، باستثناء أحداث الإذن حيث لا تُدمج أبداً " "في مدخلة طابور واحدة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The bits that may appear in I are as follows:" msgstr "البتات التي قد تظهر في I هي كما يلي:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "A file or a directory (but see BUGS) was accessed (read)." msgstr "وُصل إلى ملف أو دليل (قراءة) (لكن انظر قسم 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 "A file or a directory was opened." msgstr "فُتح ملف أو دليل." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A file was opened with the intent to be executed. See NOTES in " "B(2) for additional details." msgstr "" "فُتح ملف بقصد تنفيذه. انظر قسم NOTES في 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 "A file or directory metadata was changed." msgstr "غُيرت البيانات الوصفية لملف أو دليل." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "A child file or directory was created in a watched parent." msgstr "أُنشئ ملف أو دليل ابن في دليل أب مراقب." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "A child file or directory was deleted in a watched parent." msgstr "حُذف ملف أو دليل ابن في دليل أب مراقب." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "A watched file or directory was deleted." msgstr "حُذف ملف أو دليل مراقب." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A file or directory has been moved to or from a watched parent 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 "A file or directory has been moved from a watched parent 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 "A file or directory has been moved to a watched parent 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 "A watched file or directory was 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 "A file was modified." msgstr "عُدل ملف." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A file that was opened for writing (B or B) was closed." msgstr "أُغلق ملف كان مفتوحاً للكتابة (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 "" "A file or directory that was opened read-only (B) was closed." msgstr "أُغلق ملف أو دليل كان مفتوحاً للقراءة فقط (B)." #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "A mount was attached to mount namespace." msgstr "وُصلت وصلة بمساحة أسماء الوصل." #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "A mount was detached from mount namespace." msgstr "فُصلت وصلة من مساحة أسماء الوصل." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "A filesystem error was detected." msgstr "كُشف عن خطأ في نظام الملفات." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The event queue exceeded the limit on number of events. This limit can be " "overridden by specifying the B flag when calling " "B(2)." msgstr "" "تجاوز طابور الأحداث الحد المسموح به لعدد الأحداث. يمكن تخطي هذا الحد عن طريق " "تحديد علم B عند استدعاء 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 "" "An application wants to read a file or directory, for example using " "B(2) or B(2). The reader must write a response (as " "described below) that determines whether the permission to access the " "filesystem object shall be granted." 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 "" "An application wants to open a file or directory. The reader must write a " "response that determines whether the permission to open the filesystem " "object shall be granted." 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 "" "An application wants to open a file for execution. The reader must write a " "response that determines whether the permission to open the filesystem " "object for execution shall be granted. See NOTES in B(2) " "for additional details." msgstr "" "يريد تطبيق ما فتح ملف للتنفيذ. يجب على القارئ كتابة استجابة تحدد ما إذا كان " "سيُمنح إذن فتح كائن نظام الملفات للتنفيذ. راجع الملاحظات (NOTES) في " "B(2) لمزيد من التفاصيل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "To check for any close event, the following bit mask may be used:" msgstr "للتحقق من أي حدث إغلاق، يمكن استخدام قناع البتات التالي:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "A file was closed. This is a synonym for:" msgstr "أُغلق ملف. هذا مرادف لـ:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE\n" msgstr "FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "To check for any move event, the following bit mask may be used:" msgstr "للتحقق من أي حدث نقل، يمكن استخدام قناع البتات التالي:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "A file or directory was moved. This is a synonym for:" msgstr "نُقل ملف أو دليل. هذا مرادف لـ:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "FAN_MOVED_FROM | FAN_MOVED_TO\n" msgstr "FAN_MOVED_FROM | FAN_MOVED_TO\n" #. 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 appear in I only in conjunction with other " "event type bits:" msgstr "" "قد تظهر البتات التالية في I فقط بالاقتران مع بتات أنواع أحداث أخرى:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The events described in the I have occurred on a directory object. " "Reporting events on directories requires setting this flag in the mark " "mask. See B(2) for additional details. The B " "flag is reported in an event mask only if the fanotify group identifies " "filesystem objects by file handles." msgstr "" "الأحداث الموضحة في I وقعت على كائن دليل. يتطلب الإبلاغ عن الأحداث في " "الأدلة ضبط هذه الراية في قناع العلامة. راجع B(2) لمزيد من " "التفاصيل. يُبلغ عن الراية B في قناع الحدث فقط إذا كانت مجموعة " "fanotify تحدد كائنات نظام الملفات عن طريق مقابض الملفات." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Information records that are supplied alongside the generic " "I structure will always contain a nested structure " "of type I. The fields of the " "I are as follows:" 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 "I" msgstr "I" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "A unique integer value representing the type of information record object " "received for an event. The value of this field can be set to one of the " "following." msgstr "" "قيمة عددية فريدة تمثل نوع كائن سجل المعلومات المُستلم لحدث ما. يمكن ضبط قيمة " "هذا الحقل على أحد الخيارات التالية." #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "The value set for this field is dependent on the flags that have been " "supplied to B(2). Refer to the field details of each " "information record object type below to understand the different cases in " "which the I values can be set." msgstr "" "تعتمد القيمة المضبوطة لهذا الحقل على الرايات التي تم تزويدها لـ " "B(2). ارجع إلى تفاصيل الحقول لكل نوع كائن سجل معلومات أدناه " "لفهم الحالات المختلفة التي يمكن فيها ضبط قيم I." #. 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 field is currently not used by any information record object type and " "therefore is set to zero." msgstr "" "هذا الحقل غير مُستخدم حالياً من قبل أي نوع كائن سجل معلومات، ولذلك يُضبط على " "الصفر." #. 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 of I is set to the size of the information record object, " "including the I. The total size of all " "additional information records is not expected to be larger than " "(I - 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 fields of the I structure are as follows:" msgstr "حقول هيكل I هي كما يلي:" #. 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 is a structure of type I. For example, " "when an fanotify file descriptor is created using B, a " "single information record is expected to be attached to the event with " "I field value of B. When an fanotify " "file descriptor is created using the combination of B and " "B, there may be two information records attached to the " "event: one with I field value of B, " "identifying a parent directory object, and one with I field value " "of B, identifying a child object. Note that for " "the directory entry modification events B, B, " "B, and B, an information record identifying the " "created/deleted/moved child object is reported only if an fanotify group was " "initialized with the flag B." msgstr "" "هذا هيكل من نوع I. على سبيل المثال، عندما يُنشأ " "واصف ملف fanotify باستخدام B، يُتوقع إرفاق سجل معلومات واحد " "بالحدث مع قيمة حقل I هي B. عندما يُنشأ " "واصف ملف fanotify باستخدام مزيج من B و " "B، قد يكون هناك سجلان للمعلومات مرفقان بالحدث: أحدهما " "بقيمة حقل I هي B، للتعريف بكائن دليل " "أب، والآخر بقيمة حقل I هي B، للتعريف " "بكائن ابن. لاحظ أنه بالنسبة لأحداث تعديل مدخلات الدليل B و " "B و B و B، لا يُبلغ عن سجل معلومات يحدد " "الكائن الابن المنشأ/المحذوف/المنقول إلا إذا بُدئت مجموعة fanotify باستخدام " "الراية 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-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This is a unique identifier of the filesystem containing the object " "associated with the event. It is a structure of type I<__kernel_fsid_t> and " "contains the same value as I when calling B(2). Note that " "some filesystems (e.g., B(4)) report zero I. In these cases, " "it is not possible to use I to associate the event with a specific " "filesystem instance, so monitoring different filesystem instances that " "report zero I with the same fanotify group is not supported." msgstr "" "هذا معرف فريد لنظام الملفات الذي يحتوي على الكائن المرتبط بالحدث. هو هيكل من " "نوع I<__kernel_fsid_t> ويحتوي على نفس قيمة I عند استدعاء " "B(2). لاحظ أن بعض أنظمة الملفات (مثل B(4)) تبلغ عن I " "بصفر. في هذه الحالات، لا يمكن استخدام I لربط الحدث بمثيل معين لنظام " "الملفات، لذا فإن مراقبة مثيلات أنظمة ملفات مختلفة تبلغ عن I بصفر " "باستخدام نفس مجموعة fanotify غير مدعومة." #. 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-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This field contains a variable-size structure of type I. It is an opaque handle that corresponds to a specified object " "on a filesystem as returned by B(2). It can be used to " "uniquely identify a file on a filesystem and can be passed as an argument to " "B(2). If the value of I field is " "B, the file handle is followed by a null " "terminated string that identifies the created/deleted/moved directory entry " "name. For other events such as B, B, " "B, and B, if the value of I field " "is B, the I identifies the object " "correlated to the event. If the value of I field is " "B, the I identifies the directory object " "correlated to the event or the parent directory of a non-directory object " "correlated to the event. If the value of I field is " "B, the I identifies the same " "directory object that would be reported with B and " "the file handle is followed by a null terminated string that identifies the " "name of a directory entry in that directory, or '.' to identify the " "directory object itself." msgstr "" "يحتوي هذا الحقل على هيكل متغير الحجم من نوع I. هو مقبض " "مبهم يتوافق مع كائن محدد في نظام ملفات كما يعيده B(2). " "يمكن استخدامه لتعريف ملف بشكل فريد في نظام ملفات ويمكن تمريره كمعامل لـ " "B(2). إذا كانت قيمة حقل I هي " "B، يتبع مقبض الملف سلسلة نصية منتهية بصفر " "تحدد اسم مدخل الدليل المنشأ/المحذوف/المنقول. بالنسبة للأحداث الأخرى مثل " "B و B و B و B، إذا " "كانت قيمة حقل I هي B، فإن I يحدد " "الكائن المرتبط بالحدث. إذا كانت قيمة حقل I هي " "B، فإن I يحدد كائن الدليل المرتبط بالحدث " "أو الدليل الأب لكائن ليس دليلاً ومرتبط بالحدث. إذا كانت قيمة حقل I " "هي B، فإن I يحدد نفس كائن الدليل الذي " "سيُبلغ عنه باستخدام B، ويتبع مقبض الملف سلسلة نصية " "منتهية بصفر تحدد اسم مدخل الدليل في ذلك الدليل، أو '.' لتعريف كائن الدليل " "نفسه." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The fields of the I structure are as follows:" msgstr "حقول هيكل I هي كما يلي:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This is a structure of type I. When an fanotify " "group is initialized using B, the I field value " "of the I is set to B." msgstr "" "هذا هيكل من نوع I. عندما تُبدأ مجموعة fanotify " "باستخدام B، تُضبط قيمة حقل I في " "I على B." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "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 is a process file descriptor that refers to the process responsible for " "generating the event. The returned process file descriptor is no different " "from one which could be obtained manually if B(2) were to be " "called on I. In the instance that an error is " "encountered during pidfd creation, one of two possible error types " "represented by a negative integer value may be returned in this I " "field. In cases where the process responsible for generating the event has " "terminated prior to the event listener being able to read events from the " "notification queue, B is returned. The pidfd creation for an " "event is only performed at the time the events are read from the " "notification queue. All other possible pidfd creation failures are " "represented by B. Once the event listener has dealt with an " "event and the pidfd is no longer required, the pidfd should be closed via " "B(2)." msgstr "" "هذا واصف ملف عملية يشير إلى العملية المسؤولة عن توليد الحدث. واصف ملف " "العملية المُعاد لا يختلف عن ذلك الذي يمكن الحصول عليه يدوياً إذا استدعي " "B(2) على I. في حالة مواجهة خطأ " "أثناء إنشاء pidfd، قد يُعاد أحد نوعي أخطاء محتملين ممثلين بقيمة صحيحة سالبة " "في حقل I هذا. في الحالات التي تنتهي فيها العملية المسؤولة عن توليد " "الحدث قبل أن يتمكن مستمع الأحداث من قراءة الأحداث من طابور الإشعارات، يُعاد " "B. يُنفذ إنشاء pidfd للحدث فقط في وقت قراءة الأحداث من طابور " "الإشعارات. تُمثل جميع إخفاقات إنشاء pidfd المحتملة الأخرى بـ B. " "بمجرد أن يتعامل مستمع الحدث مع الحدث ولم يعد الـ pidfd مطلوباً، يجب إغلاق الـ " "pidfd عبر B(2)." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "When an fanotify group is initialized using B, this " "field will contain a negative error value in case a pidfd creation failure " "and in case of a terminated process, the value will be B<-ESRCH>." msgstr "" "عند بدء مجموعة fanotify باستخدام B، سيحتوي هذا الحقل " "على قيمة خطأ سالبة في حالة فشل إنشاء pidfd وفي حالة العملية المنتهية، ستكون " "القيمة B<-ESRCH>." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "The fields of the I structure are as follows:" msgstr "حقول هيكل I هي كما يلي:" #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "I<.hdr>" msgstr "I<.hdr>" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "This is a structure of type I. The I<." "info_type> field is set to B." msgstr "" "هذا هيكل من نوع I. يُضبط حقل I<.info_type> على " "B." #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "I<.mnt_id>" msgstr "I<.mnt_id>" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Identifies the mount associated with the event. It is a 64-bit unique mount " "id as the one returned by B(2) with the B flag." msgstr "" "يحدد الوصل المرتبط بالحدث. هو معرف وصل فريد 64-بت كالذي يعيده B(2) مع " "الراية B." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The fields of the I structure are as follows:" msgstr "حقول هيكل I هي كما يلي:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This is a structure of type I. The I " "field is set to B." msgstr "" "هذا هيكل من نوع I. يُضبط حقل I على " "B." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Identifies the type of error that occurred." msgstr "يحدد نوع الخطأ الذي حدث." #. 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 is a counter of the number of errors suppressed since the last error " "was read." msgstr "هذا عداد لعدد الأخطاء التي كُتمت منذ آخر قراءة للخطأ." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "The fields of the I structure are as follows:" msgstr "حقول هيكل I هي كما يلي:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "This is a structure of type I. The I " "field is set to B." msgstr "" "هذا هيكل من نوع I. يُضبط حقل I على " "B." #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "The number of bytes being read or written to the file." msgstr "عدد البايتات التي تُقرأ أو تُكتب في الملف." #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "The offset from which bytes are read or written to the file." msgstr "الإزاحة التي تُقرأ منها أو تُكتب فيها البايتات في الملف." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The following macros are provided to iterate over a buffer containing " "fanotify event metadata returned by a B(2) from an fanotify file " "descriptor:" msgstr "" "تتوفر وحدات الماكرو التالية للتكرار عبر مخزن يحتوي على بيانات وصفية لأحداث " "fanotify أعادها B(2) من واصف ملف fanotify:" #. type: TP #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This macro checks the remaining size I of the buffer I against " "the size of the metadata structure and the I field of the first " "metadata structure in the buffer." msgstr "" "يتحقق هذا الماكرو من الحجم المتبقي I للمخزن I مقابل حجم هيكل " "البيانات الوصفية وحقل I لأول هيكل بيانات وصفية في المخزن." #. type: TP #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This macro uses the size indicated in the I field of the metadata " "structure pointed to by I to calculate the address of the next " "metadata structure that follows I. I is the number of bytes of " "metadata that currently remain in the buffer. The macro returns a pointer " "to the next metadata structure that follows I, and reduces I by " "the number of bytes in the metadata structure that has been skipped over (i." "e., it subtracts Ievent_len> from I)." msgstr "" "يستخدم هذا الماكرو الحجم المشار إليه في حقل I لهيكل البيانات " "الوصفية الذي يشير إليه I لحساب عنوان هيكل البيانات الوصفية التالي الذي " "يلي I. يمثل I عدد بايتات البيانات الوصفية المتبقية حالياً في " "المخزن. يعيد الماكرو مؤشراً إلى هيكل البيانات الوصفية التالي الذي يلي " "I، ويقلل I بمقدار عدد البايتات في هيكل البيانات الوصفية الذي " "تُخطي (أي يطرح Ievent_len> من I)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "In addition, there is:" 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 "" "This macro returns the size (in bytes) of the structure " "I. This is the minimum size (and currently the " "only size) of any event metadata." msgstr "" "يعيد هذا الماكرو حجم (بالبايتات) الهيكل I. هذا هو " "الحد الأدنى للحجم (والحجم الوحيد حالياً) لأي بيانات وصفية للحدث." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Monitoring an fanotify file descriptor for events" msgstr "مراقبة واصف ملف fanotify بحثاً عن أحداث" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When an fanotify event occurs, the fanotify file descriptor indicates as " "readable when passed to B(7), B(2), or B(2)." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Dealing with permission events" msgstr "التعامل مع أحداث الأذونات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For permission events, the application must B(2) a structure of the " "following form to the fanotify file descriptor:" msgstr "" "بالنسبة لأحداث الأذونات، يجب على التطبيق استدعاء B(2) لهيكل بالشكل " "التالي في واصف ملف fanotify:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_response {\n" " __s32 fd;\n" " __u32 response;\n" "};\n" msgstr "" "struct fanotify_response {\n" " __s32 fd;\n" " __u32 response;\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The fields of this structure are as follows:" msgstr "حقول هذا الهيكل هي كالتالي:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This is the file descriptor from the structure I." msgstr "هذا هو واصف الملف من الهيكل I." #. 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-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "This field indicates whether or not the permission is to be granted. Its " "value must contain either the flag B to allow the file operation " "or B to deny the file operation." msgstr "" "يشير هذا الحقل إلى ما إذا كان سيُمنح الإذن أم لا. يجب أن تحتوي قيمته إما على " "الراية B للسماح بعملية الملف أو B لرفضها." #. commit b4b2ff4f61ded819bfa22e50fdec7693f51cbbee #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "If access is denied, the requesting application call will receive an " "B error. Since Linux 6.13, if a notification group is initialized " "with class B, the file operation can be denied with " "errors other than B. For example, for the requesting application to " "get the B error, the event listener can write the response " "B(B). At the time of writing, only the following error " "values could be returned to the application with " "B(\\f[I]e\\fR) macro: B, B, B, " "B, B, B, B." msgstr "" "إذا رُفض الوصول، سيتلقى استدعاء التطبيق الطالب خطأ B. منذ لينكس 6.13، " "إذا بُدئت مجموعة إشعارات بالفئة B، يمكن رفض عملية " "الملف بأخطاء غير B. على سبيل المثال، لكي يحصل التطبيق الطالب على خطأ " "B، يمكن لمستمع الحدث كتابة الاستجابة B(B). في وقت " "الكتابة، يمكن إعادة قيم الأخطاء التالية فقط إلى التطبيق باستخدام ماكرو " "B(\\f[I]e\\fR): B و B و B و B و " "B و B و B." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Additionally, if the notification group has been created with the " "B flag, then the B flag can be set in the " "I field. In that case, the audit subsystem will log information " "about the access decision to the audit logs." msgstr "" "بالإضافة إلى ذلك، إذا أُنشئت مجموعة الإشعارات مع الراية B، " "فيمكن حينئذٍ ضبط الراية B في حقل I. في هذه الحالة، سيقوم " "نظام التدقيق الفرعي بتسجيل معلومات حول قرار الوصول في سجلات التدقيق." #. commit 70529a199574c15a40f46b14256633b02ba10ca2 #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Since Linux 6.3, the B flag can be set in the I<.response> field. " "It indicates that an extra variable-length response record follows the " "I structure. Extra response records start with a common " "header:" msgstr "" "منذ لينكس 6.3، يمكن ضبط الراية B في حقل I<.response>. تشير هذه " "الراية إلى أن سجل استجابة إضافي متغير الطول يتبع هيكل I. " "تبدأ سجلات الاستجابة الإضافية بترويسة مشتركة:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_response_info_header {\n" " __u8 type;\n" " __u8 pad;\n" " __u16 len;\n" "};\n" msgstr "" "struct fanotify_response_info_header {\n" " __u8 type;\n" " __u8 pad;\n" " __u16 len;\n" "};\n" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "The value of I<.type> determines the format of the extra response record." msgstr "تحدد قيمة I<.type> تنسيق سجل الاستجابة الإضافي." #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "The following response record is expected with extra details for the audit " "log:" msgstr "يُتوقع سجل الاستجابة التالي مع تفاصيل إضافية لسجل التدقيق:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "struct fanotify_response_info_audit_rule {\n" " struct fanotify_response_info_header hdr;\n" " __u32 rule_number;\n" " __u32 subj_trust;\n" " __u32 obj_trust;\n" "};\n" msgstr "" "struct fanotify_response_info_audit_rule {\n" " struct fanotify_response_info_header hdr;\n" " __u32 rule_number;\n" " __u32 subj_trust;\n" " __u32 obj_trust;\n" "};\n" #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Monitoring filesystems for errors" msgstr "مراقبة أنظمة الملفات بحثاً عن أخطاء" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A single B event is stored per filesystem at once. Extra " "error messages are suppressed and accounted for in the I field " "of the existing B event record, but details about the errors " "are lost." msgstr "" "يُخزن حدث B واحد لكل نظام ملفات في المرة الواحدة. تُكتم رسائل " "الأخطاء الإضافية وتُحسب في حقل I لسجل حدث B " "الموجود، ولكن تُفقد تفاصيل تلك الأخطاء." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Errors reported by B are generic I values, but not all " "kinds of error types are reported by all filesystems." msgstr "" "الأخطاء التي يبلغ عنها B هي قيم I عامة، ولكن لا يُبلغ عن " "جميع أنواع الأخطاء من قبل جميع أنظمة الملفات." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Errors not directly related to a file (i.e., super block corruption) are " "reported with an invalid I. For these errors, the I will " "have the field I set to B, and the handle " "buffer size set to B<0>." msgstr "" "الأخطاء غير المرتبطة مباشرة بملف (أي تلف الكتلة الفائقة) يُبلغ عنها بـ " "I غير صالح. لهذه الأخطاء، سيُضبط حقل I في I على " "B، ويُضبط حجم مخزن المقبض على B<0>." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Closing the fanotify file descriptor" msgstr "إغلاق واصف ملف fanotify" #. 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 the fanotify notification group are " "closed, the fanotify group is released and its resources are freed for reuse " "by the kernel. Upon B(2), outstanding permission events will be set " "to allowed." msgstr "" "عند إغلاق جميع واصفات الملفات التي تشير إلى مجموعة إشعارات fanotify، تُحرر " "مجموعة fanotify وتُخلى مواردها ليعيد الـ kernel استخدامها. عند B(2)، " "ستُضبط أحداث الأذونات المعلقة على مسموح بها." #. 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 file IpidIfd contains information about fanotify marks " "for file descriptor I of process I. See B(5) for details." msgstr "" "يحتوي الملف IpidIfd على معلومات حول علامات fanotify لواصف " "الملف I للعملية I. راجع B(5) للتفاصيل." #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Since Linux 5.13 (and 5.10.220), the following interfaces can be used to " "control the amount of kernel resources consumed by fanotify:" msgstr "" "منذ لينكس 5.13 (و 5.10.220)، يمكن استخدام الواجهات التالية للتحكم في كمية " "موارد الـ kernel التي يستهلكها fanotify:" #. 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" #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b #. 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 fanotify group. Events in excess of this " "limit are dropped, but an B event is always generated. " "Prior to Linux kernel 5.13, the hardcoded limit was 16384 events." msgstr "" "تُستخدم القيمة الموجودة في هذا الملف عندما يستدعي تطبيق ما " "B(2) لضبط حد أقصى لعدد الأحداث التي يمكن وضعها في طابور " "مجموعة fanotify المقابلة. تُسقط الأحداث التي تتجاوز هذا الحد، ولكن يُولد دائماً " "حدث B. قبل نواة لينكس 5.13، كان الحد المبرمج صلباً هو 16384 " "حدثاً." #. 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" #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b #. 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 fanotify groups that can be " "created per real user ID. Prior to Linux kernel 5.13, the hardcoded limit " "was 128 groups per user." msgstr "" "يحدد هذا حداً أقصى لعدد مجموعات fanotify التي يمكن إنشاؤها لكل معرف مستخدم " "حقيقي. قبل نواة لينكس 5.13، كان الحد المبرمج صلباً هو 128 مجموعة لكل مستخدم." #. 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" #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b #. 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 fanotify marks that can be " "created per real user ID. Prior to Linux kernel 5.13, the hardcoded limit " "was 8192 marks per group (not per user)." msgstr "" "يحدد هذا حداً أقصى لعدد علامات fanotify التي يمكن إنشاؤها لكل معرف مستخدم " "حقيقي. قبل نواة لينكس 5.13، كان الحد المبرمج صلباً هو 8192 علامة لكل مجموعة " "(وليس لكل مستخدم)." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "الأخطاء" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In addition to the usual errors for B(2), the following errors can " "occur when reading from the fanotify file descriptor:" msgstr "" "بالإضافة إلى الأخطاء المعتادة لـ B(2)، يمكن أن تحدث الأخطاء التالية " "عند القراءة من واصف ملف fanotify:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The buffer is too small to hold the event." msgstr "الخبيئة أصغر من أن تتسع لهذا الحدث." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The per-process limit on the number of open files has been reached. See the " "description of B in B(2)." msgstr "" "بُلغ الحد الأقصى لعدد الملفات المفتوحة لكل عملية. انظر وصف B " "في 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 "" "The system-wide limit on the total number of open files has been reached. " "See I in B(5)." msgstr "" "بُلغ الحد الأقصى لعدد الملفات المفتوحة على مستوى النظام بأكمله. انظر I في B(5)." #. 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 "" "This error is returned by B(2) if B or B was " "specified in the I argument when calling B(2) " "and an event occurred for a monitored file that is currently being executed." msgstr "" "يُرجع الاستدعاء B(2) هذا الخطأ إذا حُدد B أو 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 "" "In addition to the usual errors for B(2), the following errors can " "occur when writing to the fanotify file descriptor:" msgstr "" "بالإضافة إلى الأخطاء المعتادة للاستدعاء B(2)، يمكن أن تقع الأخطاء " "التالية عند الكتابة في واصف ملف fanotify:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Fanotify access permissions are not enabled in the kernel configuration or " "the value of I in the response structure is not valid." msgstr "" "أذونات الوصول لـ Fanotify غير مفعّلة في ضبط النواة أو أن قيمة I في " "بنية الاستجابة غير صالحة." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The file descriptor I in the response structure is not valid. This may " "occur when a response for the permission event has already been written." msgstr "" "واصف الملف I في بنية الاستجابة غير صالح. قد يحدث هذا عندما تكون استجابة " "حدث الإذن قد كُتبت بالفعل." #. 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 "" "The fanotify API was introduced in Linux 2.6.36 and enabled in Linux " "2.6.37. fdinfo support was added in Linux 3.8." msgstr "" "قُدمت واجهة برمجة تطبيقات fanotify في لينكس 2.6.36 وفُعّلت في لينكس 2.6.37. " "أُضيف دعم fdinfo في لينكس 3.8." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "ملاحظات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The fanotify API is available only if the kernel was built with the " "B configuration option enabled. In addition, fanotify " "permission handling is available only if the " "B configuration option is enabled." msgstr "" "واجهة برمجة تطبيقات fanotify متاحة فقط إذا بُنيت النواة مع تفعيل خيار الضبط " "B. بالإضافة إلى ذلك، فإن معالجة أذونات fanotify متاحة فقط " "إذا فُعّل خيار الضبط B." #. 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 "" "Fanotify 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." msgstr "" "يبلغ fanotify فقط عن الأحداث التي يطلقها برنامج في مساحة المستخدم عبر واجهة " "برمجة تطبيقات نظام الملفات. ونتيجة لذلك، فإنه لا يلتقط الأحداث البعيدة التي " "تقع في أنظمة الملفات الشبكية." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The fanotify API does not report file accesses and modifications that may " "occur because of B(2), B(2), and B(2)." msgstr "" "لا تبلغ واجهة برمجة تطبيقات fanotify عن عمليات الوصول إلى الملفات وتعديلها " "التي قد تحدث بسبب 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 "" "Events for directories are created only if the directory itself is opened, " "read, and closed. Adding, removing, or changing children of a marked " "directory does not create events for the monitored directory itself." msgstr "" "تُنشأ أحداث الأدلة فقط إذا فُتح الدليل نفسه وقُرئ وأُغلق. إضافة أو إزالة أو " "تغيير أبناء دليل موسوم لا يُنشئ أحداثًا للدليل المراقب نفسه." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Fanotify monitoring of directories is not recursive: to monitor " "subdirectories under a directory, additional marks must be created. The " "B event can be used for detecting when a subdirectory has been " "created under a marked directory. An additional mark must then be set on " "the newly created subdirectory. This approach is racy, because it can lose " "events that occurred inside the newly created subdirectory, before a mark is " "added on that subdirectory. Monitoring mounts offers the capability to " "monitor a whole directory tree in a race-free manner. Monitoring " "filesystems offers the capability to monitor changes made from any mount of " "a filesystem instance in a race-free manner." msgstr "" "مراقبة fanotify للأدلة ليست عودية: لمراقبة الأدلة الفرعية تحت دليل ما، يجب " "إنشاء وسوم إضافية. يمكن استخدام حدث B لاكتشاف وقت إنشاء دليل " "فرعي تحت دليل موسوم. يجب بعد ذلك وضع وسم إضافي على الدليل الفرعي المنشأ " "حديثًا. هذا النهج عرضة لظروف السباق (racy)، لأنه قد يفقد الأحداث التي وقعت " "داخل الدليل الفرعي المنشأ حديثًا قبل إضافة وسم عليه. توفر مراقبة نقاط الوصل " "القدرة على مراقبة شجرة أدلة كاملة بطريقة خالية من السباق. توفر مراقبة أنظمة " "الملفات القدرة على مراقبة التغييرات التي تجري من أي وصل لمثيل نظام ملفات " "بطريقة خالية من السباق." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The event queue can overflow. In this case, events are lost." msgstr "قد يفيض طابور الأحداث. في هذه الحالة، تُفقد الأحداث." #. 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 generate fanotify events. Since " "Linux 3.19, calls to B(2) generate B events." msgstr "" "قبل لينكس 3.19، لم يكن B(2) يولد أحداث fanotify. منذ لينكس 3.19، " "تولد استدعاءات B(2) أحداث B." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "As of Linux 3.17, the following bugs exist:" msgstr "بدءًا من لينكس 3.17، توجد العلل التالية:" #. 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 "" "On Linux, a filesystem object may be accessible through multiple paths, for " "example, a part of a filesystem may be remounted using the I<--bind> option " "of B(8). A listener that marked a mount will be notified only of " "events that were triggered for a filesystem object using the same mount. " "Any other event will pass unnoticed." msgstr "" "في لينكس، يمكن الوصول إلى كائن نظام ملفات عبر مسارات متعددة، على سبيل " "المثال، قد يُعاد وصل جزء من نظام ملفات باستخدام خيار I<--bind> للأمر " "B(8). المستمع الذي وسم وصلًا سيُخطر فقط بالأحداث التي أُطلقت لكائن نظام " "ملفات باستخدام الوصل نفسه. أي حدث آخر سيمر دون ملاحظة." #. FIXME . A patch was proposed. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When an event is generated, no check is made to see whether the user ID of " "the receiving process has authorization to read or write the file before " "passing a file descriptor for that file. This poses a security risk, when " "the B capability is set for programs executed by unprivileged " "users." msgstr "" "عند توليد حدث، لا يُجرى أي فحص لمعرفة ما إذا كان معرف المستخدم للعملية " "المستلمة لديه تفويض للقراءة أو الكتابة في الملف قبل تمرير واصف ملف لذلك " "الملف. يمثل هذا خطرًا أمنيًا، عندما تُضبط إمكانية B للبرامج التي " "ينفذها مستخدمون غير مفوضين." #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If a call to B(2) processes multiple events from the fanotify queue " "and an error occurs, the return value will be the total size of the events " "successfully copied to the user-space buffer before the error occurred. The " "return value will not be -1, and I will not be set. Thus, the " "reading application has no way to detect the error." msgstr "" "إذا عالج استدعاء B(2) أحداثًا متعددة من طابور fanotify وحدث خطأ، فستكون " "القيمة المرجعة هي الحجم الإجمالي للأحداث التي نُسخت بنجاح إلى خبيئة مساحة " "المستخدم قبل وقوع الخطأ. لن تكون القيمة المرجعة -1، ولن يُضبط I. " "وبالتالي، لا تملك التطبيقات القارئة أي وسيلة لاكتشاف الخطأ." #. 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 two example programs below demonstrate the usage of the fanotify API." msgstr "يوضح البرنامجان المثالان أدناه استخدام واجهة برمجة تطبيقات fanotify." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Example program: fanotify_example.c" msgstr "برنامج مثال: fanotify_example.c" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The first program is an example of fanotify being used with its event object " "information passed in the form of a file descriptor. The program marks the " "mount passed as a command-line argument and waits for events of type " "B and B. When a permission event occurs, a " "B response is given." msgstr "" "البرنامج الأول هو مثال لاستخدام fanotify مع تمرير معلومات كائن الحدث الخاص " "به في شكل واصف ملف. يوسم البرنامج نقطة الوصل الممررة كمعامل في سطر الأوامر " "وينتظر أحداثًا من النوع 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 shell session shows an example of running this program. This " "session involved editing the file I. Before the file " "was opened, a B event occurred. After the file was closed, a " "B event occurred. Execution of the program ends when the " "user presses the ENTER key." msgstr "" "تُظهر جلسة الصدفة التالية مثالًا على تشغيل هذا البرنامج. تضمنت هذه الجلسة " "تحرير الملف I. قبل أن يُفتح الملف، وقع حدث " "B. بعد إغلاق الملف، وقع حدث B. ينتهي تنفيذ " "البرنامج عندما يضغط المستخدم على مفتاح ENTER." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#B< ./fanotify_example /home>;\n" "Press enter key to terminate.\n" "Listening for events.\n" "FAN_OPEN_PERM: File /home/user/temp/notes\n" "FAN_CLOSE_WRITE: File /home/user/temp/notes\n" "\\&\n" "Listening for events stopped.\n" msgstr "" "#B< ./fanotify_example /home>;\n" "اضغط على مفتاح ENTER للإنهاء.\n" "الاستماع للأحداث.\n" "FAN_OPEN_PERM: File /home/user/temp/notes\n" "FAN_CLOSE_WRITE: File /home/user/temp/notes\n" "\\&\n" "توقف الاستماع للأحداث.\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: fanotify_example.c" msgstr "مصدر البرنامج: fanotify_example.c" #. type: Plain text #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n" "\\&\n" "static void\n" "handle_events(int fd)\n" "{\n" " const struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_metadata buf[200];\n" " ssize_t size;\n" " char path[PATH_MAX];\n" " ssize_t path_len;\n" " char procfd_path[PATH_MAX];\n" " struct fanotify_response response;\n" "\\&\n" " /* Loop while events can be read from fanotify 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" " /* Check if end of available data reached. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Point to the first event in the buffer. */\n" "\\&\n" " metadata = buf;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " while (FAN_EVENT_OK(metadata, size)) {\n" "\\&\n" " /* Check that run-time and compile-time structures match. */\n" "\\&\n" " if (metadata-Evers != FANOTIFY_METADATA_VERSION) {\n" " fprintf(stderr,\n" " \"Mismatch of fanotify metadata version.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* metadata-Efd contains either FAN_NOFD, indicating a\n" " queue overflow, or a file descriptor (a nonnegative\n" " integer). Here, we simply ignore queue overflow. */\n" "\\&\n" " if (metadata-Efd E= 0) {\n" "\\&\n" " /* Handle open permission event. */\n" "\\&\n" " if (metadata-Emask & FAN_OPEN_PERM) {\n" " printf(\"FAN_OPEN_PERM: \");\n" "\\&\n" " /* Allow file to be opened. */\n" "\\&\n" " response.fd = metadata-Efd;\n" " response.response = FAN_ALLOW;\n" " write(fd, &response, sizeof(response));\n" " }\n" "\\&\n" " /* Handle closing of writable file event. */\n" "\\&\n" " if (metadata-Emask & FAN_CLOSE_WRITE)\n" " printf(\"FAN_CLOSE_WRITE: \");\n" "\\&\n" " /* Retrieve and print pathname of the accessed file. */\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path),\n" " \"/proc/self/fd/%d\", metadata-Efd);\n" " path_len = readlink(procfd_path, path,\n" " sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"File %s\\[rs]n\", path);\n" "\\&\n" " /* Close the file descriptor of the event. */\n" "\\&\n" " close(metadata-Efd);\n" " }\n" "\\&\n" " /* Advance to next event. */\n" "\\&\n" " metadata = FAN_EVENT_NEXT(metadata, size);\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " char buf;\n" " int fd, poll_num;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " /* Check mount point is supplied. */\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s MOUNT\\[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 fanotify API. */\n" "\\&\n" " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n" " O_RDONLY | O_LARGEFILE);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark the mount for:\n" " - permission events before opening files\n" " - notification events after closing a write-enabled\n" " file descriptor. */\n" "\\&\n" " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n" " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n" " argv[1]) == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\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; /* Fanotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* This is the loop to wait for incoming events. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " for (;;) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR) /* Interrupted by a signal */\n" " continue; /* Restart poll() */\n" "\\&\n" " perror(\"poll\"); /* Unexpected error */\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\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" " /* Fanotify events are available. */\n" "\\&\n" " handle_events(fd);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE /* مطلوب للحصول على تعريف O_LARGEFILE */\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* اقرأ جميع أحداث fanotify المتاحة من واصف الملف \\[aq]fd\\[aq]. */\n" "\\&\n" "static void\n" "handle_events(int fd)\n" "{\n" " const struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_metadata buf[200];\n" " ssize_t size;\n" " char path[PATH_MAX];\n" " ssize_t path_len;\n" " char procfd_path[PATH_MAX];\n" " struct fanotify_response response;\n" "\\&\n" " /* التكرار طالما يمكن قراءة الأحداث من واصف ملف fanotify. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* قراءة بعض الأحداث. */\n" "\\&\n" " size = read(fd, buf, sizeof(buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* التحقق مما إذا كان قد وصل إلى نهاية البيانات المتاحة. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* الإشارة إلى الحدث الأول في الخبيئة. */\n" "\\&\n" " metadata = buf;\n" "\\&\n" " /* التكرار عبر كافة الأحداث في الخبيئة. */\n" "\\&\n" " while (FAN_EVENT_OK(metadata, size)) {\n" "\\&\n" " /* التحقق من تطابق بنيات وقت التشغيل ووقت التجميع. */\n" "\\&\n" " if (metadata-Evers != FANOTIFY_METADATA_VERSION) {\n" " fprintf(stderr,\n" " \"Mismatch of fanotify metadata version.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* metadata-Efd يحتوي إما على FAN_NOFD، مما يشير إلى\n" " فيضان الطابور، أو واصف ملف (عدد صحيح غير سالب).\n" " هنا، نتجاهل ببساطة فيضان الطابور. */\n" "\\&\n" " if (metadata-Efd E= 0) {\n" "\\&\n" " /* معالجة حدث إذن الفتح. */\n" "\\&\n" " if (metadata-Emask & FAN_OPEN_PERM) {\n" " printf(\"FAN_OPEN_PERM: \");\n" "\\&\n" " /* السماح بفتح الملف. */\n" "\\&\n" " response.fd = metadata-Efd;\n" " response.response = FAN_ALLOW;\n" " write(fd, &response, sizeof(response));\n" " }\n" "\\&\n" " /* معالجة حدث إغلاق ملف قابل للكتابة. */\n" "\\&\n" " if (metadata-Emask & FAN_CLOSE_WRITE)\n" " printf(\"FAN_CLOSE_WRITE: \");\n" "\\&\n" " /* جلب وطباعة اسم المسار للملف الذي تم الوصول إليه. */\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path),\n" " \"/proc/self/fd/%d\", metadata-Efd);\n" " path_len = readlink(procfd_path, path,\n" " sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"File %s\\[rs]n\", path);\n" "\\&\n" " /* إغلاق واصف الملف الخاص بالحدث. */\n" "\\&\n" " close(metadata-Efd);\n" " }\n" "\\&\n" " /* الانتقال إلى الحدث التالي. */\n" "\\&\n" " metadata = FAN_EVENT_NEXT(metadata, size);\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " char buf;\n" " int fd, poll_num;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " /* التحقق من توفير نقطة الوصل. */\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Press enter key to terminate.\\[rs]n\");\n" "\\&\n" " /* إنشاء واصف الملف للوصول إلى واجهة برمجة تطبيقات fanotify. */\n" "\\&\n" " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n" " O_RDONLY | O_LARGEFILE);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* وسم نقطة الوصل لـ:\n" " - أحداث الإذن قبل فتح الملفات\n" " - أحداث الإشعار بعد إغلاق واصف ملف\n" " مفعّل للكتابة. */\n" "\\&\n" " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n" " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n" " argv[1]) == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* التحضير للاستطلاع (polling). */\n" "\\&\n" " nfds = 2;\n" "\\&\n" " fds[0].fd = STDIN_FILENO; /* إدخال الكونسول */\n" " fds[0].events = POLLIN;\n" "\\&\n" " fds[1].fd = fd; /* إدخال Fanotify */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* هذا هو التكرار لانتظار الأحداث القادمة. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " for (;;) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR) /* قُطع بواسطة إشارة */\n" " continue; /* إعادة تشغيل poll() */\n" "\\&\n" " perror(\"poll\"); /* خطأ غير متوقع */\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\n" " if (fds[0].revents & POLLIN) {\n" "\\&\n" " /* إدخال الكونسول متاح: إفراغ stdin والخروج. */\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" " /* أحداث Fanotify متاحة. */\n" "\\&\n" " handle_events(fd);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Example program: fanotify_fid.c" msgstr "برنامج مثال: fanotify_fid.c" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The second program is an example of fanotify being used with a group that " "identifies objects by file handles. The program marks the filesystem object " "that is passed as a command-line argument and waits until an event of type " "B has occurred. The event mask indicates which type of " "filesystem object\\[em]either a file or a directory\\[em]was created. Once " "all events have been read from the buffer and processed accordingly, the " "program simply terminates." msgstr "" "البرنامج الثاني هو مثال لاستخدام fanotify مع مجموعة تحدد الكائنات بواسطة " "مقابض الملفات. يوسم البرنامج كائن نظام الملفات الذي يُمرر كمعامل سطر أوامر " "وينتظر حتى يقع حدث من النوع B. يشير قناع الحدث إلى نوع كائن نظام " "الملفات\\[em]إما ملف أو دليل\\[em]الذي أُنشئ. وبمجرد قراءة جميع الأحداث من " "الخبيئة ومعالجتها وفقًا لذلك، ينتهي البرنامج ببساطة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The following shell sessions show two different invocations of this program, " "with different actions performed on a watched object." msgstr "" "تُظهر جلسات الصدفة التالية استدعاءين مختلفين لهذا البرنامج، مع تنفيذ إجراءات " "مختلفة على كائن مراقب." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The first session shows a mark being placed on I. This is " "followed by the creation of a regular file, I. " "This results in a B event being generated and reported against " "the file's parent watched directory object and with the created file name. " "Program execution ends once all events captured within the buffer have been " "processed." msgstr "" "تُظهر الجلسة الأولى وضع وسم على I. ويتبع ذلك إنشاء ملف عادي، I. ينتج عن هذا توليد حدث B والإبلاغ عنه " "مقابل كائن الدليل الأب المراقب للملف ومع اسم الملف المنشأ. ينتهي تنفيذ " "البرنامج بمجرد معالجة جميع الأحداث الملتقطة داخل الخبيئة." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#B< ./fanotify_fid /home/user>;\n" "Listening for events.\n" "FAN_CREATE (file created):\n" " Directory /home/user has been modified.\n" " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n" "All events processed successfully. Program exiting.\n" "\\&\n" "$B< touch /home/user/testfile.txt>; # In another terminal\n" msgstr "" "#B< ./fanotify_fid /home/user>;\n" "الاستماع للأحداث.\n" "FAN_CREATE (أُنشئ ملف):\n" " عُدّل الدليل /home/user.\n" " المدخل \\[aq]testfile.txt\\[aq] ليس دليلاً فرعيًا.\n" "عولجت جميع الأحداث بنجاح. يخرج البرنامج.\n" "\\&\n" "$B< touch /home/user/testfile.txt>; # في طرفية أخرى\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The second session shows a mark being placed on I. This is " "followed by the creation of a directory, I. This " "specific action results in a B event being generated and is " "reported with the B flag set and with the created directory name." msgstr "" "تُظهر الجلسة الثانية وضع وسم على I. ويتبع ذلك إنشاء دليل، I. ينتج عن هذا الإجراء المحدد توليد حدث B ويُبلغ عنه " "مع تعيين علم B ومع اسم الدليل المنشأ." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#B< ./fanotify_fid /home/user>;\n" "Listening for events.\n" "FAN_CREATE | FAN_ONDIR (subdirectory created):\n" " Directory /home/user has been modified.\n" " Entry \\[aq]testdir\\[aq] is a subdirectory.\n" "All events processed successfully. Program exiting.\n" "\\&\n" "$B< mkdir -p /home/user/testdir>; # In another terminal\n" msgstr "" "#B< ./fanotify_fid /home/user>;\n" "الاستماع للأحداث.\n" "FAN_CREATE | FAN_ONDIR (أُنشئ دليل فرعي):\n" " عُدّل الدليل /home/user.\n" " المدخل \\[aq]testdir\\[aq] هو دليل فرعي.\n" "عولجت جميع الأحداث بنجاح. يخرج البرنامج.\n" "\\&\n" "$B< mkdir -p /home/user/testdir>; # في طرفية أخرى\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: fanotify_fid.c" msgstr "مصدر البرنامج: fanotify_fid.c" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/types.hE\n" "#include Esys/stat.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define BUF_SIZE 256\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd, ret, event_fd, mount_fd;\n" " ssize_t size, path_len;\n" " char path[PATH_MAX];\n" " char procfd_path[PATH_MAX];\n" " char events_buf[BUF_SIZE];\n" " struct file_handle *file_handle;\n" " struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_info_fid *fid;\n" " const char *file_name;\n" " struct stat sb;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n" " if (mount_fd == -1) {\n" " perror(argv[1]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n" " a flag so that program can receive fid events with directory\n" " entry name. */\n" "\\&\n" " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Place a mark on the filesystem object supplied in argv[1]. */\n" "\\&\n" " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n" " FAN_CREATE | FAN_ONDIR,\n" " AT_FDCWD, argv[1]);\n" " if (ret == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " /* Read events from the event queue into a buffer. */\n" "\\&\n" " size = read(fd, events_buf, sizeof(events_buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Process all events within the buffer. */\n" "\\&\n" " for (metadata = (struct fanotify_event_metadata *) events_buf;\n" " FAN_EVENT_OK(metadata, size);\n" " metadata = FAN_EVENT_NEXT(metadata, size)) {\n" " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n" " file_handle = (struct file_handle *) fid-Ehandle;\n" "\\&\n" " /* Ensure that the event info is of the correct type. */\n" "\\&\n" " if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n" " fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n" " file_name = NULL;\n" " } else if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n" " file_name = file_handle-Ef_handle +\n" " file_handle-Ehandle_bytes;\n" " } else {\n" " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (metadata-Emask == FAN_CREATE)\n" " printf(\"FAN_CREATE (file created):\\[rs]n\");\n" "\\&\n" " if (metadata-Emask == (FAN_CREATE | FAN_ONDIR))\n" " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n" "\\&\n" "\t/* metadata-Efd is set to FAN_NOFD when the group identifies\n" "\t objects by file handles. To obtain a file descriptor for\n" "\t the file object corresponding to an event you can use the\n" "\t struct file_handle that\\[aq]s provided within the\n" "\t fanotify_event_info_fid in conjunction with the\n" "\t open_by_handle_at(2) system call. A check for ESTALE is\n" "\t done to accommodate for the situation where the file handle\n" "\t for the object was deleted prior to this system call. */\n" "\\&\n" " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n" " if (event_fd == -1) {\n" " if (errno == ESTALE) {\n" " printf(\"File handle is no longer valid. \"\n" " \"File has been deleted\\[rs]n\");\n" " continue;\n" " } else {\n" " perror(\"open_by_handle_at\");\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n" " event_fd);\n" "\\&\n" " /* Retrieve and print the path of the modified dentry. */\n" "\\&\n" " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n" "\\&\n" " if (file_name) {\n" " ret = fstatat(event_fd, file_name, &sb, 0);\n" " if (ret == -1) {\n" " if (errno != ENOENT) {\n" " perror(\"fstatat\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n" " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n" " } else {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n" " file_name);\n" " }\n" " }\n" "\\&\n" " /* Close associated file descriptor for this event. */\n" "\\&\n" " close(event_fd);\n" " }\n" "\\&\n" " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/types.hE\n" "#include Esys/stat.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define BUF_SIZE 256\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd, ret, event_fd, mount_fd;\n" " ssize_t size, path_len;\n" " char path[PATH_MAX];\n" " char procfd_path[PATH_MAX];\n" " char events_buf[BUF_SIZE];\n" " struct file_handle *file_handle;\n" " struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_info_fid *fid;\n" " const char *file_name;\n" " struct stat sb;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n" " if (mount_fd == -1) {\n" " perror(argv[1]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* إنشاء واصف ملف fanotify مع FAN_REPORT_DFID_NAME كـ\n" " علم حتى يتمكن البرنامج من استقبال أحداث fid مع اسم\n" " مدخل الدليل. */\n" "\\&\n" " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* وضع وسم على كائن نظام الملفات الموفر في argv[1]. */\n" "\\&\n" " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n" " FAN_CREATE | FAN_ONDIR,\n" " AT_FDCWD, argv[1]);\n" " if (ret == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " /* قراءة الأحداث من طابور الأحداث إلى خبيئة. */\n" "\\&\n" " size = read(fd, events_buf, sizeof(events_buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* معالجة جميع الأحداث داخل الخبيئة. */\n" "\\&\n" " for (metadata = (struct fanotify_event_metadata *) events_buf;\n" " FAN_EVENT_OK(metadata, size);\n" " metadata = FAN_EVENT_NEXT(metadata, size)) {\n" " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n" " file_handle = (struct file_handle *) fid-Ehandle;\n" "\\&\n" " /* التأكد من أن معلومات الحدث من النوع الصحيح. */\n" "\\&\n" " if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n" " fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n" " file_name = NULL;\n" " } else if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n" " file_name = file_handle-Ef_handle +\n" " file_handle-Ehandle_bytes;\n" " } else {\n" " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (metadata-Emask == FAN_CREATE)\n" " printf(\"FAN_CREATE (file created):\\[rs]n\");\n" "\\&\n" " if (metadata-Emask == (FAN_CREATE | FAN_ONDIR))\n" " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n" "\\&\n" "\t/* يُضبط metadata-Efd على FAN_NOFD عندما تحدد المجموعة\n" "\t الكائنات بواسطة مقابض الملفات. للحصول على واصف ملف\n" "\t لكائن الملف المقابل لحدث ما، يمكنك استخدام\n" "\t struct file_handle الموفرة داخل\n" "\t fanotify_event_info_fid بالاقتران مع استدعاء\n" "\t النظام open_by_handle_at(2). يُجرى فحص لـ ESTALE\n" "\t لاستيعاب الموقف الذي حُذف فيه مقبض الملف\n" "\t للكائن قبل استدعاء النظام هذا. */\n" "\\&\n" " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n" " if (event_fd == -1) {\n" " if (errno == ESTALE) {\n" " printf(\"File handle is no longer valid. \"\n" " \"File has been deleted\\[rs]n\");\n" " continue;\n" " } else {\n" " perror(\"open_by_handle_at\");\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n" " event_fd);\n" "\\&\n" " /* جلب وطباعة مسار dentry المعدل. */\n" "\\&\n" " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n" "\\&\n" " if (file_name) {\n" " ret = fstatat(event_fd, file_name, &sb, 0);\n" " if (ret == -1) {\n" " if (errno != ENOENT) {\n" " perror(\"fstatat\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n" " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n" " } else {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n" " file_name);\n" " }\n" " }\n" "\\&\n" " /* إغلاق واصف الملف المرتبط بهذا الحدث. */\n" "\\&\n" " close(event_fd);\n" " }\n" "\\&\n" " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\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(2), B(2), B(7)" msgstr "B(2)، B(2)، B(7)" #. type: TH #: debian-trixie #, no-wrap msgid "2024-06-15" msgstr "15 يونيو 2024" #. type: TH #: debian-trixie #, no-wrap msgid "Linux man-pages 6.9.1" msgstr "صفحات دليل لينكس 6.9.1" #. type: Plain text #: debian-trixie msgid "" "This is the length of the data for the current event and the offset to the " "next event in the buffer. Unless the group identifies filesystem objects by " "file handles, the value of I is always " "B. For a group that identifies filesystem objects " "by file handles, I also includes the variable length file " "identifier records." msgstr "" "هذا هو طول البيانات للحدث الحالي والإزاحة إلى الحدث التالي في الخبيئة. ما لم " "تحدد المجموعة كائنات نظام الملفات بواسطة مقابض الملفات، فإن قيمة " "I تكون دائمًا B. بالنسبة لمجموعة تحدد " "كائنات نظام الملفات بواسطة مقابض الملفات، فإن I تتضمن أيضًا سجلات " "معرف الملف ذات الطول المتغير." #. type: Plain text #: debian-trixie msgid "" "This is the length of the structure. The field was introduced to facilitate " "the implementation of optional headers per event type. No such optional " "headers exist in the current implementation." msgstr "" "هذا هو طول البنية. قُدم هذا الحقل لتسهيل تنفيذ ترويسات اختيارية لكل نوع حدث. " "لا توجد مثل هذه الترويسات الاختيارية في التنفيذ الحالي." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "A unique integer value representing the type of information record object " "received for an event. The value of this field can be set to one of the " "following: B, B, " "B, or B. The " "value set for this field is dependent on the flags that have been supplied " "to B(2). Refer to the field details of each information " "record object type below to understand the different cases in which the " "I values can be set." msgstr "" "قيمة صحيحة فريدة تمثل نوع كائن سجل المعلومات المستلم لحدث ما. يمكن ضبط قيمة " "هذا الحقل على أحد الخيارات التالية: B أو " "B أو B أو " "B. تعتمد القيمة المضبوطة لهذا الحقل على الأعلام " "التي وُفرت لـ B(2). ارجع إلى تفاصيل الحقل لكل نوع كائن سجل " "معلومات أدناه لفهم الحالات المختلفة التي يمكن فيها ضبط قيم I." #. type: Plain text #: debian-trixie msgid "" "This is a unique identifier of the filesystem containing the object " "associated with the event. It is a structure of type I<__kernel_fsid_t> and " "contains the same value as I when calling B(2)." msgstr "" "هذا معرف فريد لنظام الملفات الذي يحتوي على الكائن المرتبط بالحدث. وهو بنية " "من النوع I<__kernel_fsid_t> ويحتوي على القيمة نفسها لـ I عند استدعاء " "B(2)." #. type: Plain text #: debian-trixie msgid "" "This field contains a variable-length structure of type I. It is an opaque handle that corresponds to a specified object " "on a filesystem as returned by B(2). It can be used to " "uniquely identify a file on a filesystem and can be passed as an argument to " "B(2). If the value of I field is " "B, the file handle is followed by a null " "terminated string that identifies the created/deleted/moved directory entry " "name. For other events such as B, B, " "B, and B, if the value of I field " "is B, the I identifies the object " "correlated to the event. If the value of I field is " "B, the I identifies the directory object " "correlated to the event or the parent directory of a non-directory object " "correlated to the event. If the value of I field is " "B, the I identifies the same " "directory object that would be reported with B and " "the file handle is followed by a null terminated string that identifies the " "name of a directory entry in that directory, or '.' to identify the " "directory object itself." msgstr "" "يحتوي هذا الحقل على بنية متغيرة الطول من النوع I. وهو " "مقبض مبهم يقابل كائنًا محددًا في نظام الملفات كما يُرجعه " "B(2). يمكن استخدامه لتحديد ملف بشكل فريد في نظام ملفات " "ويمكن تمريره كمعامل إلى B(2). إذا كانت قيمة حقل " "I هي B، فيتبع مقبض الملف سلسلة " "نصية تنتهي بـ null تحدد اسم مدخل الدليل المنشأ/المحذوف/المنقول. بالنسبة " "للأحداث الأخرى مثل B و B و B و " "B، فإذا كانت قيمة حقل I هي " "B، فإن I يحدد الكائن المرتبط بالحدث. وإذا " "كانت قيمة حقل I هي B، فإن I " "يحدد كائن الدليل المرتبط بالحدث أو الدليل الأب لكائن ليس دليلًا ومرتبط " "بالحدث. وإذا كانت قيمة حقل I هي B، " "فإن I يحدد كائن الدليل نفسه الذي سيُبلغ عنه مع " "B ويتبع مقبض الملف سلسلة نصية تنتهي بـ null تحدد " "اسم مدخل دليل في ذلك الدليل، أو '.' لتحديد كائن الدليل نفسه." #. type: TP #: debian-trixie #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie msgid "" "This macro checks the remaining length I of the buffer I against " "the length of the metadata structure and the I field of the first " "metadata structure in the buffer." msgstr "" "يتحقق هذا الماكرو من الطول المتبقي I للخبيئة I مقابل طول بنية " "البيانات الوصفية وحقل I لأول بنية بيانات وصفية في الخبيئة." #. type: TP #: debian-trixie #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie msgid "" "This macro uses the length indicated in the I field of the " "metadata structure pointed to by I to calculate the address of the " "next metadata structure that follows I. I is the number of bytes " "of metadata that currently remain in the buffer. The macro returns a " "pointer to the next metadata structure that follows I, and reduces " "I by the number of bytes in the metadata structure that has been " "skipped over (i.e., it subtracts Ievent_len> from I)." msgstr "" "يستخدم هذا الماكرو الطول المشار إليه في حقل I لبنية البيانات " "الوصفية التي يشير إليها I لحساب عنوان بنية البيانات الوصفية التالية " "التي تلي I. I هو عدد بايتات البيانات الوصفية المتبقية حاليًا في " "الخبيئة. يُرجع الماكرو مؤشرًا إلى بنية البيانات الوصفية التالية التي تلي " "I، ويقلل I بمقدار عدد البايتات في بنية البيانات الوصفية التي جرى " "تخطيها (أي يطرح Ievent_len> من I)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This field indicates whether or not the permission is to be granted. Its " "value must be either B to allow the file operation or B " "to deny the file operation." msgstr "" "يشير هذا الحقل إلى ما إذا كان سيُمنح الإذن أم لا. يجب أن تكون قيمته إما " "B للسماح بعملية الملف أو B لرفض عملية الملف." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "If access is denied, the requesting application call will receive an " "B error. Additionally, if the notification group has been created " "with the B flag, then the B flag can be set in " "the I field. In that case, the audit subsystem will log " "information about the access decision to the audit logs." msgstr "" "إذا رُفض الوصول، فسيستلم استدعاء التطبيق الطالب خطأ B. بالإضافة إلى " "ذلك، إذا أُنشئت مجموعة الإشعارات مع علم B، فيمكن ضبط علم " "B في حقل I. في تلك الحالة، سيقوم نظام التدقيق (audit) " "بتسجيل معلومات حول قرار الوصول في سجلات التدقيق." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Errors not directly related to a file (i.e. super block corruption) are " "reported with an invalid I. For these errors, the I will " "have the field I set to B, and the handle " "buffer size set to B<0>." msgstr "" "الأخطاء غير المرتبطة مباشرة بملف (أي تلف الكتلة الفائقة) يُبلغ عنها بـ " "I غير صالح. لهذه الأخطاء، سيُضبط حقل I في I على " "B، ويُضبط حجم مخزن المقبض على B<0>." #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b #. type: Plain text #: debian-trixie msgid "" "Since Linux 5.13, the following interfaces can be used to control the amount " "of kernel resources consumed by fanotify:" msgstr "" "منذ لينكس 5.13، يمكن استخدام الواجهات التالية للتحكم في كمية موارد النواة " "التي يستهلكها fanotify:" #. type: Plain text #: debian-trixie msgid "" "If a call to B(2) processes multiple events from the fanotify queue " "and an error occurs, the return value will be the total length of the events " "successfully copied to the user-space buffer before the error occurred. The " "return value will not be -1, and I will not be set. Thus, the " "reading application has no way to detect the error." msgstr "" "إذا عالج استدعاء B(2) أحداثًا متعددة من طابور fanotify ووقع خطأ، فستكون " "القيمة المرجعة هي الطول الإجمالي للأحداث التي نُسخت بنجاح إلى خبيئة مساحة " "المستخدم قبل وقوع الخطأ. لن تكون القيمة المرجعة -1، ولن يُضبط I. " "وبالتالي، لا تملك التطبيقات القارئة أي وسيلة لاكتشاف الخطأ." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "# B<./fanotify_example /home>\n" "Press enter key to terminate.\n" "Listening for events.\n" "FAN_OPEN_PERM: File /home/user/temp/notes\n" "FAN_CLOSE_WRITE: File /home/user/temp/notes\n" "\\&\n" "Listening for events stopped.\n" msgstr "" "#B<./fanotify_example /home>;\n" "اضغط على مفتاح ENTER للإنهاء.\n" "الاستماع للأحداث.\n" "FAN_OPEN_PERM: File /home/user/temp/notes\n" "FAN_CLOSE_WRITE: File /home/user/temp/notes\n" "\\&\n" "توقف الاستماع للأحداث.\n" #. type: Plain text #: debian-trixie #, no-wrap msgid "" "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n" "\\&\n" "static void\n" "handle_events(int fd)\n" "{\n" " const struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_metadata buf[200];\n" " ssize_t len;\n" " char path[PATH_MAX];\n" " ssize_t path_len;\n" " char procfd_path[PATH_MAX];\n" " struct fanotify_response response;\n" "\\&\n" " /* Loop while events can be read from fanotify 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" " /* Check if end of available data reached. */\n" "\\&\n" " if (len E= 0)\n" " break;\n" "\\&\n" " /* Point to the first event in the buffer. */\n" "\\&\n" " metadata = buf;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " while (FAN_EVENT_OK(metadata, len)) {\n" "\\&\n" " /* Check that run-time and compile-time structures match. */\n" "\\&\n" " if (metadata-Evers != FANOTIFY_METADATA_VERSION) {\n" " fprintf(stderr,\n" " \"Mismatch of fanotify metadata version.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* metadata-Efd contains either FAN_NOFD, indicating a\n" " queue overflow, or a file descriptor (a nonnegative\n" " integer). Here, we simply ignore queue overflow. */\n" "\\&\n" " if (metadata-Efd E= 0) {\n" "\\&\n" " /* Handle open permission event. */\n" "\\&\n" " if (metadata-Emask & FAN_OPEN_PERM) {\n" " printf(\"FAN_OPEN_PERM: \");\n" "\\&\n" " /* Allow file to be opened. */\n" "\\&\n" " response.fd = metadata-Efd;\n" " response.response = FAN_ALLOW;\n" " write(fd, &response, sizeof(response));\n" " }\n" "\\&\n" " /* Handle closing of writable file event. */\n" "\\&\n" " if (metadata-Emask & FAN_CLOSE_WRITE)\n" " printf(\"FAN_CLOSE_WRITE: \");\n" "\\&\n" " /* Retrieve and print pathname of the accessed file. */\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path),\n" " \"/proc/self/fd/%d\", metadata-Efd);\n" " path_len = readlink(procfd_path, path,\n" " sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"File %s\\[rs]n\", path);\n" "\\&\n" " /* Close the file descriptor of the event. */\n" "\\&\n" " close(metadata-Efd);\n" " }\n" "\\&\n" " /* Advance to next event. */\n" "\\&\n" " metadata = FAN_EVENT_NEXT(metadata, len);\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " char buf;\n" " int fd, poll_num;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " /* Check mount point is supplied. */\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s MOUNT\\[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 fanotify API. */\n" "\\&\n" " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n" " O_RDONLY | O_LARGEFILE);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark the mount for:\n" " - permission events before opening files\n" " - notification events after closing a write-enabled\n" " file descriptor. */\n" "\\&\n" " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n" " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n" " argv[1]) == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\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; /* Fanotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* This is the loop to wait for incoming events. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR) /* Interrupted by a signal */\n" " continue; /* Restart poll() */\n" "\\&\n" " perror(\"poll\"); /* Unexpected error */\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\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" " /* Fanotify events are available. */\n" "\\&\n" " handle_events(fd);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n" "\\&\n" "static void\n" "handle_events(int fd)\n" "{\n" " const struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_metadata buf[200];\n" " ssize_t len;\n" " char path[PATH_MAX];\n" " ssize_t path_len;\n" " char procfd_path[PATH_MAX];\n" " struct fanotify_response response;\n" "\\&\n" " /* Loop while events can be read from fanotify 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" " /* Check if end of available data reached. */\n" "\\&\n" " if (len E= 0)\n" " break;\n" "\\&\n" " /* Point to the first event in the buffer. */\n" "\\&\n" " metadata = buf;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " while (FAN_EVENT_OK(metadata, len)) {\n" "\\&\n" " /* Check that run-time and compile-time structures match. */\n" "\\&\n" " if (metadata-Evers != FANOTIFY_METADATA_VERSION) {\n" " fprintf(stderr,\n" " \"Mismatch of fanotify metadata version.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* metadata-Efd contains either FAN_NOFD, indicating a\n" " queue overflow, or a file descriptor (a nonnegative\n" " integer). Here, we simply ignore queue overflow. */\n" "\\&\n" " if (metadata-Efd E= 0) {\n" "\\&\n" " /* Handle open permission event. */\n" "\\&\n" " if (metadata-Emask & FAN_OPEN_PERM) {\n" " printf(\"FAN_OPEN_PERM: \");\n" "\\&\n" " /* Allow file to be opened. */\n" "\\&\n" " response.fd = metadata-Efd;\n" " response.response = FAN_ALLOW;\n" " write(fd, &response, sizeof(response));\n" " }\n" "\\&\n" " /* Handle closing of writable file event. */\n" "\\&\n" " if (metadata-Emask & FAN_CLOSE_WRITE)\n" " printf(\"FAN_CLOSE_WRITE: \");\n" "\\&\n" " /* Retrieve and print pathname of the accessed file. */\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path),\n" " \"/proc/self/fd/%d\", metadata-Efd);\n" " path_len = readlink(procfd_path, path,\n" " sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"File %s\\[rs]n\", path);\n" "\\&\n" " /* Close the file descriptor of the event. */\n" "\\&\n" " close(metadata-Efd);\n" " }\n" "\\&\n" " /* Advance to next event. */\n" "\\&\n" " metadata = FAN_EVENT_NEXT(metadata, len);\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " char buf;\n" " int fd, poll_num;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " /* Check mount point is supplied. */\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s MOUNT\\[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 fanotify API. */\n" "\\&\n" " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n" " O_RDONLY | O_LARGEFILE);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark the mount for:\n" " - permission events before opening files\n" " - notification events after closing a write-enabled\n" " file descriptor. */\n" "\\&\n" " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n" " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n" " argv[1]) == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\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; /* Fanotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* This is the loop to wait for incoming events. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR) /* Interrupted by a signal */\n" " continue; /* Restart poll() */\n" "\\&\n" " perror(\"poll\"); /* Unexpected error */\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\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" " /* Fanotify events are available. */\n" "\\&\n" " handle_events(fd);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "# B<./fanotify_fid /home/user>\n" "Listening for events.\n" "FAN_CREATE (file created):\n" " Directory /home/user has been modified.\n" " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n" "All events processed successfully. Program exiting.\n" "\\&\n" "$ B # In another terminal\n" msgstr "" "# B<./fanotify_fid /home/user>\n" "Listening for events.\n" "FAN_CREATE (file created):\n" " Directory /home/user has been modified.\n" " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n" "All events processed successfully. Program exiting.\n" "\\&\n" "$ B # In another terminal\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "# B<./fanotify_fid /home/user>\n" "Listening for events.\n" "FAN_CREATE | FAN_ONDIR (subdirectory created):\n" " Directory /home/user has been modified.\n" " Entry \\[aq]testdir\\[aq] is a subdirectory.\n" "All events processed successfully. Program exiting.\n" "\\&\n" "$ B # In another terminal\n" msgstr "" "# B<./fanotify_fid /home/user>\n" "Listening for events.\n" "FAN_CREATE | FAN_ONDIR (subdirectory created):\n" " Directory /home/user has been modified.\n" " Entry \\[aq]testdir\\[aq] is a subdirectory.\n" "All events processed successfully. Program exiting.\n" "\\&\n" "$ B # In another terminal\n" #. type: Plain text #: debian-trixie #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/types.hE\n" "#include Esys/stat.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define BUF_SIZE 256\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd, ret, event_fd, mount_fd;\n" " ssize_t len, path_len;\n" " char path[PATH_MAX];\n" " char procfd_path[PATH_MAX];\n" " char events_buf[BUF_SIZE];\n" " struct file_handle *file_handle;\n" " struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_info_fid *fid;\n" " const char *file_name;\n" " struct stat sb;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n" " if (mount_fd == -1) {\n" " perror(argv[1]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n" " a flag so that program can receive fid events with directory\n" " entry name. */\n" "\\&\n" " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Place a mark on the filesystem object supplied in argv[1]. */\n" "\\&\n" " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n" " FAN_CREATE | FAN_ONDIR,\n" " AT_FDCWD, argv[1]);\n" " if (ret == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " /* Read events from the event queue into a buffer. */\n" "\\&\n" " len = read(fd, events_buf, sizeof(events_buf));\n" " if (len == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Process all events within the buffer. */\n" "\\&\n" " for (metadata = (struct fanotify_event_metadata *) events_buf;\n" " FAN_EVENT_OK(metadata, len);\n" " metadata = FAN_EVENT_NEXT(metadata, len)) {\n" " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n" " file_handle = (struct file_handle *) fid-Ehandle;\n" "\\&\n" " /* Ensure that the event info is of the correct type. */\n" "\\&\n" " if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n" " fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n" " file_name = NULL;\n" " } else if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n" " file_name = file_handle-Ef_handle +\n" " file_handle-Ehandle_bytes;\n" " } else {\n" " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (metadata-Emask == FAN_CREATE)\n" " printf(\"FAN_CREATE (file created):\\[rs]n\");\n" "\\&\n" " if (metadata-Emask == (FAN_CREATE | FAN_ONDIR))\n" " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n" "\\&\n" "\t/* metadata-Efd is set to FAN_NOFD when the group identifies\n" "\t objects by file handles. To obtain a file descriptor for\n" "\t the file object corresponding to an event you can use the\n" "\t struct file_handle that\\[aq]s provided within the\n" "\t fanotify_event_info_fid in conjunction with the\n" "\t open_by_handle_at(2) system call. A check for ESTALE is\n" "\t done to accommodate for the situation where the file handle\n" "\t for the object was deleted prior to this system call. */\n" "\\&\n" " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n" " if (event_fd == -1) {\n" " if (errno == ESTALE) {\n" " printf(\"File handle is no longer valid. \"\n" " \"File has been deleted\\[rs]n\");\n" " continue;\n" " } else {\n" " perror(\"open_by_handle_at\");\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n" " event_fd);\n" "\\&\n" " /* Retrieve and print the path of the modified dentry. */\n" "\\&\n" " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n" "\\&\n" " if (file_name) {\n" " ret = fstatat(event_fd, file_name, &sb, 0);\n" " if (ret == -1) {\n" " if (errno != ENOENT) {\n" " perror(\"fstatat\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n" " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n" " } else {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n" " file_name);\n" " }\n" " }\n" "\\&\n" " /* Close associated file descriptor for this event. */\n" "\\&\n" " close(event_fd);\n" " }\n" "\\&\n" " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/types.hE\n" "#include Esys/stat.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define BUF_SIZE 256\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd, ret, event_fd, mount_fd;\n" " ssize_t len, path_len;\n" " char path[PATH_MAX];\n" " char procfd_path[PATH_MAX];\n" " char events_buf[BUF_SIZE];\n" " struct file_handle *file_handle;\n" " struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_info_fid *fid;\n" " const char *file_name;\n" " struct stat sb;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n" " if (mount_fd == -1) {\n" " perror(argv[1]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n" " a flag so that program can receive fid events with directory\n" " entry name. */\n" "\\&\n" " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Place a mark on the filesystem object supplied in argv[1]. */\n" "\\&\n" " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n" " FAN_CREATE | FAN_ONDIR,\n" " AT_FDCWD, argv[1]);\n" " if (ret == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " /* Read events from the event queue into a buffer. */\n" "\\&\n" " len = read(fd, events_buf, sizeof(events_buf));\n" " if (len == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Process all events within the buffer. */\n" "\\&\n" " for (metadata = (struct fanotify_event_metadata *) events_buf;\n" " FAN_EVENT_OK(metadata, len);\n" " metadata = FAN_EVENT_NEXT(metadata, len)) {\n" " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n" " file_handle = (struct file_handle *) fid-Ehandle;\n" "\\&\n" " /* Ensure that the event info is of the correct type. */\n" "\\&\n" " if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n" " fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n" " file_name = NULL;\n" " } else if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n" " file_name = file_handle-Ef_handle +\n" " file_handle-Ehandle_bytes;\n" " } else {\n" " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (metadata-Emask == FAN_CREATE)\n" " printf(\"FAN_CREATE (file created):\\[rs]n\");\n" "\\&\n" " if (metadata-Emask == (FAN_CREATE | FAN_ONDIR))\n" " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n" "\\&\n" "\t/* metadata-Efd is set to FAN_NOFD when the group identifies\n" "\t objects by file handles. To obtain a file descriptor for\n" "\t the file object corresponding to an event you can use the\n" "\t struct file_handle that\\[aq]s provided within the\n" "\t fanotify_event_info_fid in conjunction with the\n" "\t open_by_handle_at(2) system call. A check for ESTALE is\n" "\t done to accommodate for the situation where the file handle\n" "\t for the object was deleted prior to this system call. */\n" "\\&\n" " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n" " if (event_fd == -1) {\n" " if (errno == ESTALE) {\n" " printf(\"File handle is no longer valid. \"\n" " \"File has been deleted\\[rs]n\");\n" " continue;\n" " } else {\n" " perror(\"open_by_handle_at\");\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n" " event_fd);\n" "\\&\n" " /* Retrieve and print the path of the modified dentry. */\n" "\\&\n" " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n" "\\&\n" " if (file_name) {\n" " ret = fstatat(event_fd, file_name, &sb, 0);\n" " if (ret == -1) {\n" " if (errno != ENOENT) {\n" " perror(\"fstatat\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n" " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n" " } else {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n" " file_name);\n" " }\n" " }\n" "\\&\n" " /* Close associated file descriptor for this event. */\n" "\\&\n" " close(event_fd);\n" " }\n" "\\&\n" " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "2024-11-17" msgstr "17 نوفمبر 2024" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "Linux man-pages 6.13" msgstr "صفحات دليل لينكس 6.13" #. type: Plain text #: fedora-44 fedora-rawhide #, no-wrap msgid "" "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n" "\\&\n" "static void\n" "handle_events(int fd)\n" "{\n" " const struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_metadata buf[200];\n" " ssize_t size;\n" " char path[PATH_MAX];\n" " ssize_t path_len;\n" " char procfd_path[PATH_MAX];\n" " struct fanotify_response response;\n" "\\&\n" " /* Loop while events can be read from fanotify 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" " /* Check if end of available data reached. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Point to the first event in the buffer. */\n" "\\&\n" " metadata = buf;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " while (FAN_EVENT_OK(metadata, size)) {\n" "\\&\n" " /* Check that run-time and compile-time structures match. */\n" "\\&\n" " if (metadata-Evers != FANOTIFY_METADATA_VERSION) {\n" " fprintf(stderr,\n" " \"Mismatch of fanotify metadata version.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* metadata-Efd contains either FAN_NOFD, indicating a\n" " queue overflow, or a file descriptor (a nonnegative\n" " integer). Here, we simply ignore queue overflow. */\n" "\\&\n" " if (metadata-Efd E= 0) {\n" "\\&\n" " /* Handle open permission event. */\n" "\\&\n" " if (metadata-Emask & FAN_OPEN_PERM) {\n" " printf(\"FAN_OPEN_PERM: \");\n" "\\&\n" " /* Allow file to be opened. */\n" "\\&\n" " response.fd = metadata-Efd;\n" " response.response = FAN_ALLOW;\n" " write(fd, &response, sizeof(response));\n" " }\n" "\\&\n" " /* Handle closing of writable file event. */\n" "\\&\n" " if (metadata-Emask & FAN_CLOSE_WRITE)\n" " printf(\"FAN_CLOSE_WRITE: \");\n" "\\&\n" " /* Retrieve and print pathname of the accessed file. */\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path),\n" " \"/proc/self/fd/%d\", metadata-Efd);\n" " path_len = readlink(procfd_path, path,\n" " sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"File %s\\[rs]n\", path);\n" "\\&\n" " /* Close the file descriptor of the event. */\n" "\\&\n" " close(metadata-Efd);\n" " }\n" "\\&\n" " /* Advance to next event. */\n" "\\&\n" " metadata = FAN_EVENT_NEXT(metadata, size);\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " char buf;\n" " int fd, poll_num;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " /* Check mount point is supplied. */\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s MOUNT\\[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 fanotify API. */\n" "\\&\n" " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n" " O_RDONLY | O_LARGEFILE);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark the mount for:\n" " - permission events before opening files\n" " - notification events after closing a write-enabled\n" " file descriptor. */\n" "\\&\n" " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n" " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n" " argv[1]) == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\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; /* Fanotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* This is the loop to wait for incoming events. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR) /* Interrupted by a signal */\n" " continue; /* Restart poll() */\n" "\\&\n" " perror(\"poll\"); /* Unexpected error */\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\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" " /* Fanotify events are available. */\n" "\\&\n" " handle_events(fd);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n" "\\&\n" "static void\n" "handle_events(int fd)\n" "{\n" " const struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_metadata buf[200];\n" " ssize_t size;\n" " char path[PATH_MAX];\n" " ssize_t path_len;\n" " char procfd_path[PATH_MAX];\n" " struct fanotify_response response;\n" "\\&\n" " /* Loop while events can be read from fanotify 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" " /* Check if end of available data reached. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Point to the first event in the buffer. */\n" "\\&\n" " metadata = buf;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " while (FAN_EVENT_OK(metadata, size)) {\n" "\\&\n" " /* Check that run-time and compile-time structures match. */\n" "\\&\n" " if (metadata-Evers != FANOTIFY_METADATA_VERSION) {\n" " fprintf(stderr,\n" " \"Mismatch of fanotify metadata version.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* metadata-Efd contains either FAN_NOFD, indicating a\n" " queue overflow, or a file descriptor (a nonnegative\n" " integer). Here, we simply ignore queue overflow. */\n" "\\&\n" " if (metadata-Efd E= 0) {\n" "\\&\n" " /* Handle open permission event. */\n" "\\&\n" " if (metadata-Emask & FAN_OPEN_PERM) {\n" " printf(\"FAN_OPEN_PERM: \");\n" "\\&\n" " /* Allow file to be opened. */\n" "\\&\n" " response.fd = metadata-Efd;\n" " response.response = FAN_ALLOW;\n" " write(fd, &response, sizeof(response));\n" " }\n" "\\&\n" " /* Handle closing of writable file event. */\n" "\\&\n" " if (metadata-Emask & FAN_CLOSE_WRITE)\n" " printf(\"FAN_CLOSE_WRITE: \");\n" "\\&\n" " /* Retrieve and print pathname of the accessed file. */\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path),\n" " \"/proc/self/fd/%d\", metadata-Efd);\n" " path_len = readlink(procfd_path, path,\n" " sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"File %s\\[rs]n\", path);\n" "\\&\n" " /* Close the file descriptor of the event. */\n" "\\&\n" " close(metadata-Efd);\n" " }\n" "\\&\n" " /* Advance to next event. */\n" "\\&\n" " metadata = FAN_EVENT_NEXT(metadata, size);\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " char buf;\n" " int fd, poll_num;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " /* Check mount point is supplied. */\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s MOUNT\\[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 fanotify API. */\n" "\\&\n" " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n" " O_RDONLY | O_LARGEFILE);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark the mount for:\n" " - permission events before opening files\n" " - notification events after closing a write-enabled\n" " file descriptor. */\n" "\\&\n" " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n" " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n" " argv[1]) == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\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; /* Fanotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* This is the loop to wait for incoming events. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR) /* Interrupted by a signal */\n" " continue; /* Restart poll() */\n" "\\&\n" " perror(\"poll\"); /* Unexpected error */\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\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" " /* Fanotify events are available. */\n" "\\&\n" " handle_events(fd);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: fedora-44 fedora-rawhide #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/types.hE\n" "#include Esys/stat.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define BUF_SIZE 256\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd, ret, event_fd, mount_fd;\n" " ssize_t size, path_len;\n" " char path[PATH_MAX];\n" " char procfd_path[PATH_MAX];\n" " char events_buf[BUF_SIZE];\n" " struct file_handle *file_handle;\n" " struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_info_fid *fid;\n" " const char *file_name;\n" " struct stat sb;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n" " if (mount_fd == -1) {\n" " perror(argv[1]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n" " a flag so that program can receive fid events with directory\n" " entry name. */\n" "\\&\n" " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Place a mark on the filesystem object supplied in argv[1]. */\n" "\\&\n" " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n" " FAN_CREATE | FAN_ONDIR,\n" " AT_FDCWD, argv[1]);\n" " if (ret == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " /* Read events from the event queue into a buffer. */\n" "\\&\n" " size = read(fd, events_buf, sizeof(events_buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Process all events within the buffer. */\n" "\\&\n" " for (metadata = (struct fanotify_event_metadata *) events_buf;\n" " FAN_EVENT_OK(metadata, size);\n" " metadata = FAN_EVENT_NEXT(metadata, size)) {\n" " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n" " file_handle = (struct file_handle *) fid-Ehandle;\n" "\\&\n" " /* Ensure that the event info is of the correct type. */\n" "\\&\n" " if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n" " fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n" " file_name = NULL;\n" " } else if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n" " file_name = file_handle-Ef_handle +\n" " file_handle-Ehandle_bytes;\n" " } else {\n" " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (metadata-Emask == FAN_CREATE)\n" " printf(\"FAN_CREATE (file created):\\[rs]n\");\n" "\\&\n" " if (metadata-Emask == (FAN_CREATE | FAN_ONDIR))\n" " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n" "\\&\n" "\t/* metadata-Efd is set to FAN_NOFD when the group identifies\n" "\t objects by file handles. To obtain a file descriptor for\n" "\t the file object corresponding to an event you can use the\n" "\t struct file_handle that\\[aq]s provided within the\n" "\t fanotify_event_info_fid in conjunction with the\n" "\t open_by_handle_at(2) system call. A check for ESTALE is\n" "\t done to accommodate for the situation where the file handle\n" "\t for the object was deleted prior to this system call. */\n" "\\&\n" " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n" " if (event_fd == -1) {\n" " if (errno == ESTALE) {\n" " printf(\"File handle is no longer valid. \"\n" " \"File has been deleted\\[rs]n\");\n" " continue;\n" " } else {\n" " perror(\"open_by_handle_at\");\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n" " event_fd);\n" "\\&\n" " /* Retrieve and print the path of the modified dentry. */\n" "\\&\n" " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n" "\\&\n" " if (file_name) {\n" " ret = fstatat(event_fd, file_name, &sb, 0);\n" " if (ret == -1) {\n" " if (errno != ENOENT) {\n" " perror(\"fstatat\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n" " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n" " } else {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n" " file_name);\n" " }\n" " }\n" "\\&\n" " /* Close associated file descriptor for this event. */\n" "\\&\n" " close(event_fd);\n" " }\n" "\\&\n" " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/types.hE\n" "#include Esys/stat.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define BUF_SIZE 256\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd, ret, event_fd, mount_fd;\n" " ssize_t size, path_len;\n" " char path[PATH_MAX];\n" " char procfd_path[PATH_MAX];\n" " char events_buf[BUF_SIZE];\n" " struct file_handle *file_handle;\n" " struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_info_fid *fid;\n" " const char *file_name;\n" " struct stat sb;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n" " if (mount_fd == -1) {\n" " perror(argv[1]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n" " a flag so that program can receive fid events with directory\n" " entry name. */\n" "\\&\n" " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Place a mark on the filesystem object supplied in argv[1]. */\n" "\\&\n" " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n" " FAN_CREATE | FAN_ONDIR,\n" " AT_FDCWD, argv[1]);\n" " if (ret == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " /* Read events from the event queue into a buffer. */\n" "\\&\n" " size = read(fd, events_buf, sizeof(events_buf));\n" " if (size == -1 && errno != EAGAIN) {\n" " perror(\"read\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Process all events within the buffer. */\n" "\\&\n" " for (metadata = (struct fanotify_event_metadata *) events_buf;\n" " FAN_EVENT_OK(metadata, size);\n" " metadata = FAN_EVENT_NEXT(metadata, size)) {\n" " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n" " file_handle = (struct file_handle *) fid-Ehandle;\n" "\\&\n" " /* Ensure that the event info is of the correct type. */\n" "\\&\n" " if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n" " fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n" " file_name = NULL;\n" " } else if (fid-Ehdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n" " file_name = file_handle-Ef_handle +\n" " file_handle-Ehandle_bytes;\n" " } else {\n" " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (metadata-Emask == FAN_CREATE)\n" " printf(\"FAN_CREATE (file created):\\[rs]n\");\n" "\\&\n" " if (metadata-Emask == (FAN_CREATE | FAN_ONDIR))\n" " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n" "\\&\n" "\t/* metadata-Efd is set to FAN_NOFD when the group identifies\n" "\t objects by file handles. To obtain a file descriptor for\n" "\t the file object corresponding to an event you can use the\n" "\t struct file_handle that\\[aq]s provided within the\n" "\t fanotify_event_info_fid in conjunction with the\n" "\t open_by_handle_at(2) system call. A check for ESTALE is\n" "\t done to accommodate for the situation where the file handle\n" "\t for the object was deleted prior to this system call. */\n" "\\&\n" " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n" " if (event_fd == -1) {\n" " if (errno == ESTALE) {\n" " printf(\"File handle is no longer valid. \"\n" " \"File has been deleted\\[rs]n\");\n" " continue;\n" " } else {\n" " perror(\"open_by_handle_at\");\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n" " event_fd);\n" "\\&\n" " /* Retrieve and print the path of the modified dentry. */\n" "\\&\n" " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n" "\\&\n" " if (file_name) {\n" " ret = fstatat(event_fd, file_name, &sb, 0);\n" " if (ret == -1) {\n" " if (errno != ENOENT) {\n" " perror(\"fstatat\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n" " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n" " } else {\n" " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n" " file_name);\n" " }\n" " }\n" "\\&\n" " /* Close associated file descriptor for this event. */\n" "\\&\n" " close(event_fd);\n" " }\n" "\\&\n" " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\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 "" "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n" "\\&\n" "static void\n" "handle_events(int fd)\n" "{\n" " const struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_metadata buf[200];\n" " ssize_t size;\n" " char path[PATH_MAX];\n" " ssize_t path_len;\n" " char procfd_path[PATH_MAX];\n" " struct fanotify_response response;\n" "\\&\n" " /* Loop while events can be read from fanotify 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" " /* Check if end of available data reached. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Point to the first event in the buffer. */\n" "\\&\n" " metadata = buf;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " while (FAN_EVENT_OK(metadata, size)) {\n" "\\&\n" " /* Check that run-time and compile-time structures match. */\n" "\\&\n" " if (metadata-Evers != FANOTIFY_METADATA_VERSION) {\n" " fprintf(stderr,\n" " \"Mismatch of fanotify metadata version.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* metadata-Efd contains either FAN_NOFD, indicating a\n" " queue overflow, or a file descriptor (a nonnegative\n" " integer). Here, we simply ignore queue overflow. */\n" "\\&\n" " if (metadata-Efd E= 0) {\n" "\\&\n" " /* Handle open permission event. */\n" "\\&\n" " if (metadata-Emask & FAN_OPEN_PERM) {\n" " printf(\"FAN_OPEN_PERM: \");\n" "\\&\n" " /* Allow file to be opened. */\n" "\\&\n" " response.fd = metadata-Efd;\n" " response.response = FAN_ALLOW;\n" " write(fd, &response, sizeof(response));\n" " }\n" "\\&\n" " /* Handle closing of writable file event. */\n" "\\&\n" " if (metadata-Emask & FAN_CLOSE_WRITE)\n" " printf(\"FAN_CLOSE_WRITE: \");\n" "\\&\n" " /* Retrieve and print pathname of the accessed file. */\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path),\n" " \"/proc/self/fd/%d\", metadata-Efd);\n" " path_len = readlink(procfd_path, path,\n" " sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"File %s\\[rs]n\", path);\n" "\\&\n" " /* Close the file descriptor of the event. */\n" "\\&\n" " close(metadata-Efd);\n" " }\n" "\\&\n" " /* Advance to next event. */\n" "\\&\n" " metadata = FAN_EVENT_NEXT(metadata, size);\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " char buf;\n" " int fd, poll_num;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " /* Check mount point is supplied. */\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s MOUNT\\[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 fanotify API. */\n" "\\&\n" " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n" " O_RDONLY | O_LARGEFILE);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark the mount for:\n" " - permission events before opening files\n" " - notification events after closing a write-enabled\n" " file descriptor. */\n" "\\&\n" " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n" " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n" " argv[1]) == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\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; /* Fanotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* This is the loop to wait for incoming events. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR) /* Interrupted by a signal */\n" " continue; /* Restart poll() */\n" "\\&\n" " perror(\"poll\"); /* Unexpected error */\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\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" " /* Fanotify events are available. */\n" "\\&\n" " handle_events(fd);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Epoll.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/fanotify.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n" "\\&\n" "static void\n" "handle_events(int fd)\n" "{\n" " const struct fanotify_event_metadata *metadata;\n" " struct fanotify_event_metadata buf[200];\n" " ssize_t size;\n" " char path[PATH_MAX];\n" " ssize_t path_len;\n" " char procfd_path[PATH_MAX];\n" " struct fanotify_response response;\n" "\\&\n" " /* Loop while events can be read from fanotify 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" " /* Check if end of available data reached. */\n" "\\&\n" " if (size E= 0)\n" " break;\n" "\\&\n" " /* Point to the first event in the buffer. */\n" "\\&\n" " metadata = buf;\n" "\\&\n" " /* Loop over all events in the buffer. */\n" "\\&\n" " while (FAN_EVENT_OK(metadata, size)) {\n" "\\&\n" " /* Check that run-time and compile-time structures match. */\n" "\\&\n" " if (metadata-Evers != FANOTIFY_METADATA_VERSION) {\n" " fprintf(stderr,\n" " \"Mismatch of fanotify metadata version.\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* metadata-Efd contains either FAN_NOFD, indicating a\n" " queue overflow, or a file descriptor (a nonnegative\n" " integer). Here, we simply ignore queue overflow. */\n" "\\&\n" " if (metadata-Efd E= 0) {\n" "\\&\n" " /* Handle open permission event. */\n" "\\&\n" " if (metadata-Emask & FAN_OPEN_PERM) {\n" " printf(\"FAN_OPEN_PERM: \");\n" "\\&\n" " /* Allow file to be opened. */\n" "\\&\n" " response.fd = metadata-Efd;\n" " response.response = FAN_ALLOW;\n" " write(fd, &response, sizeof(response));\n" " }\n" "\\&\n" " /* Handle closing of writable file event. */\n" "\\&\n" " if (metadata-Emask & FAN_CLOSE_WRITE)\n" " printf(\"FAN_CLOSE_WRITE: \");\n" "\\&\n" " /* Retrieve and print pathname of the accessed file. */\n" "\\&\n" " snprintf(procfd_path, sizeof(procfd_path),\n" " \"/proc/self/fd/%d\", metadata-Efd);\n" " path_len = readlink(procfd_path, path,\n" " sizeof(path) - 1);\n" " if (path_len == -1) {\n" " perror(\"readlink\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " path[path_len] = \\[aq]\\[rs]0\\[aq];\n" " printf(\"File %s\\[rs]n\", path);\n" "\\&\n" " /* Close the file descriptor of the event. */\n" "\\&\n" " close(metadata-Efd);\n" " }\n" "\\&\n" " /* Advance to next event. */\n" "\\&\n" " metadata = FAN_EVENT_NEXT(metadata, size);\n" " }\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " char buf;\n" " int fd, poll_num;\n" " nfds_t nfds;\n" " struct pollfd fds[2];\n" "\\&\n" " /* Check mount point is supplied. */\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s MOUNT\\[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 fanotify API. */\n" "\\&\n" " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n" " O_RDONLY | O_LARGEFILE);\n" " if (fd == -1) {\n" " perror(\"fanotify_init\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Mark the mount for:\n" " - permission events before opening files\n" " - notification events after closing a write-enabled\n" " file descriptor. */\n" "\\&\n" " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n" " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n" " argv[1]) == -1) {\n" " perror(\"fanotify_mark\");\n" " exit(EXIT_FAILURE);\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; /* Fanotify input */\n" " fds[1].events = POLLIN;\n" "\\&\n" " /* This is the loop to wait for incoming events. */\n" "\\&\n" " printf(\"Listening for events.\\[rs]n\");\n" "\\&\n" " while (1) {\n" " poll_num = poll(fds, nfds, -1);\n" " if (poll_num == -1) {\n" " if (errno == EINTR) /* Interrupted by a signal */\n" " continue; /* Restart poll() */\n" "\\&\n" " perror(\"poll\"); /* Unexpected error */\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (poll_num E 0) {\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" " /* Fanotify events are available. */\n" "\\&\n" " handle_events(fd);\n" " }\n" " }\n" " }\n" "\\&\n" " printf(\"Listening for events stopped.\\[rs]n\");\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "صفحات دليل لينكس (لم تصدر بعد)"