Debian Codegraph @

po/ar/man7/fanotify.7.po

raw
1 # Arabic translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # زايد السعيدي <[email protected]>, 2026.
5 msgid ""
6 msgstr ""
7 "Project-Id-Version: manpages-l10n 4.30.1\n"
8 "POT-Creation-Date: 2026-06-05 06:24+0200\n"
9 "PO-Revision-Date: 2026-05-11 17:44+0400\n"
10 "Last-Translator: Zayed Al-Saidi <[email protected]>\n"
11 "Language-Team: Arabic <[email protected]>\n"
12 "Language: ar\n"
13 "MIME-Version: 1.0\n"
14 "Content-Type: text/plain; charset=UTF-8\n"
15 "Content-Transfer-Encoding: 8bit\n"
16 "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
17 "&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
18 "X-Generator: Lokalize 23.08.5\n"
19
20 #. type: TH
21 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
22 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
23 #, no-wrap
24 msgid "fanotify"
25 msgstr "fanotify"
26
27 #. type: TH
28 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-14"
31 msgstr "14 فبراير 2026"
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr "صفحات دليل لينكس 6.18"
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr "الاسم"
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid "fanotify - monitoring filesystem events"
50 msgstr "fanotify - مراقبة أحداث نظام الملفات"
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "DESCRIPTION"
57 msgstr "الوصف"
58
59 #. type: Plain text
60 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
61 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
62 msgid ""
63 "The fanotify API provides notification and interception of filesystem "
64 "events. Use cases include virus scanning and hierarchical storage "
65 "management. In the original fanotify API, only a limited set of events was "
66 "supported. In particular, there was no support for create, delete, and move "
67 "events. The support for those events was added in Linux 5.1. (See "
68 "B<inotify>(7) for details of an API that did notify those events pre Linux "
69 "5.1.)"
70 msgstr ""
71 "توفر واجهة برمجة تطبيقات fanotify إشعارات واعتراضًا لأحداث نظام الملفات. تشمل "
72 "حالات الاستخدام فحص الفيروسات وإدارة التخزين الهرمي. في واجهة fanotify "
73 "الأصلية، دُعمت مجموعة محدودة فقط من الأحداث. على وجه الخصوص، لم يتوفر دعم "
74 "لأحداث الإنشاء والحذف والنقل. أُضيف الدعم لهذه الأحداث في لينكس 5.1. (انظر "
75 "B<inotify>(7) لتفاصيل واجهة برمجة التطبيقات التي كانت تُشعر بتلك الأحداث قبل "
76 "إصدار لينكس 5.1.)"
77
78 #. type: Plain text
79 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
80 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
81 msgid ""
82 "Additional capabilities compared to the B<inotify>(7) API include the "
83 "ability to monitor all of the objects in a mounted filesystem, the ability "
84 "to make access permission decisions, and the possibility to read or modify "
85 "files before access by other applications."
86 msgstr ""
87 "تشمل القدرات الإضافية مقارنة بواجهة B<inotify>(7) القدرة على مراقبة جميع "
88 "الكائنات في نظام ملفات موصول، والقدرة على اتخاذ قرارات أذونات الوصول، "
89 "وإمكانية قراءة الملفات أو تعديلها قبل وصول التطبيقات الأخرى إليها."
90
91 #. type: Plain text
92 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
93 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
94 msgid ""
95 "The following system calls are used with this API: B<fanotify_init>(2), "
96 "B<fanotify_mark>(2), B<read>(2), B<write>(2), and B<close>(2)."
97 msgstr ""
98 "تُستخدم استدعاءات النظام التالية مع هذه الواجهة: B<fanotify_init>(2)، و "
99 "B<fanotify_mark>(2)، و B<read>(2)، و B<write>(2)، و B<close>(2)."
100
101 #. type: SS
102 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
103 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
104 #, no-wrap
105 msgid "fanotify_init(), fanotify_mark(), and notification groups"
106 msgstr "fanotify_init()‎، و fanotify_mark()‎، ومجموعات الإشعارات"
107
108 #. type: Plain text
109 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
110 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
111 msgid ""
112 "The B<fanotify_init>(2) system call creates and initializes an fanotify "
113 "notification group and returns a file descriptor referring to it."
114 msgstr ""
115 "يُنشئ استدعاء النظام B<fanotify_init>(2) مجموعة إشعارات fanotify ويُهيئها "
116 "ويعيد واصف ملف يشير إليها."
117
118 #. type: Plain text
119 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
120 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
121 msgid ""
122 "An fanotify notification group is a kernel-internal object that holds a list "
123 "of files, directories, filesystems, and mounts for which events shall be "
124 "created."
125 msgstr ""
126 "مجموعة إشعارات fanotify هي كائن داخلي في النواة يحمل قائمة بالملفات، "
127 "والأدلة، وأنظمة الملفات، والوصولات التي يجب إنشاء أحداث لها."
128
129 #. type: Plain text
130 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
131 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
132 msgid ""
133 "For each entry in an fanotify notification group, two bit masks exist: the "
134 "I<mark> mask and the I<ignore> mask. The mark mask defines file activities "
135 "for which an event shall be created. The ignore mask defines activities for "
136 "which no event shall be generated. Having these two types of masks permits "
137 "a filesystem, mount, or directory to be marked for receiving events, while "
138 "at the same time ignoring events for specific objects under a mount or "
139 "directory."
140 msgstr ""
141 "لكل مدخلة في مجموعة إشعارات fanotify، يوجد قناعان من البتات: قناع I<mark> "
142 "وقناع I<ignore>. يحدد قناع العلامة (mark) أنشطة الملفات التي يجب إنشاء حدث "
143 "لها. ويحدد قناع التجاهل (ignore) الأنشطة التي لا يجب توليد أحداث لها. يسمح "
144 "وجود هذين النوعين من الأقنعة بوسم نظام ملفات أو وصلة أو دليل لاستلام "
145 "الأحداث، وفي الوقت نفسه تجاهل الأحداث لكائنات محددة تحت تلك الوصلة أو الدليل."
146
147 #. type: Plain text
148 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
149 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
150 msgid ""
151 "The B<fanotify_mark>(2) system call adds a file, directory, filesystem, or "
152 "mount to a notification group and specifies which events shall be reported "
153 "(or ignored), or removes or modifies such an entry."
154 msgstr ""
155 "يضيف استدعاء النظام B<fanotify_mark>(2) ملفًا أو دليلاً أو نظام ملفات أو وصلة "
156 "إلى مجموعة إشعارات ويحدد الأحداث التي يجب الإبلاغ عنها (أو تجاهلها)، أو يزيل "
157 "أو يعدل مثل هذه المدخلة."
158
159 #. type: Plain text
160 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
161 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
162 msgid ""
163 "A possible usage of the ignore mask is for a file cache. Events of interest "
164 "for a file cache are modification of a file and closing of the same. Hence, "
165 "the cached directory or mount is to be marked to receive these events. "
166 "After receiving the first event informing that a file has been modified, the "
167 "corresponding cache entry will be invalidated. No further modification "
168 "events for this file are of interest until the file is closed. Hence, the "
169 "modify event can be added to the ignore mask. Upon receiving the close "
170 "event, the modify event can be removed from the ignore mask and the file "
171 "cache entry can be updated."
172 msgstr ""
173 "من الاستخدامات الممكنة لقناع التجاهل هي خبيئة الملفات. الأحداث المهمة لخبيئة "
174 "الملفات هي تعديل الملف وإغلاقه. لذا، يوسم الدليل أو الوصلة المخبأة لاستلام "
175 "هذه الأحداث. بعد استلام أول حدث يفيد بتعديل ملف ما، ستُبطل مدخلة الخبيئة "
176 "المقابلة. لا تهم أي أحداث تعديل إضافية لهذا الملف حتى يُغلق. لذا، يمكن إضافة "
177 "حدث التعديل إلى قناع التجاهل. وعند استلام حدث الإغلاق، يمكن إزالة حدث "
178 "التعديل من قناع التجاهل وتحديث مدخلة خبيئة الملف."
179
180 #. type: Plain text
181 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
182 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
183 msgid ""
184 "The entries in the fanotify notification groups refer to files and "
185 "directories via their inode number and to mounts via their mount ID. If "
186 "files or directories are renamed or moved within the same mount, the "
187 "respective entries survive. If files or directories are deleted or moved to "
188 "another mount or if filesystems or mounts are unmounted, the corresponding "
189 "entries are deleted."
190 msgstr ""
191 "تشير المدخلات في مجموعات إشعارات fanotify إلى الملفات والأدلة عبر رقم inode "
192 "الخاص بها وإلى الوصلات عبر معرف الوصلة (mount ID). إذا أُعيدت تسمية الملفات "
193 "أو الأدلة أو نُقلت ضمن نفس الوصلة، فإن المدخلات المعنية تبقى. أما إذا حُذفت "
194 "الملفات أو الأدلة أو نُقلت إلى وصلة أخرى أو إذا فُصلت أنظمة الملفات أو "
195 "الوصلات، فستُحذف المدخلات المقابلة."
196
197 #. type: SS
198 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
199 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
200 #, no-wrap
201 msgid "The event queue"
202 msgstr "طابور الأحداث"
203
204 #. type: Plain text
205 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
206 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
207 msgid ""
208 "As events occur on the filesystem objects monitored by a notification group, "
209 "the fanotify system generates events that are collected in a queue. These "
210 "events can then be read (using B<read>(2) or similar) from the fanotify "
211 "file descriptor returned by B<fanotify_init>(2)."
212 msgstr ""
213 "عند وقوع أحداث على كائنات نظام الملفات المراقبة بواسطة مجموعة إشعارات، يولد "
214 "نظام fanotify أحداثًا تُجمع في طابور. يمكن بعد ذلك قراءة هذه الأحداث (باستخدام "
215 "B<read>(2) أو ما شابه) من واصف ملف fanotify الذي أعاده B<fanotify_init>(2)."
216
217 #. type: Plain text
218 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
219 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
220 msgid ""
221 "Two types of events are generated: I<notification> events and I<permission> "
222 "events. Notification events are merely informative and require no action to "
223 "be taken by the receiving application with one exception: if a valid file "
224 "descriptor is provided within a generic event, the file descriptor must be "
225 "closed. Permission events are requests to the receiving application to "
226 "decide whether permission for a file access shall be granted. For these "
227 "events, the recipient must write a response which decides whether access is "
228 "granted or not."
229 msgstr ""
230 "يولَّد نوعان من الأحداث: أحداث I<إشعار> وأحداث I<إذن>. أحداث الإشعار هي "
231 "معلوماتية فقط ولا تتطلب اتخاذ أي إجراء من قبل التطبيق المستلم باستثناء حالة "
232 "واحدة: إذا وُفر واصف ملف صالح ضمن حدث عام، فيجب إغلاق واصف الملف هذا. أحداث "
233 "الإذن هي طلبات للتطبيق المستلم ليقرر ما إذا كان سيُمنح إذن للوصول إلى الملف "
234 "أم لا. بالنسبة لهذه الأحداث، يجب على المستلم كتابة رد يقرر ما إذا كان سيُسمح "
235 "بالوصول أم لا."
236
237 #. type: Plain text
238 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
239 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
240 msgid ""
241 "An event is removed from the event queue of the fanotify group when it has "
242 "been read. Permission events that have been read are kept in an internal "
243 "list of the fanotify group until either a permission decision has been taken "
244 "by writing to the fanotify file descriptor or the fanotify file descriptor "
245 "is closed."
246 msgstr ""
247 "يُزال الحدث من طابور أحداث مجموعة fanotify عند قراءته. أحداث الإذن التي قُرئت "
248 "تُحفظ في قائمة داخلية لمجموعة fanotify حتى يتم اتخاذ قرار بشأن الإذن عن طريق "
249 "الكتابة إلى واصف ملف fanotify أو حتى يُغلق واصف ملف fanotify."
250
251 #. type: SS
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 #, no-wrap
255 msgid "Reading fanotify events"
256 msgstr "قراءة أحداث fanotify"
257
258 #. type: Plain text
259 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
260 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
261 msgid ""
262 "Calling B<read>(2) for the file descriptor returned by B<fanotify_init>(2) "
263 "blocks (if the flag B<FAN_NONBLOCK> is not specified in the call to "
264 "B<fanotify_init>(2)) until either a file event occurs or the call is "
265 "interrupted by a signal (see B<signal>(7))."
266 msgstr ""
267 "استدعاء B<read>(2) لواصف الملف الذي أعاده B<fanotify_init>(2) يحجب (إذا لم "
268 "يُحدد علم B<FAN_NONBLOCK> في استدعاء B<fanotify_init>(2)) حتى يقع حدث ملف أو "
269 "يُقاطع الاستدعاء بإشارة (انظر B<signal>(7))."
270
271 #. type: Plain text
272 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
273 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
274 msgid ""
275 "After a successful B<read>(2), the read buffer contains one or more of the "
276 "following structures:"
277 msgstr ""
278 "بعد نجاح B<read>(2)، ستحتوي مخبأة القراءة على بنية واحدة أو أكثر من البنى "
279 "التالية:"
280
281 #. type: Plain text
282 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
283 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
284 #, no-wrap
285 msgid ""
286 "struct fanotify_event_metadata {\n"
287 " __u32 event_len;\n"
288 " __u8 vers;\n"
289 " __u8 reserved;\n"
290 " __u16 metadata_len;\n"
291 " __aligned_u64 mask;\n"
292 " __s32 fd;\n"
293 " __s32 pid;\n"
294 "};\n"
295 msgstr ""
296 "struct fanotify_event_metadata {\n"
297 " __u32 event_len;\n"
298 " __u8 vers;\n"
299 " __u8 reserved;\n"
300 " __u16 metadata_len;\n"
301 " __aligned_u64 mask;\n"
302 " __s32 fd;\n"
303 " __s32 pid;\n"
304 "};\n"
305
306 #. type: Plain text
307 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
308 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
309 msgid ""
310 "Information records are supplemental pieces of information that may be "
311 "provided alongside the generic I<fanotify_event_metadata> structure. The "
312 "I<flags> passed to B<fanotify_init>(2) have influence over the type of "
313 "information records that may be returned for an event. For example, if a "
314 "notification group is initialized with B<FAN_REPORT_FID> or "
315 "B<FAN_REPORT_DIR_FID>, then event listeners should also expect to receive a "
316 "I<fanotify_event_info_fid> structure alongside the "
317 "I<fanotify_event_metadata> structure, whereby file handles are used to "
318 "identify filesystem objects rather than file descriptors. Information "
319 "records may also be stacked, meaning that using the various B<FAN_REPORT_*> "
320 "flags in conjunction with one another is supported. In such cases, multiple "
321 "information records can be returned for an event alongside the generic "
322 "I<fanotify_event_metadata> structure. For example, if a notification group "
323 "is initialized with B<FAN_REPORT_TARGET_FID> and B<FAN_REPORT_PIDFD>, then "
324 "an event listener should expect to receive up to two "
325 "I<fanotify_event_info_fid> information records and one "
326 "I<fanotify_event_info_pidfd> information record alongside the generic "
327 "I<fanotify_event_metadata> structure. Importantly, fanotify provides no "
328 "guarantee around the ordering of information records when a notification "
329 "group is initialized with a stacked based configuration. Each information "
330 "record has a nested structure of type I<fanotify_event_info_header>. It is "
331 "imperative for event listeners to inspect the I<info_type> field of this "
332 "structure in order to determine the type of information record that had been "
333 "received for a given event."
334 msgstr ""
335 "سجلات المعلومات هي قطع تكميلية من المعلومات التي قد تُوفر جنباً إلى جنب مع "
336 "بنية I<fanotify_event_metadata> العامة. تؤثر الـ I<flags> الممررة إلى "
337 "B<fanotify_init>(2) على نوع سجلات المعلومات التي قد تُعاد لحدث ما. على سبيل "
338 "المثال، إذا هُيئت مجموعة إشعارات باستخدام B<FAN_REPORT_FID> أو "
339 "B<FAN_REPORT_DIR_FID>، فيجب على مستمعي الأحداث توقع استلام بنية "
340 "I<fanotify_event_info_fid> مع بنية I<fanotify_event_metadata>، حيث تُستخدم "
341 "مقابض الملفات لتحديد كائنات نظام الملفات بدلاً من واصفات الملفات. يمكن أيضًا "
342 "تكديم سجلات المعلومات، مما يعني أن استخدام أعلام B<FAN_REPORT_*> المتنوعة مع "
343 "بعضها البعض أمر مدعوم. في هذه الحالات، يمكن إعادة سجلات معلومات متعددة لحدث "
344 "ما. على سبيل المثال، إذا هُيئت مجموعة إشعارات باستخدام "
345 "B<FAN_REPORT_TARGET_FID> و B<FAN_REPORT_PIDFD>، فيجب على مستمع الأحداث توقع "
346 "استلام ما يصل إلى سجلي معلومات I<fanotify_event_info_fid> وسجل معلومات "
347 "I<fanotify_event_info_pidfd> واحد. والأهم من ذلك، لا يوفر fanotify أي ضمانات "
348 "حول ترتيب سجلات المعلومات عند تهيئة مجموعة إشعارات بتكوين مكدس. لكل سجل "
349 "معلومات بنية متداخلة من نوع I<fanotify_event_info_header>. من الضروري "
350 "لمستمعي الأحداث فحص حقل I<info_type> في هذه البنية لتحديد نوع سجل المعلومات "
351 "الذي استُلم لحدث معين."
352
353 #. type: Plain text
354 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
355 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
356 msgid ""
357 "In cases where an fanotify group identifies filesystem objects by file "
358 "handles, event listeners should also expect to receive one or more of the "
359 "below information record objects alongside the generic "
360 "I<fanotify_event_metadata> structure within the read buffer:"
361 msgstr ""
362 "في الحالات التي تحدد فيها مجموعة fanotify كائنات نظام الملفات عن طريق مقابض "
363 "الملفات، يجب على مستمعي الأحداث أيضًا توقع استلام واحد أو أكثر من كائنات سجل "
364 "المعلومات أدناه مع بنية I<fanotify_event_metadata> العامة داخل مخبأة القراءة:"
365
366 #. type: Plain text
367 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
368 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
369 #, no-wrap
370 msgid ""
371 "struct fanotify_event_info_fid {\n"
372 " struct fanotify_event_info_header hdr;\n"
373 " __kernel_fsid_t fsid;\n"
374 " unsigned char handle[];\n"
375 "};\n"
376 msgstr ""
377 "struct fanotify_event_info_fid {\n"
378 " struct fanotify_event_info_header hdr;\n"
379 " __kernel_fsid_t fsid;\n"
380 " unsigned char handle[];\n"
381 "};\n"
382
383 #. type: Plain text
384 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
385 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
386 msgid ""
387 "In cases where an fanotify group is initialized with B<FAN_REPORT_PIDFD>, "
388 "event listeners should expect to receive the below information record object "
389 "alongside the generic I<fanotify_event_metadata> structure within the read "
390 "buffer:"
391 msgstr ""
392 "في الحالات التي تُهيأ فيها مجموعة fanotify باستخدام B<FAN_REPORT_PIDFD>، يجب "
393 "على مستمعي الأحداث توقع استلام كائن سجل المعلومات أدناه مع بنية "
394 "I<fanotify_event_metadata> العامة داخل مخبأة القراءة:"
395
396 #. type: Plain text
397 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
398 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
399 #, no-wrap
400 msgid ""
401 "struct fanotify_event_info_pidfd {\n"
402 " struct fanotify_event_info_header hdr;\n"
403 " __s32 pidfd;\n"
404 "};\n"
405 msgstr ""
406 "struct fanotify_event_info_pidfd {\n"
407 " struct fanotify_event_info_header hdr;\n"
408 " __s32 pidfd;\n"
409 "};\n"
410
411 #. type: Plain text
412 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
413 #: opensuse-tumbleweed
414 msgid ""
415 "In cases where an fanotify group is initialized with B<FAN_REPORT_MNT>, "
416 "event listeners should expect to receive the below information record object "
417 "alongside the generic I<fanotify_event_metadata> structure within the read "
418 "buffer. This structure is defined as follows:"
419 msgstr ""
420 "في الحالات التي تُهيأ فيها مجموعة fanotify باستخدام B<FAN_REPORT_MNT>، يجب "
421 "على مستمعي الأحداث توقع استلام كائن سجل المعلومات أدناه مع بنية "
422 "I<fanotify_event_metadata> العامة داخل مخبأة القراءة. تُعرف هذه البنية "
423 "كالتالي:"
424
425 #. type: Plain text
426 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
427 #: opensuse-tumbleweed
428 #, no-wrap
429 msgid ""
430 "struct fanotify_event_info_mnt {\n"
431 " struct fanotify_event_info_header hdr;\n"
432 " __u64 mnt_id;\n"
433 "};\n"
434 msgstr ""
435 "struct fanotify_event_info_mnt {\n"
436 " struct fanotify_event_info_header hdr;\n"
437 " __u64 mnt_id;\n"
438 "};\n"
439
440 #. type: Plain text
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 msgid ""
444 "In case of a B<FAN_FS_ERROR> event, an additional information record "
445 "describing the error that occurred is returned alongside the generic "
446 "I<fanotify_event_metadata> structure within the read buffer. This structure "
447 "is defined as follows:"
448 msgstr ""
449 "في حالة حدث B<FAN_FS_ERROR>، يُعاد سجل معلومات إضافي يصف الخطأ الذي حدث مع "
450 "بنية I<fanotify_event_metadata> العامة داخل مخبأة القراءة. تُعرف هذه البنية "
451 "كالتالي:"
452
453 #. type: Plain text
454 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
455 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
456 #, no-wrap
457 msgid ""
458 "struct fanotify_event_info_error {\n"
459 " struct fanotify_event_info_header hdr;\n"
460 " __s32 error;\n"
461 " __u32 error_count;\n"
462 "};\n"
463 msgstr ""
464 "struct fanotify_event_info_error {\n"
465 " struct fanotify_event_info_header hdr;\n"
466 " __s32 error;\n"
467 " __u32 error_count;\n"
468 "};\n"
469
470 #. type: Plain text
471 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
472 #: opensuse-tumbleweed
473 msgid ""
474 "In case of B<FAN_PRE_ACCESS> events, an additional information record "
475 "describing the access range is returned alongside the generic "
476 "I<fanotify_event_metadata> structure within the read buffer. This structure "
477 "is defined as follows:"
478 msgstr ""
479 "في حالة أحداث B<FAN_PRE_ACCESS>، يُعاد سجل معلومات إضافي يصف نطاق الوصول مع "
480 "بنية I<fanotify_event_metadata> العامة داخل مخبأة القراءة. تُعرف هذه البنية "
481 "كالتالي:"
482
483 #. type: Plain text
484 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
485 #: opensuse-tumbleweed
486 #, no-wrap
487 msgid ""
488 "struct fanotify_event_info_range {\n"
489 " struct fanotify_event_info_header hdr;\n"
490 " __u32 pad;\n"
491 " __u64 offset;\n"
492 " __u64 count;\n"
493 "};\n"
494 msgstr ""
495 "struct fanotify_event_info_range {\n"
496 " struct fanotify_event_info_header hdr;\n"
497 " __u32 pad;\n"
498 " __u64 offset;\n"
499 " __u64 count;\n"
500 "};\n"
501
502 #. type: Plain text
503 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
504 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
505 msgid ""
506 "All information records contain a nested structure of type "
507 "I<fanotify_event_info_header>. This structure holds meta-information about "
508 "the information record that may have been returned alongside the generic "
509 "I<fanotify_event_metadata> structure. This structure is defined as follows:"
510 msgstr ""
511 "تحتوي جميع سجلات المعلومات على بنية متداخلة من نوع "
512 "I<fanotify_event_info_header>. تحمل هذه البنية معلومات وصفية حول سجل "
513 "المعلومات الذي قد يكون قد أعيد مع بنية I<fanotify_event_metadata> العامة. "
514 "تُعرف هذه البنية كالتالي:"
515
516 #. type: Plain text
517 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
518 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
519 #, no-wrap
520 msgid ""
521 "struct fanotify_event_info_header {\n"
522 "\t__u8 info_type;\n"
523 "\t__u8 pad;\n"
524 "\t__u16 len;\n"
525 "};\n"
526 msgstr ""
527 "struct fanotify_event_info_header {\n"
528 "\t__u8 info_type;\n"
529 "\t__u8 pad;\n"
530 "\t__u16 len;\n"
531 "};\n"
532
533 #. type: Plain text
534 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
535 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
536 msgid ""
537 "For performance reasons, it is recommended to use a large buffer size (for "
538 "example, 4096 bytes), so that multiple events can be retrieved by a single "
539 "B<read>(2)."
540 msgstr ""
541 "لأسباب تتعلق بالأداء، يوصى باستخدام حجم مخبأة كبير (على سبيل المثال، 4096 "
542 "بايت)، بحيث يمكن جلب أحداث متعددة من خلال استدعاء B<read>(2) واحد."
543
544 #. type: Plain text
545 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
546 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
547 msgid ""
548 "The return value of B<read>(2) is the number of bytes placed in the buffer, "
549 "or -1 in case of an error (but see BUGS)."
550 msgstr ""
551 "قيمة الإرجاع لـ B<read>(2) هي عدد البايتات التي وُضعت في المخبأة، أو -1 في "
552 "حالة حدوث خطأ (لكن انظر قسم BUGS)."
553
554 #. type: Plain text
555 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
556 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
557 msgid "The fields of the I<fanotify_event_metadata> structure are as follows:"
558 msgstr "حقول بنية I<fanotify_event_metadata> هي كما يلي:"
559
560 #. type: TP
561 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
562 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
563 #, no-wrap
564 msgid "I<event_len>"
565 msgstr "I<event_len>"
566
567 #. type: Plain text
568 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
569 #: opensuse-leap-16-1 opensuse-tumbleweed
570 msgid ""
571 "This is the size of the data for the current event and the offset to the "
572 "next event in the buffer. Unless the group identifies filesystem objects by "
573 "file handles, the value of I<event_len> is always "
574 "B<FAN_EVENT_METADATA_LEN>. For a group that identifies filesystem objects "
575 "by file handles, I<event_len> also includes the variable size file "
576 "identifier records."
577 msgstr ""
578 "هذا هو حجم بيانات الحدث الحالي والإزاحة إلى الحدث التالي في المخبأة. ما لم "
579 "تحدد المجموعة كائنات نظام الملفات عن طريق مقابض الملفات، فإن قيمة "
580 "I<event_len> هي دائماً B<FAN_EVENT_METADATA_LEN>. بالنسبة للمجموعة التي تحدد "
581 "كائنات نظام الملفات عن طريق مقابض الملفات، فإن I<event_len> يشمل أيضًا سجلات "
582 "معرف الملف ذات الحجم المتغير."
583
584 #. type: TP
585 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
586 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
587 #, no-wrap
588 msgid "I<vers>"
589 msgstr "I<vers>"
590
591 #. type: Plain text
592 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
593 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
594 msgid ""
595 "This field holds a version number for the structure. It must be compared to "
596 "B<FANOTIFY_METADATA_VERSION> to verify that the structures returned at run "
597 "time match the structures defined at compile time. In case of a mismatch, "
598 "the application should abandon trying to use the fanotify file descriptor."
599 msgstr ""
600 "يحمل هذا الحقل رقم إصدار البنية. يجب مقارنته بـ B<FANOTIFY_METADATA_VERSION> "
601 "للتحقق من أن البنى التي أُعيدت في وقت التشغيل تطابق البنى المحددة في وقت "
602 "التصريف. في حالة عدم التطابق، يجب على التطبيق التخلي عن محاولة استخدام واصف "
603 "ملف fanotify."
604
605 #. type: TP
606 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
607 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
608 #, no-wrap
609 msgid "I<reserved>"
610 msgstr "I<reserved>"
611
612 #. type: Plain text
613 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
614 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
615 msgid "This field is not used."
616 msgstr "هذا الحقل غير مستخدم."
617
618 #. type: TP
619 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
620 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
621 #, no-wrap
622 msgid "I<metadata_len>"
623 msgstr "I<metadata_len>"
624
625 #. type: Plain text
626 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
627 #: opensuse-leap-16-1 opensuse-tumbleweed
628 msgid ""
629 "This is the size of the structure. The field was introduced to facilitate "
630 "the implementation of optional headers per event type. No such optional "
631 "headers exist in the current implementation."
632 msgstr ""
633 "هذا هو حجم البنية. قُدم هذا الحقل لتسهيل تنفيذ ترويسات اختيارية لكل نوع حدث. "
634 "لا توجد مثل هذه الترويسات الاختيارية في التنفيذ الحالي."
635
636 #. type: TP
637 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
638 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
639 #, no-wrap
640 msgid "I<mask>"
641 msgstr "I<mask>"
642
643 #. type: Plain text
644 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
645 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
646 msgid "This is a bit mask describing the event (see below)."
647 msgstr "هذا قناع بتات يصف الحدث (انظر أدناه)."
648
649 #. type: TP
650 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
651 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
652 #, no-wrap
653 msgid "I<fd>"
654 msgstr "I<fd>"
655
656 #. type: Plain text
657 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
658 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
659 msgid ""
660 "This is an open file descriptor for the object being accessed, or "
661 "B<FAN_NOFD> if a queue overflow occurred. With an fanotify group that "
662 "identifies filesystem objects by file handles, applications should expect "
663 "this value to be set to B<FAN_NOFD> for each event that is received. The "
664 "file descriptor can be used to access the contents of the monitored file or "
665 "directory. The reading application is responsible for closing this file "
666 "descriptor."
667 msgstr ""
668 "هذا واصف ملف مفتوح للكائن الذي يتم الوصول إليه، أو B<FAN_NOFD> في حالة حدوث "
669 "طوفان في الطابور. مع مجموعة fanotify التي تحدد كائنات نظام الملفات عن طريق "
670 "مقابض الملفات، يجب أن تتوقع التطبيقات ضبط هذه القيمة على B<FAN_NOFD> لكل حدث "
671 "يُستلم. يمكن استخدام واصف الملف للوصول إلى محتويات الملف أو الدليل المراقب. "
672 "التطبيق القارئ مسؤول عن إغلاق واصف الملف هذا."
673
674 #. type: Plain text
675 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
676 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
677 msgid ""
678 "When calling B<fanotify_init>(2), the caller may specify (via the "
679 "I<event_f_flags> argument) various file status flags that are to be set on "
680 "the open file description that corresponds to this file descriptor. In "
681 "addition, the (kernel-internal) B<FMODE_NONOTIFY> file status flag is set "
682 "on the open file description. This flag suppresses fanotify event "
683 "generation. Hence, when the receiver of the fanotify event accesses the "
684 "notified file or directory using this file descriptor, no additional events "
685 "will be created."
686 msgstr ""
687 "عند استدعاء B<fanotify_init>(2)، قد يحدد المستدعِي (عبر وسيط "
688 "I<event_f_flags>) أعلام حالة ملف متنوعة ليتم ضبطها على وصف الملف المفتوح "
689 "الذي يقابل واصف الملف هذا. بالإضافة إلى ذلك، يُضبط علم حالة الملف "
690 "B<FMODE_NONOTIFY> (الداخلي للنواة) على وصف الملف المفتوح. هذا العلم يكبح "
691 "توليد أحداث fanotify. ومن ثم، عندما يصل مستلم حدث fanotify إلى الملف أو "
692 "الدليل المُشعر به باستخدام واصف الملف هذا، لن تُنشأ أي أحداث إضافية."
693
694 #. type: Plain text
695 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
696 #: opensuse-tumbleweed
697 msgid ""
698 "When an fanotify group is initialized using B<FAN_REPORT_FD_ERROR>, this "
699 "field will contain a negative error value in case a file descriptor could "
700 "not be opened and in case of a queue overflow, the value will be B<-EBADF>."
701 msgstr ""
702 "عند تهيئة مجموعة fanotify باستخدام B<FAN_REPORT_FD_ERROR>، سيحتوي هذا الحقل "
703 "على قيمة خطأ سالبة في حالة تعذر فتح واصف ملف، وفي حالة طوفان الطابور، ستكون "
704 "القيمة B<-EBADF>."
705
706 #. type: TP
707 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
708 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
709 #, no-wrap
710 msgid "I<pid>"
711 msgstr "I<pid>"
712
713 #. type: Plain text
714 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
715 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
716 msgid ""
717 "If flag B<FAN_REPORT_TID> was set in B<fanotify_init>(2), this is the TID of "
718 "the thread that caused the event. Otherwise, this the PID of the process "
719 "that caused the event."
720 msgstr ""
721 "إذا ضُبط العلم B<FAN_REPORT_TID> في B<fanotify_init>(2)، فهذا هو معرف الخيط "
722 "(TID) للخيط الذي تسبب في الحدث. وإلا، فهذا هو معرف العملية (PID) للعملية "
723 "التي تسببت في الحدث."
724
725 #. type: Plain text
726 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
727 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
728 msgid ""
729 "A program listening to fanotify events can compare this PID to the PID "
730 "returned by B<getpid>(2), to determine whether the event is caused by the "
731 "listener itself, or is due to a file access by another process."
732 msgstr ""
733 "يمكن لبرنامج يستمع إلى أحداث fanotify مقارنة معرف العملية (PID) هذا بالمعرف "
734 "الذي يعيده B<getpid>(2)، لتحديد ما إذا كان الحدث ناتجاً عن المستمع نفسه، أو "
735 "بسبب وصول لملف من قبل عملية أخرى."
736
737 #. type: Plain text
738 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
739 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
740 msgid ""
741 "The bit mask in I<mask> indicates which events have occurred for a single "
742 "filesystem object. Multiple bits may be set in this mask, if more than one "
743 "event occurred for the monitored filesystem object. In particular, "
744 "consecutive events for the same filesystem object and originating from the "
745 "same process may be merged into a single event, with the exception that two "
746 "permission events are never merged into one queue entry."
747 msgstr ""
748 "يشير قناع البتات في I<mask> إلى الأحداث التي وقعت لكائن نظام ملفات واحد. قد "
749 "تُضبط بتات متعددة في هذا القناع إذا وقع أكثر من حدث لكائن نظام الملفات "
750 "المراقب. على وجه الخصوص، قد تُدمج الأحداث المتتالية لنفس كائن نظام الملفات "
751 "والناتجة عن نفس العملية في حدث واحد، باستثناء أحداث الإذن حيث لا تُدمج أبداً "
752 "في مدخلة طابور واحدة."
753
754 #. type: Plain text
755 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
756 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
757 msgid "The bits that may appear in I<mask> are as follows:"
758 msgstr "البتات التي قد تظهر في I<mask> هي كما يلي:"
759
760 #. type: TP
761 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
762 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
763 #, no-wrap
764 msgid "B<FAN_ACCESS>"
765 msgstr "B<FAN_ACCESS>"
766
767 #. type: Plain text
768 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
769 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
770 msgid "A file or a directory (but see BUGS) was accessed (read)."
771 msgstr "وُصل إلى ملف أو دليل (قراءة) (لكن انظر قسم BUGS)."
772
773 #. type: TP
774 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
775 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
776 #, no-wrap
777 msgid "B<FAN_OPEN>"
778 msgstr "B<FAN_OPEN>"
779
780 #. type: Plain text
781 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
782 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
783 msgid "A file or a directory was opened."
784 msgstr "فُتح ملف أو دليل."
785
786 #. type: TP
787 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
788 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
789 #, no-wrap
790 msgid "B<FAN_OPEN_EXEC>"
791 msgstr "B<FAN_OPEN_EXEC>"
792
793 #. type: Plain text
794 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
795 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
796 msgid ""
797 "A file was opened with the intent to be executed. See NOTES in "
798 "B<fanotify_mark>(2) for additional details."
799 msgstr ""
800 "فُتح ملف بقصد تنفيذه. انظر قسم NOTES في B<fanotify_mark>(2) لمزيد من التفاصيل."
801
802 #. type: TP
803 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
804 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
805 #, no-wrap
806 msgid "B<FAN_ATTRIB>"
807 msgstr "B<FAN_ATTRIB>"
808
809 #. type: Plain text
810 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
811 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
812 msgid "A file or directory metadata was changed."
813 msgstr "غُيرت البيانات الوصفية لملف أو دليل."
814
815 #. type: TP
816 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
817 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
818 #, no-wrap
819 msgid "B<FAN_CREATE>"
820 msgstr "B<FAN_CREATE>"
821
822 #. type: Plain text
823 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
824 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
825 msgid "A child file or directory was created in a watched parent."
826 msgstr "أُنشئ ملف أو دليل ابن في دليل أب مراقب."
827
828 #. type: TP
829 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
830 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
831 #, no-wrap
832 msgid "B<FAN_DELETE>"
833 msgstr "B<FAN_DELETE>"
834
835 #. type: Plain text
836 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
837 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
838 msgid "A child file or directory was deleted in a watched parent."
839 msgstr "حُذف ملف أو دليل ابن في دليل أب مراقب."
840
841 #. type: TP
842 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
843 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
844 #, no-wrap
845 msgid "B<FAN_DELETE_SELF>"
846 msgstr "B<FAN_DELETE_SELF>"
847
848 #. type: Plain text
849 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
850 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
851 msgid "A watched file or directory was deleted."
852 msgstr "حُذف ملف أو دليل مراقب."
853
854 #. type: TP
855 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
856 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
857 #, no-wrap
858 msgid "B<FAN_RENAME>"
859 msgstr "B<FAN_RENAME>"
860
861 #. type: Plain text
862 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
863 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
864 msgid ""
865 "A file or directory has been moved to or from a watched parent directory."
866 msgstr "نُقل ملف أو دليل من أو إلى دليل أب مراقب."
867
868 #. type: TP
869 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
870 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
871 #, no-wrap
872 msgid "B<FAN_MOVED_FROM>"
873 msgstr "B<FAN_MOVED_FROM>"
874
875 #. type: Plain text
876 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
877 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
878 msgid "A file or directory has been moved from a watched parent directory."
879 msgstr "نُقل ملف أو دليل من دليل أب مراقب."
880
881 #. type: TP
882 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
883 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
884 #, no-wrap
885 msgid "B<FAN_MOVED_TO>"
886 msgstr "B<FAN_MOVED_TO>"
887
888 #. type: Plain text
889 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
890 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
891 msgid "A file or directory has been moved to a watched parent directory."
892 msgstr "نُقل ملف أو دليل إلى دليل أب مراقب."
893
894 #. type: TP
895 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
896 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
897 #, no-wrap
898 msgid "B<FAN_MOVE_SELF>"
899 msgstr "B<FAN_MOVE_SELF>"
900
901 #. type: Plain text
902 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
903 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
904 msgid "A watched file or directory was moved."
905 msgstr "نُقل ملف أو دليل مراقب."
906
907 #. type: TP
908 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
909 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
910 #, no-wrap
911 msgid "B<FAN_MODIFY>"
912 msgstr "B<FAN_MODIFY>"
913
914 #. type: Plain text
915 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
916 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
917 msgid "A file was modified."
918 msgstr "عُدل ملف."
919
920 #. type: TP
921 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
922 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
923 #, no-wrap
924 msgid "B<FAN_CLOSE_WRITE>"
925 msgstr "B<FAN_CLOSE_WRITE>"
926
927 #. type: Plain text
928 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
929 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
930 msgid ""
931 "A file that was opened for writing (B<O_WRONLY> or B<O_RDWR>) was closed."
932 msgstr "أُغلق ملف كان مفتوحاً للكتابة (B<O_WRONLY> أو B<O_RDWR>)."
933
934 #. type: TP
935 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
936 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
937 #, no-wrap
938 msgid "B<FAN_CLOSE_NOWRITE>"
939 msgstr "B<FAN_CLOSE_NOWRITE>"
940
941 #. type: Plain text
942 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
943 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
944 msgid ""
945 "A file or directory that was opened read-only (B<O_RDONLY>) was closed."
946 msgstr "أُغلق ملف أو دليل كان مفتوحاً للقراءة فقط (B<O_RDONLY>)."
947
948 #. type: TP
949 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
950 #: opensuse-tumbleweed
951 #, no-wrap
952 msgid "B<FAN_MNT_ATTACH>"
953 msgstr "B<FAN_MNT_ATTACH>"
954
955 #. type: Plain text
956 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
957 #: opensuse-tumbleweed
958 msgid "A mount was attached to mount namespace."
959 msgstr "وُصلت وصلة بمساحة أسماء الوصل."
960
961 #. type: TP
962 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
963 #: opensuse-tumbleweed
964 #, no-wrap
965 msgid "B<FAN_MNT_DETACH>"
966 msgstr "B<FAN_MNT_DETACH>"
967
968 #. type: Plain text
969 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
970 #: opensuse-tumbleweed
971 msgid "A mount was detached from mount namespace."
972 msgstr "فُصلت وصلة من مساحة أسماء الوصل."
973
974 #. type: TP
975 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
976 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
977 #, no-wrap
978 msgid "B<FAN_FS_ERROR>"
979 msgstr "B<FAN_FS_ERROR>"
980
981 #. type: Plain text
982 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
983 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
984 msgid "A filesystem error was detected."
985 msgstr "كُشف عن خطأ في نظام الملفات."
986
987 #. type: TP
988 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
989 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
990 #, no-wrap
991 msgid "B<FAN_Q_OVERFLOW>"
992 msgstr "B<FAN_Q_OVERFLOW>"
993
994 #. type: Plain text
995 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
996 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
997 msgid ""
998 "The event queue exceeded the limit on number of events. This limit can be "
999 "overridden by specifying the B<FAN_UNLIMITED_QUEUE> flag when calling "
1000 "B<fanotify_init>(2)."
1001 msgstr ""
1002 "تجاوز طابور الأحداث الحد المسموح به لعدد الأحداث. يمكن تخطي هذا الحد عن طريق "
1003 "تحديد علم B<FAN_UNLIMITED_QUEUE> عند استدعاء B<fanotify_init>(2)."
1004
1005 #. type: TP
1006 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1007 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1008 #, no-wrap
1009 msgid "B<FAN_ACCESS_PERM>"
1010 msgstr "B<FAN_ACCESS_PERM>"
1011
1012 #. type: Plain text
1013 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1014 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1015 msgid ""
1016 "An application wants to read a file or directory, for example using "
1017 "B<read>(2) or B<readdir>(2). The reader must write a response (as "
1018 "described below) that determines whether the permission to access the "
1019 "filesystem object shall be granted."
1020 msgstr ""
1021 "يريد تطبيق قراءة ملف أو دليل، على سبيل المثال باستخدام B<read>(2) أو "
1022 "B<readdir>(2). يجب على القارئ كتابة رد (كما هو موضح أدناه) يحدد ما إذا كان "
1023 "سيُمنح إذن للوصول إلى كائن نظام الملفات."
1024
1025 #. type: TP
1026 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1027 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1028 #, no-wrap
1029 msgid "B<FAN_OPEN_PERM>"
1030 msgstr "B<FAN_OPEN_PERM>"
1031
1032 #. type: Plain text
1033 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1034 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1035 msgid ""
1036 "An application wants to open a file or directory. The reader must write a "
1037 "response that determines whether the permission to open the filesystem "
1038 "object shall be granted."
1039 msgstr ""
1040 "يريد تطبيق فتح ملف أو دليل. يجب على القارئ كتابة رد يحدد ما إذا كان سيُمنح "
1041 "إذن لفتح كائن نظام الملفات."
1042
1043 #. type: TP
1044 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1045 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1046 #, no-wrap
1047 msgid "B<FAN_OPEN_EXEC_PERM>"
1048 msgstr "B<FAN_OPEN_EXEC_PERM>"
1049
1050 #. type: Plain text
1051 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1052 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1053 msgid ""
1054 "An application wants to open a file for execution. The reader must write a "
1055 "response that determines whether the permission to open the filesystem "
1056 "object for execution shall be granted. See NOTES in B<fanotify_mark>(2) "
1057 "for additional details."
1058 msgstr ""
1059 "يريد تطبيق ما فتح ملف للتنفيذ. يجب على القارئ كتابة استجابة تحدد ما إذا كان "
1060 "سيُمنح إذن فتح كائن نظام الملفات للتنفيذ. راجع الملاحظات (NOTES) في "
1061 "B<fanotify_mark>(2) لمزيد من التفاصيل."
1062
1063 #. type: Plain text
1064 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1065 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1066 msgid "To check for any close event, the following bit mask may be used:"
1067 msgstr "للتحقق من أي حدث إغلاق، يمكن استخدام قناع البتات التالي:"
1068
1069 #. type: TP
1070 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1071 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1072 #, no-wrap
1073 msgid "B<FAN_CLOSE>"
1074 msgstr "B<FAN_CLOSE>"
1075
1076 #. type: Plain text
1077 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1078 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1079 msgid "A file was closed. This is a synonym for:"
1080 msgstr "أُغلق ملف. هذا مرادف لـ:"
1081
1082 #. type: Plain text
1083 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1084 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1085 #, no-wrap
1086 msgid "FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE\n"
1087 msgstr "FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE\n"
1088
1089 #. type: Plain text
1090 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1091 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1092 msgid "To check for any move event, the following bit mask may be used:"
1093 msgstr "للتحقق من أي حدث نقل، يمكن استخدام قناع البتات التالي:"
1094
1095 #. type: TP
1096 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1097 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1098 #, no-wrap
1099 msgid "B<FAN_MOVE>"
1100 msgstr "B<FAN_MOVE>"
1101
1102 #. type: Plain text
1103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1105 msgid "A file or directory was moved. This is a synonym for:"
1106 msgstr "نُقل ملف أو دليل. هذا مرادف لـ:"
1107
1108 #. type: Plain text
1109 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1110 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1111 #, no-wrap
1112 msgid "FAN_MOVED_FROM | FAN_MOVED_TO\n"
1113 msgstr "FAN_MOVED_FROM | FAN_MOVED_TO\n"
1114
1115 #. type: Plain text
1116 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1117 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1118 msgid ""
1119 "The following bits may appear in I<mask> only in conjunction with other "
1120 "event type bits:"
1121 msgstr ""
1122 "قد تظهر البتات التالية في I<mask> فقط بالاقتران مع بتات أنواع أحداث أخرى:"
1123
1124 #. type: TP
1125 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1126 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1127 #, no-wrap
1128 msgid "B<FAN_ONDIR>"
1129 msgstr "B<FAN_ONDIR>"
1130
1131 #. type: Plain text
1132 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1133 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1134 msgid ""
1135 "The events described in the I<mask> have occurred on a directory object. "
1136 "Reporting events on directories requires setting this flag in the mark "
1137 "mask. See B<fanotify_mark>(2) for additional details. The B<FAN_ONDIR> "
1138 "flag is reported in an event mask only if the fanotify group identifies "
1139 "filesystem objects by file handles."
1140 msgstr ""
1141 "الأحداث الموضحة في I<mask> وقعت على كائن دليل. يتطلب الإبلاغ عن الأحداث في "
1142 "الأدلة ضبط هذه الراية في قناع العلامة. راجع B<fanotify_mark>(2) لمزيد من "
1143 "التفاصيل. يُبلغ عن الراية B<FAN_ONDIR> في قناع الحدث فقط إذا كانت مجموعة "
1144 "fanotify تحدد كائنات نظام الملفات عن طريق مقابض الملفات."
1145
1146 #. type: Plain text
1147 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1148 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1149 msgid ""
1150 "Information records that are supplied alongside the generic "
1151 "I<fanotify_event_metadata> structure will always contain a nested structure "
1152 "of type I<fanotify_event_info_header>. The fields of the "
1153 "I<fanotify_event_info_header> are as follows:"
1154 msgstr ""
1155 "سجلات المعلومات التي تُوفر جنباً إلى جنب مع هيكل I<fanotify_event_metadata> "
1156 "العام ستحتوي دائماً على هيكل متداخل من نوع I<fanotify_event_info_header>. "
1157 "حقول I<fanotify_event_info_header> هي كما يلي:"
1158
1159 #. type: TP
1160 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1161 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1162 #, no-wrap
1163 msgid "I<info_type>"
1164 msgstr "I<info_type>"
1165
1166 #. type: Plain text
1167 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1168 #: opensuse-tumbleweed
1169 msgid ""
1170 "A unique integer value representing the type of information record object "
1171 "received for an event. The value of this field can be set to one of the "
1172 "following."
1173 msgstr ""
1174 "قيمة عددية فريدة تمثل نوع كائن سجل المعلومات المُستلم لحدث ما. يمكن ضبط قيمة "
1175 "هذا الحقل على أحد الخيارات التالية."
1176
1177 #. type: TP
1178 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1179 #: opensuse-tumbleweed
1180 #, no-wrap
1181 msgid "B<FAN_EVENT_INFO_TYPE_FID>"
1182 msgstr "B<FAN_EVENT_INFO_TYPE_FID>"
1183
1184 #. type: TQ
1185 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1186 #: opensuse-tumbleweed
1187 #, no-wrap
1188 msgid "B<FAN_EVENT_INFO_TYPE_DFID>"
1189 msgstr "B<FAN_EVENT_INFO_TYPE_DFID>"
1190
1191 #. type: TQ
1192 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1193 #: opensuse-tumbleweed
1194 #, no-wrap
1195 msgid "B<FAN_EVENT_INFO_TYPE_DFID_NAME>"
1196 msgstr "B<FAN_EVENT_INFO_TYPE_DFID_NAME>"
1197
1198 #. type: TQ
1199 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1200 #: opensuse-tumbleweed
1201 #, no-wrap
1202 msgid "B<FAN_EVENT_INFO_TYPE_PIDFD>"
1203 msgstr "B<FAN_EVENT_INFO_TYPE_PIDFD>"
1204
1205 #. type: TQ
1206 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1207 #: opensuse-tumbleweed
1208 #, no-wrap
1209 msgid "B<FAN_EVENT_INFO_TYPE_ERROR>"
1210 msgstr "B<FAN_EVENT_INFO_TYPE_ERROR>"
1211
1212 #. type: TQ
1213 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1214 #: opensuse-tumbleweed
1215 #, no-wrap
1216 msgid "B<FAN_EVENT_INFO_TYPE_RANGE>"
1217 msgstr "B<FAN_EVENT_INFO_TYPE_RANGE>"
1218
1219 #. type: TQ
1220 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1221 #: opensuse-tumbleweed
1222 #, no-wrap
1223 msgid "B<FAN_EVENT_INFO_TYPE_MNT>"
1224 msgstr "B<FAN_EVENT_INFO_TYPE_MNT>"
1225
1226 #. type: Plain text
1227 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1228 #: opensuse-tumbleweed
1229 msgid ""
1230 "The value set for this field is dependent on the flags that have been "
1231 "supplied to B<fanotify_init>(2). Refer to the field details of each "
1232 "information record object type below to understand the different cases in "
1233 "which the I<info_type> values can be set."
1234 msgstr ""
1235 "تعتمد القيمة المضبوطة لهذا الحقل على الرايات التي تم تزويدها لـ "
1236 "B<fanotify_init>(2). ارجع إلى تفاصيل الحقول لكل نوع كائن سجل معلومات أدناه "
1237 "لفهم الحالات المختلفة التي يمكن فيها ضبط قيم I<info_type>."
1238
1239 #. type: TP
1240 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1241 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1242 #, no-wrap
1243 msgid "I<pad>"
1244 msgstr "I<pad>"
1245
1246 #. type: Plain text
1247 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1248 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1249 msgid ""
1250 "This field is currently not used by any information record object type and "
1251 "therefore is set to zero."
1252 msgstr ""
1253 "هذا الحقل غير مُستخدم حالياً من قبل أي نوع كائن سجل معلومات، ولذلك يُضبط على "
1254 "الصفر."
1255
1256 #. type: TP
1257 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1258 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1259 #, no-wrap
1260 msgid "I<len>"
1261 msgstr "I<len>"
1262
1263 #. type: Plain text
1264 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1265 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1266 msgid ""
1267 "The value of I<len> is set to the size of the information record object, "
1268 "including the I<fanotify_event_info_header>. The total size of all "
1269 "additional information records is not expected to be larger than "
1270 "(I<event_len> - I<metadata_len>)."
1271 msgstr ""
1272 "تُضبط قيمة I<len> على حجم كائن سجل المعلومات، بما في ذلك "
1273 "I<fanotify_event_info_header>. لا يُتوقع أن يكون الحجم الإجمالي لجميع سجلات "
1274 "المعلومات الإضافية أكبر من (I<event_len> - I<metadata_len>)."
1275
1276 #. type: Plain text
1277 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1278 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1279 msgid "The fields of the I<fanotify_event_info_fid> structure are as follows:"
1280 msgstr "حقول هيكل I<fanotify_event_info_fid> هي كما يلي:"
1281
1282 #. type: TP
1283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1285 #, no-wrap
1286 msgid "I<hdr>"
1287 msgstr "I<hdr>"
1288
1289 #. type: Plain text
1290 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1291 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1292 msgid ""
1293 "This is a structure of type I<fanotify_event_info_header>. For example, "
1294 "when an fanotify file descriptor is created using B<FAN_REPORT_FID>, a "
1295 "single information record is expected to be attached to the event with "
1296 "I<info_type> field value of B<FAN_EVENT_INFO_TYPE_FID>. When an fanotify "
1297 "file descriptor is created using the combination of B<FAN_REPORT_FID> and "
1298 "B<FAN_REPORT_DIR_FID>, there may be two information records attached to the "
1299 "event: one with I<info_type> field value of B<FAN_EVENT_INFO_TYPE_DFID>, "
1300 "identifying a parent directory object, and one with I<info_type> field value "
1301 "of B<FAN_EVENT_INFO_TYPE_FID>, identifying a child object. Note that for "
1302 "the directory entry modification events B<FAN_CREATE>, B<FAN_DELETE>, "
1303 "B<FAN_MOVE>, and B<FAN_RENAME>, an information record identifying the "
1304 "created/deleted/moved child object is reported only if an fanotify group was "
1305 "initialized with the flag B<FAN_REPORT_TARGET_FID>."
1306 msgstr ""
1307 "هذا هيكل من نوع I<fanotify_event_info_header>. على سبيل المثال، عندما يُنشأ "
1308 "واصف ملف fanotify باستخدام B<FAN_REPORT_FID>، يُتوقع إرفاق سجل معلومات واحد "
1309 "بالحدث مع قيمة حقل I<info_type> هي B<FAN_EVENT_INFO_TYPE_FID>. عندما يُنشأ "
1310 "واصف ملف fanotify باستخدام مزيج من B<FAN_REPORT_FID> و "
1311 "B<FAN_REPORT_DIR_FID>، قد يكون هناك سجلان للمعلومات مرفقان بالحدث: أحدهما "
1312 "بقيمة حقل I<info_type> هي B<FAN_EVENT_INFO_TYPE_DFID>، للتعريف بكائن دليل "
1313 "أب، والآخر بقيمة حقل I<info_type> هي B<FAN_EVENT_INFO_TYPE_FID>، للتعريف "
1314 "بكائن ابن. لاحظ أنه بالنسبة لأحداث تعديل مدخلات الدليل B<FAN_CREATE> و "
1315 "B<FAN_DELETE> و B<FAN_MOVE> و B<FAN_RENAME>، لا يُبلغ عن سجل معلومات يحدد "
1316 "الكائن الابن المنشأ/المحذوف/المنقول إلا إذا بُدئت مجموعة fanotify باستخدام "
1317 "الراية B<FAN_REPORT_TARGET_FID>."
1318
1319 #. type: TP
1320 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1321 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1322 #, no-wrap
1323 msgid "I<fsid>"
1324 msgstr "I<fsid>"
1325
1326 #. type: Plain text
1327 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1328 #: opensuse-leap-16-1 opensuse-tumbleweed
1329 msgid ""
1330 "This is a unique identifier of the filesystem containing the object "
1331 "associated with the event. It is a structure of type I<__kernel_fsid_t> and "
1332 "contains the same value as I<f_fsid> when calling B<statfs>(2). Note that "
1333 "some filesystems (e.g., B<fuse>(4)) report zero I<fsid>. In these cases, "
1334 "it is not possible to use I<fsid> to associate the event with a specific "
1335 "filesystem instance, so monitoring different filesystem instances that "
1336 "report zero I<fsid> with the same fanotify group is not supported."
1337 msgstr ""
1338 "هذا معرف فريد لنظام الملفات الذي يحتوي على الكائن المرتبط بالحدث. هو هيكل من "
1339 "نوع I<__kernel_fsid_t> ويحتوي على نفس قيمة I<f_fsid> عند استدعاء "
1340 "B<statfs>(2). لاحظ أن بعض أنظمة الملفات (مثل B<fuse>(4)) تبلغ عن I<fsid> "
1341 "بصفر. في هذه الحالات، لا يمكن استخدام I<fsid> لربط الحدث بمثيل معين لنظام "
1342 "الملفات، لذا فإن مراقبة مثيلات أنظمة ملفات مختلفة تبلغ عن I<fsid> بصفر "
1343 "باستخدام نفس مجموعة fanotify غير مدعومة."
1344
1345 #. type: TP
1346 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1347 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1348 #, no-wrap
1349 msgid "I<handle>"
1350 msgstr "I<handle>"
1351
1352 #. type: Plain text
1353 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1354 #: opensuse-leap-16-1 opensuse-tumbleweed
1355 msgid ""
1356 "This field contains a variable-size structure of type I<struct "
1357 "file_handle>. It is an opaque handle that corresponds to a specified object "
1358 "on a filesystem as returned by B<name_to_handle_at>(2). It can be used to "
1359 "uniquely identify a file on a filesystem and can be passed as an argument to "
1360 "B<open_by_handle_at>(2). If the value of I<info_type> field is "
1361 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the file handle is followed by a null "
1362 "terminated string that identifies the created/deleted/moved directory entry "
1363 "name. For other events such as B<FAN_OPEN>, B<FAN_ATTRIB>, "
1364 "B<FAN_DELETE_SELF>, and B<FAN_MOVE_SELF>, if the value of I<info_type> field "
1365 "is B<FAN_EVENT_INFO_TYPE_FID>, the I<handle> identifies the object "
1366 "correlated to the event. If the value of I<info_type> field is "
1367 "B<FAN_EVENT_INFO_TYPE_DFID>, the I<handle> identifies the directory object "
1368 "correlated to the event or the parent directory of a non-directory object "
1369 "correlated to the event. If the value of I<info_type> field is "
1370 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the I<handle> identifies the same "
1371 "directory object that would be reported with B<FAN_EVENT_INFO_TYPE_DFID> and "
1372 "the file handle is followed by a null terminated string that identifies the "
1373 "name of a directory entry in that directory, or '.' to identify the "
1374 "directory object itself."
1375 msgstr ""
1376 "يحتوي هذا الحقل على هيكل متغير الحجم من نوع I<struct file_handle>. هو مقبض "
1377 "مبهم يتوافق مع كائن محدد في نظام ملفات كما يعيده B<name_to_handle_at>(2). "
1378 "يمكن استخدامه لتعريف ملف بشكل فريد في نظام ملفات ويمكن تمريره كمعامل لـ "
1379 "B<open_by_handle_at>(2). إذا كانت قيمة حقل I<info_type> هي "
1380 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>، يتبع مقبض الملف سلسلة نصية منتهية بصفر "
1381 "تحدد اسم مدخل الدليل المنشأ/المحذوف/المنقول. بالنسبة للأحداث الأخرى مثل "
1382 "B<FAN_OPEN> و B<FAN_ATTRIB> و B<FAN_DELETE_SELF> و B<FAN_MOVE_SELF>، إذا "
1383 "كانت قيمة حقل I<info_type> هي B<FAN_EVENT_INFO_TYPE_FID>، فإن I<handle> يحدد "
1384 "الكائن المرتبط بالحدث. إذا كانت قيمة حقل I<info_type> هي "
1385 "B<FAN_EVENT_INFO_TYPE_DFID>، فإن I<handle> يحدد كائن الدليل المرتبط بالحدث "
1386 "أو الدليل الأب لكائن ليس دليلاً ومرتبط بالحدث. إذا كانت قيمة حقل I<info_type> "
1387 "هي B<FAN_EVENT_INFO_TYPE_DFID_NAME>، فإن I<handle> يحدد نفس كائن الدليل الذي "
1388 "سيُبلغ عنه باستخدام B<FAN_EVENT_INFO_TYPE_DFID>، ويتبع مقبض الملف سلسلة نصية "
1389 "منتهية بصفر تحدد اسم مدخل الدليل في ذلك الدليل، أو '.' لتعريف كائن الدليل "
1390 "نفسه."
1391
1392 #. type: Plain text
1393 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1394 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1395 msgid ""
1396 "The fields of the I<fanotify_event_info_pidfd> structure are as follows:"
1397 msgstr "حقول هيكل I<fanotify_event_info_pidfd> هي كما يلي:"
1398
1399 #. type: Plain text
1400 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1401 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1402 msgid ""
1403 "This is a structure of type I<fanotify_event_info_header>. When an fanotify "
1404 "group is initialized using B<FAN_REPORT_PIDFD>, the I<info_type> field value "
1405 "of the I<fanotify_event_info_header> is set to B<FAN_EVENT_INFO_TYPE_PIDFD>."
1406 msgstr ""
1407 "هذا هيكل من نوع I<fanotify_event_info_header>. عندما تُبدأ مجموعة fanotify "
1408 "باستخدام B<FAN_REPORT_PIDFD>، تُضبط قيمة حقل I<info_type> في "
1409 "I<fanotify_event_info_header> على B<FAN_EVENT_INFO_TYPE_PIDFD>."
1410
1411 #. type: TP
1412 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1413 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1414 #, no-wrap
1415 msgid "I<pidfd>"
1416 msgstr "I<pidfd>"
1417
1418 #. type: Plain text
1419 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1420 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1421 msgid ""
1422 "This is a process file descriptor that refers to the process responsible for "
1423 "generating the event. The returned process file descriptor is no different "
1424 "from one which could be obtained manually if B<pidfd_open>(2) were to be "
1425 "called on I<fanotify_event_metadata.pid>. In the instance that an error is "
1426 "encountered during pidfd creation, one of two possible error types "
1427 "represented by a negative integer value may be returned in this I<pidfd> "
1428 "field. In cases where the process responsible for generating the event has "
1429 "terminated prior to the event listener being able to read events from the "
1430 "notification queue, B<FAN_NOPIDFD> is returned. The pidfd creation for an "
1431 "event is only performed at the time the events are read from the "
1432 "notification queue. All other possible pidfd creation failures are "
1433 "represented by B<FAN_EPIDFD>. Once the event listener has dealt with an "
1434 "event and the pidfd is no longer required, the pidfd should be closed via "
1435 "B<close>(2)."
1436 msgstr ""
1437 "هذا واصف ملف عملية يشير إلى العملية المسؤولة عن توليد الحدث. واصف ملف "
1438 "العملية المُعاد لا يختلف عن ذلك الذي يمكن الحصول عليه يدوياً إذا استدعي "
1439 "B<pidfd_open>(2) على I<fanotify_event_metadata.pid>. في حالة مواجهة خطأ "
1440 "أثناء إنشاء pidfd، قد يُعاد أحد نوعي أخطاء محتملين ممثلين بقيمة صحيحة سالبة "
1441 "في حقل I<pidfd> هذا. في الحالات التي تنتهي فيها العملية المسؤولة عن توليد "
1442 "الحدث قبل أن يتمكن مستمع الأحداث من قراءة الأحداث من طابور الإشعارات، يُعاد "
1443 "B<FAN_NOPIDFD>. يُنفذ إنشاء pidfd للحدث فقط في وقت قراءة الأحداث من طابور "
1444 "الإشعارات. تُمثل جميع إخفاقات إنشاء pidfd المحتملة الأخرى بـ B<FAN_EPIDFD>. "
1445 "بمجرد أن يتعامل مستمع الحدث مع الحدث ولم يعد الـ pidfd مطلوباً، يجب إغلاق الـ "
1446 "pidfd عبر B<close>(2)."
1447
1448 #. type: Plain text
1449 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1450 #: opensuse-tumbleweed
1451 msgid ""
1452 "When an fanotify group is initialized using B<FAN_REPORT_FD_ERROR>, this "
1453 "field will contain a negative error value in case a pidfd creation failure "
1454 "and in case of a terminated process, the value will be B<-ESRCH>."
1455 msgstr ""
1456 "عند بدء مجموعة fanotify باستخدام B<FAN_REPORT_FD_ERROR>، سيحتوي هذا الحقل "
1457 "على قيمة خطأ سالبة في حالة فشل إنشاء pidfd وفي حالة العملية المنتهية، ستكون "
1458 "القيمة B<-ESRCH>."
1459
1460 #. type: Plain text
1461 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1462 #: opensuse-tumbleweed
1463 msgid "The fields of the I<fanotify_event_info_mnt> structure are as follows:"
1464 msgstr "حقول هيكل I<fanotify_event_info_mnt> هي كما يلي:"
1465
1466 #. type: TP
1467 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1468 #: opensuse-tumbleweed
1469 #, no-wrap
1470 msgid "I<.hdr>"
1471 msgstr "I<.hdr>"
1472
1473 #. type: Plain text
1474 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1475 #: opensuse-tumbleweed
1476 msgid ""
1477 "This is a structure of type I<fanotify_event_info_header>. The I<."
1478 "info_type> field is set to B<FAN_EVENT_INFO_TYPE_MNT>."
1479 msgstr ""
1480 "هذا هيكل من نوع I<fanotify_event_info_header>. يُضبط حقل I<.info_type> على "
1481 "B<FAN_EVENT_INFO_TYPE_MNT>."
1482
1483 #. type: TP
1484 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1485 #: opensuse-tumbleweed
1486 #, no-wrap
1487 msgid "I<.mnt_id>"
1488 msgstr "I<.mnt_id>"
1489
1490 #. type: Plain text
1491 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1492 #: opensuse-tumbleweed
1493 msgid ""
1494 "Identifies the mount associated with the event. It is a 64-bit unique mount "
1495 "id as the one returned by B<statx>(2) with the B<STATX_MNT_ID_UNIQUE> flag."
1496 msgstr ""
1497 "يحدد الوصل المرتبط بالحدث. هو معرف وصل فريد 64-بت كالذي يعيده B<statx>(2) مع "
1498 "الراية B<STATX_MNT_ID_UNIQUE>."
1499
1500 #. type: Plain text
1501 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1502 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1503 msgid ""
1504 "The fields of the I<fanotify_event_info_error> structure are as follows:"
1505 msgstr "حقول هيكل I<fanotify_event_info_error> هي كما يلي:"
1506
1507 #. type: Plain text
1508 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1509 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1510 msgid ""
1511 "This is a structure of type I<fanotify_event_info_header>. The I<info_type> "
1512 "field is set to B<FAN_EVENT_INFO_TYPE_ERROR>."
1513 msgstr ""
1514 "هذا هيكل من نوع I<fanotify_event_info_header>. يُضبط حقل I<info_type> على "
1515 "B<FAN_EVENT_INFO_TYPE_ERROR>."
1516
1517 #. type: TP
1518 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1519 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1520 #, no-wrap
1521 msgid "I<error>"
1522 msgstr "I<error>"
1523
1524 #. type: Plain text
1525 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1526 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1527 msgid "Identifies the type of error that occurred."
1528 msgstr "يحدد نوع الخطأ الذي حدث."
1529
1530 #. type: TP
1531 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1532 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1533 #, no-wrap
1534 msgid "I<error_count>"
1535 msgstr "I<error_count>"
1536
1537 #. type: Plain text
1538 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1539 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1540 msgid ""
1541 "This is a counter of the number of errors suppressed since the last error "
1542 "was read."
1543 msgstr "هذا عداد لعدد الأخطاء التي كُتمت منذ آخر قراءة للخطأ."
1544
1545 #. type: Plain text
1546 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1547 #: opensuse-tumbleweed
1548 msgid ""
1549 "The fields of the I<fanotify_event_info_range> structure are as follows:"
1550 msgstr "حقول هيكل I<fanotify_event_info_range> هي كما يلي:"
1551
1552 #. type: Plain text
1553 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1554 #: opensuse-tumbleweed
1555 msgid ""
1556 "This is a structure of type I<fanotify_event_info_header>. The I<info_type> "
1557 "field is set to B<FAN_EVENT_INFO_TYPE_RANGE>."
1558 msgstr ""
1559 "هذا هيكل من نوع I<fanotify_event_info_header>. يُضبط حقل I<info_type> على "
1560 "B<FAN_EVENT_INFO_TYPE_RANGE>."
1561
1562 #. type: TP
1563 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1564 #: opensuse-tumbleweed
1565 #, no-wrap
1566 msgid "I<count>"
1567 msgstr "I<count>"
1568
1569 #. type: Plain text
1570 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1571 #: opensuse-tumbleweed
1572 msgid "The number of bytes being read or written to the file."
1573 msgstr "عدد البايتات التي تُقرأ أو تُكتب في الملف."
1574
1575 #. type: TP
1576 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1577 #: opensuse-tumbleweed
1578 #, no-wrap
1579 msgid "I<offset>"
1580 msgstr "I<offset>"
1581
1582 #. type: Plain text
1583 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1584 #: opensuse-tumbleweed
1585 msgid "The offset from which bytes are read or written to the file."
1586 msgstr "الإزاحة التي تُقرأ منها أو تُكتب فيها البايتات في الملف."
1587
1588 #. type: Plain text
1589 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1590 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1591 msgid ""
1592 "The following macros are provided to iterate over a buffer containing "
1593 "fanotify event metadata returned by a B<read>(2) from an fanotify file "
1594 "descriptor:"
1595 msgstr ""
1596 "تتوفر وحدات الماكرو التالية للتكرار عبر مخزن يحتوي على بيانات وصفية لأحداث "
1597 "fanotify أعادها B<read>(2) من واصف ملف fanotify:"
1598
1599 #. type: TP
1600 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1601 #: opensuse-leap-16-1 opensuse-tumbleweed
1602 #, no-wrap
1603 msgid "B<FAN_EVENT_OK(meta, size)>"
1604 msgstr "B<FAN_EVENT_OK(meta, size)>"
1605
1606 #. type: Plain text
1607 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1608 #: opensuse-leap-16-1 opensuse-tumbleweed
1609 msgid ""
1610 "This macro checks the remaining size I<size> of the buffer I<meta> against "
1611 "the size of the metadata structure and the I<event_len> field of the first "
1612 "metadata structure in the buffer."
1613 msgstr ""
1614 "يتحقق هذا الماكرو من الحجم المتبقي I<size> للمخزن I<meta> مقابل حجم هيكل "
1615 "البيانات الوصفية وحقل I<event_len> لأول هيكل بيانات وصفية في المخزن."
1616
1617 #. type: TP
1618 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1619 #: opensuse-leap-16-1 opensuse-tumbleweed
1620 #, no-wrap
1621 msgid "B<FAN_EVENT_NEXT(meta, size)>"
1622 msgstr "B<FAN_EVENT_NEXT(meta, size)>"
1623
1624 #. type: Plain text
1625 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1626 #: opensuse-leap-16-1 opensuse-tumbleweed
1627 msgid ""
1628 "This macro uses the size indicated in the I<event_len> field of the metadata "
1629 "structure pointed to by I<meta> to calculate the address of the next "
1630 "metadata structure that follows I<meta>. I<size> is the number of bytes of "
1631 "metadata that currently remain in the buffer. The macro returns a pointer "
1632 "to the next metadata structure that follows I<meta>, and reduces I<size> by "
1633 "the number of bytes in the metadata structure that has been skipped over (i."
1634 "e., it subtracts I<meta-E<gt>event_len> from I<size>)."
1635 msgstr ""
1636 "يستخدم هذا الماكرو الحجم المشار إليه في حقل I<event_len> لهيكل البيانات "
1637 "الوصفية الذي يشير إليه I<meta> لحساب عنوان هيكل البيانات الوصفية التالي الذي "
1638 "يلي I<meta>. يمثل I<size> عدد بايتات البيانات الوصفية المتبقية حالياً في "
1639 "المخزن. يعيد الماكرو مؤشراً إلى هيكل البيانات الوصفية التالي الذي يلي "
1640 "I<meta>، ويقلل I<size> بمقدار عدد البايتات في هيكل البيانات الوصفية الذي "
1641 "تُخطي (أي يطرح I<meta-E<gt>event_len> من I<size>)."
1642
1643 #. type: Plain text
1644 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1645 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1646 msgid "In addition, there is:"
1647 msgstr "بالإضافة إلى ذلك، هناك:"
1648
1649 #. type: TP
1650 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1651 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1652 #, no-wrap
1653 msgid "B<FAN_EVENT_METADATA_LEN>"
1654 msgstr "B<FAN_EVENT_METADATA_LEN>"
1655
1656 #. type: Plain text
1657 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1658 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1659 msgid ""
1660 "This macro returns the size (in bytes) of the structure "
1661 "I<fanotify_event_metadata>. This is the minimum size (and currently the "
1662 "only size) of any event metadata."
1663 msgstr ""
1664 "يعيد هذا الماكرو حجم (بالبايتات) الهيكل I<fanotify_event_metadata>. هذا هو "
1665 "الحد الأدنى للحجم (والحجم الوحيد حالياً) لأي بيانات وصفية للحدث."
1666
1667 #. type: SS
1668 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1669 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1670 #, no-wrap
1671 msgid "Monitoring an fanotify file descriptor for events"
1672 msgstr "مراقبة واصف ملف fanotify بحثاً عن أحداث"
1673
1674 #. type: Plain text
1675 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1676 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1677 msgid ""
1678 "When an fanotify event occurs, the fanotify file descriptor indicates as "
1679 "readable when passed to B<epoll>(7), B<poll>(2), or B<select>(2)."
1680 msgstr ""
1681 "عند وقوع حدث fanotify، يشير واصف ملف fanotify إلى أنه قابل للقراءة عند "
1682 "تمريره إلى B<epoll>(7) أو B<poll>(2) أو B<select>(2)."
1683
1684 #. type: SS
1685 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1686 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1687 #, no-wrap
1688 msgid "Dealing with permission events"
1689 msgstr "التعامل مع أحداث الأذونات"
1690
1691 #. type: Plain text
1692 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1693 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1694 msgid ""
1695 "For permission events, the application must B<write>(2) a structure of the "
1696 "following form to the fanotify file descriptor:"
1697 msgstr ""
1698 "بالنسبة لأحداث الأذونات، يجب على التطبيق استدعاء B<write>(2) لهيكل بالشكل "
1699 "التالي في واصف ملف fanotify:"
1700
1701 #. type: Plain text
1702 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1703 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1704 #, no-wrap
1705 msgid ""
1706 "struct fanotify_response {\n"
1707 " __s32 fd;\n"
1708 " __u32 response;\n"
1709 "};\n"
1710 msgstr ""
1711 "struct fanotify_response {\n"
1712 " __s32 fd;\n"
1713 " __u32 response;\n"
1714 "};\n"
1715
1716 #. type: Plain text
1717 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1718 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1719 msgid "The fields of this structure are as follows:"
1720 msgstr "حقول هذا الهيكل هي كالتالي:"
1721
1722 #. type: Plain text
1723 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1724 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1725 msgid ""
1726 "This is the file descriptor from the structure I<fanotify_event_metadata>."
1727 msgstr "هذا هو واصف الملف من الهيكل I<fanotify_event_metadata>."
1728
1729 #. type: TP
1730 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1731 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1732 #, no-wrap
1733 msgid "I<response>"
1734 msgstr "I<response>"
1735
1736 #. type: Plain text
1737 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1738 #: opensuse-tumbleweed
1739 msgid ""
1740 "This field indicates whether or not the permission is to be granted. Its "
1741 "value must contain either the flag B<FAN_ALLOW> to allow the file operation "
1742 "or B<FAN_DENY> to deny the file operation."
1743 msgstr ""
1744 "يشير هذا الحقل إلى ما إذا كان سيُمنح الإذن أم لا. يجب أن تحتوي قيمته إما على "
1745 "الراية B<FAN_ALLOW> للسماح بعملية الملف أو B<FAN_DENY> لرفضها."
1746
1747 #. commit b4b2ff4f61ded819bfa22e50fdec7693f51cbbee
1748 #. type: Plain text
1749 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1750 #: opensuse-tumbleweed
1751 msgid ""
1752 "If access is denied, the requesting application call will receive an "
1753 "B<EPERM> error. Since Linux 6.13, if a notification group is initialized "
1754 "with class B<FAN_CLASS_PRE_CONTENT>, the file operation can be denied with "
1755 "errors other than B<EPERM>. For example, for the requesting application to "
1756 "get the B<EIO> error, the event listener can write the response "
1757 "B<FAN_DENY_ERRNO>(B<EIO>). At the time of writing, only the following error "
1758 "values could be returned to the application with "
1759 "B<FAN_DENY_ERRNO>(\\f[I]e\\fR) macro: B<EPERM>, B<EIO>, B<EBUSY>, "
1760 "B<ETXTBSY>, B<EAGAIN>, B<ENOSPC>, B<EDQUOT>."
1761 msgstr ""
1762 "إذا رُفض الوصول، سيتلقى استدعاء التطبيق الطالب خطأ B<EPERM>. منذ لينكس 6.13، "
1763 "إذا بُدئت مجموعة إشعارات بالفئة B<FAN_CLASS_PRE_CONTENT>، يمكن رفض عملية "
1764 "الملف بأخطاء غير B<EPERM>. على سبيل المثال، لكي يحصل التطبيق الطالب على خطأ "
1765 "B<EIO>، يمكن لمستمع الحدث كتابة الاستجابة B<FAN_DENY_ERRNO>(B<EIO>). في وقت "
1766 "الكتابة، يمكن إعادة قيم الأخطاء التالية فقط إلى التطبيق باستخدام ماكرو "
1767 "B<FAN_DENY_ERRNO>(\\f[I]e\\fR): B<EPERM> و B<EIO> و B<EBUSY> و B<ETXTBSY> و "
1768 "B<EAGAIN> و B<ENOSPC> و B<EDQUOT>."
1769
1770 #. type: Plain text
1771 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1772 #: opensuse-tumbleweed
1773 msgid ""
1774 "Additionally, if the notification group has been created with the "
1775 "B<FAN_ENABLE_AUDIT> flag, then the B<FAN_AUDIT> flag can be set in the "
1776 "I<response> field. In that case, the audit subsystem will log information "
1777 "about the access decision to the audit logs."
1778 msgstr ""
1779 "بالإضافة إلى ذلك، إذا أُنشئت مجموعة الإشعارات مع الراية B<FAN_ENABLE_AUDIT>، "
1780 "فيمكن حينئذٍ ضبط الراية B<FAN_AUDIT> في حقل I<response>. في هذه الحالة، سيقوم "
1781 "نظام التدقيق الفرعي بتسجيل معلومات حول قرار الوصول في سجلات التدقيق."
1782
1783 #. commit 70529a199574c15a40f46b14256633b02ba10ca2
1784 #. type: Plain text
1785 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1786 #: opensuse-tumbleweed
1787 msgid ""
1788 "Since Linux 6.3, the B<FAN_INFO> flag can be set in the I<.response> field. "
1789 "It indicates that an extra variable-length response record follows the "
1790 "I<fanotify_response> structure. Extra response records start with a common "
1791 "header:"
1792 msgstr ""
1793 "منذ لينكس 6.3، يمكن ضبط الراية B<FAN_INFO> في حقل I<.response>. تشير هذه "
1794 "الراية إلى أن سجل استجابة إضافي متغير الطول يتبع هيكل I<fanotify_response>. "
1795 "تبدأ سجلات الاستجابة الإضافية بترويسة مشتركة:"
1796
1797 #. type: Plain text
1798 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1799 #: opensuse-tumbleweed
1800 #, no-wrap
1801 msgid ""
1802 "struct fanotify_response_info_header {\n"
1803 " __u8 type;\n"
1804 " __u8 pad;\n"
1805 " __u16 len;\n"
1806 "};\n"
1807 msgstr ""
1808 "struct fanotify_response_info_header {\n"
1809 " __u8 type;\n"
1810 " __u8 pad;\n"
1811 " __u16 len;\n"
1812 "};\n"
1813
1814 #. type: Plain text
1815 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1816 #: opensuse-tumbleweed
1817 msgid ""
1818 "The value of I<.type> determines the format of the extra response record."
1819 msgstr "تحدد قيمة I<.type> تنسيق سجل الاستجابة الإضافي."
1820
1821 #. type: TP
1822 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1823 #: opensuse-tumbleweed
1824 #, no-wrap
1825 msgid "B<FAN_RESPONSE_INFO_AUDIT_RULE>"
1826 msgstr "B<FAN_RESPONSE_INFO_AUDIT_RULE>"
1827
1828 #. type: Plain text
1829 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1830 #: opensuse-tumbleweed
1831 msgid ""
1832 "The following response record is expected with extra details for the audit "
1833 "log:"
1834 msgstr "يُتوقع سجل الاستجابة التالي مع تفاصيل إضافية لسجل التدقيق:"
1835
1836 #. type: Plain text
1837 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1838 #: opensuse-tumbleweed
1839 #, no-wrap
1840 msgid ""
1841 "struct fanotify_response_info_audit_rule {\n"
1842 " struct fanotify_response_info_header hdr;\n"
1843 " __u32 rule_number;\n"
1844 " __u32 subj_trust;\n"
1845 " __u32 obj_trust;\n"
1846 "};\n"
1847 msgstr ""
1848 "struct fanotify_response_info_audit_rule {\n"
1849 " struct fanotify_response_info_header hdr;\n"
1850 " __u32 rule_number;\n"
1851 " __u32 subj_trust;\n"
1852 " __u32 obj_trust;\n"
1853 "};\n"
1854
1855 #. type: SS
1856 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1857 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1858 #, no-wrap
1859 msgid "Monitoring filesystems for errors"
1860 msgstr "مراقبة أنظمة الملفات بحثاً عن أخطاء"
1861
1862 #. type: Plain text
1863 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1864 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1865 msgid ""
1866 "A single B<FAN_FS_ERROR> event is stored per filesystem at once. Extra "
1867 "error messages are suppressed and accounted for in the I<error_count> field "
1868 "of the existing B<FAN_FS_ERROR> event record, but details about the errors "
1869 "are lost."
1870 msgstr ""
1871 "يُخزن حدث B<FAN_FS_ERROR> واحد لكل نظام ملفات في المرة الواحدة. تُكتم رسائل "
1872 "الأخطاء الإضافية وتُحسب في حقل I<error_count> لسجل حدث B<FAN_FS_ERROR> "
1873 "الموجود، ولكن تُفقد تفاصيل تلك الأخطاء."
1874
1875 #. type: Plain text
1876 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1877 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1878 msgid ""
1879 "Errors reported by B<FAN_FS_ERROR> are generic I<errno> values, but not all "
1880 "kinds of error types are reported by all filesystems."
1881 msgstr ""
1882 "الأخطاء التي يبلغ عنها B<FAN_FS_ERROR> هي قيم I<errno> عامة، ولكن لا يُبلغ عن "
1883 "جميع أنواع الأخطاء من قبل جميع أنظمة الملفات."
1884
1885 #. type: Plain text
1886 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1887 #: opensuse-tumbleweed
1888 msgid ""
1889 "Errors not directly related to a file (i.e., super block corruption) are "
1890 "reported with an invalid I<handle>. For these errors, the I<handle> will "
1891 "have the field I<handle_type> set to B<FILEID_INVALID>, and the handle "
1892 "buffer size set to B<0>."
1893 msgstr ""
1894 "الأخطاء غير المرتبطة مباشرة بملف (أي تلف الكتلة الفائقة) يُبلغ عنها بـ "
1895 "I<handle> غير صالح. لهذه الأخطاء، سيُضبط حقل I<handle_type> في I<handle> على "
1896 "B<FILEID_INVALID>، ويُضبط حجم مخزن المقبض على B<0>."
1897
1898 #. type: SS
1899 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1900 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1901 #, no-wrap
1902 msgid "Closing the fanotify file descriptor"
1903 msgstr "إغلاق واصف ملف fanotify"
1904
1905 #. type: Plain text
1906 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1907 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1908 msgid ""
1909 "When all file descriptors referring to the fanotify notification group are "
1910 "closed, the fanotify group is released and its resources are freed for reuse "
1911 "by the kernel. Upon B<close>(2), outstanding permission events will be set "
1912 "to allowed."
1913 msgstr ""
1914 "عند إغلاق جميع واصفات الملفات التي تشير إلى مجموعة إشعارات fanotify، تُحرر "
1915 "مجموعة fanotify وتُخلى مواردها ليعيد الـ kernel استخدامها. عند B<close>(2)، "
1916 "ستُضبط أحداث الأذونات المعلقة على مسموح بها."
1917
1918 #. type: SS
1919 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1920 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1921 #, no-wrap
1922 msgid "/proc interfaces"
1923 msgstr "واجهات /proc"
1924
1925 #. type: Plain text
1926 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1927 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1928 msgid ""
1929 "The file I</proc/>pidI</fdinfo/>fd contains information about fanotify marks "
1930 "for file descriptor I<fd> of process I<pid>. See B<proc>(5) for details."
1931 msgstr ""
1932 "يحتوي الملف I</proc/>pidI</fdinfo/>fd على معلومات حول علامات fanotify لواصف "
1933 "الملف I<fd> للعملية I<pid>. راجع B<proc>(5) للتفاصيل."
1934
1935 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
1936 #. type: Plain text
1937 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1938 #: opensuse-leap-16-1 opensuse-tumbleweed
1939 msgid ""
1940 "Since Linux 5.13 (and 5.10.220), the following interfaces can be used to "
1941 "control the amount of kernel resources consumed by fanotify:"
1942 msgstr ""
1943 "منذ لينكس 5.13 (و 5.10.220)، يمكن استخدام الواجهات التالية للتحكم في كمية "
1944 "موارد الـ kernel التي يستهلكها fanotify:"
1945
1946 #. type: TP
1947 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1948 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1949 #, no-wrap
1950 msgid "I</proc/sys/fs/fanotify/max_queued_events>"
1951 msgstr "I</proc/sys/fs/fanotify/max_queued_events>"
1952
1953 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
1954 #. type: Plain text
1955 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1956 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1957 msgid ""
1958 "The value in this file is used when an application calls "
1959 "B<fanotify_init>(2) to set an upper limit on the number of events that can "
1960 "be queued to the corresponding fanotify group. Events in excess of this "
1961 "limit are dropped, but an B<FAN_Q_OVERFLOW> event is always generated. "
1962 "Prior to Linux kernel 5.13, the hardcoded limit was 16384 events."
1963 msgstr ""
1964 "تُستخدم القيمة الموجودة في هذا الملف عندما يستدعي تطبيق ما "
1965 "B<fanotify_init>(2) لضبط حد أقصى لعدد الأحداث التي يمكن وضعها في طابور "
1966 "مجموعة fanotify المقابلة. تُسقط الأحداث التي تتجاوز هذا الحد، ولكن يُولد دائماً "
1967 "حدث B<FAN_Q_OVERFLOW>. قبل نواة لينكس 5.13، كان الحد المبرمج صلباً هو 16384 "
1968 "حدثاً."
1969
1970 #. type: TP
1971 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1972 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1973 #, no-wrap
1974 msgid "I</proc/sys/fs/fanotify/max_user_group>"
1975 msgstr "I</proc/sys/fs/fanotify/max_user_group>"
1976
1977 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
1978 #. type: Plain text
1979 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1980 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1981 msgid ""
1982 "This specifies an upper limit on the number of fanotify groups that can be "
1983 "created per real user ID. Prior to Linux kernel 5.13, the hardcoded limit "
1984 "was 128 groups per user."
1985 msgstr ""
1986 "يحدد هذا حداً أقصى لعدد مجموعات fanotify التي يمكن إنشاؤها لكل معرف مستخدم "
1987 "حقيقي. قبل نواة لينكس 5.13، كان الحد المبرمج صلباً هو 128 مجموعة لكل مستخدم."
1988
1989 #. type: TP
1990 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1991 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1992 #, no-wrap
1993 msgid "I</proc/sys/fs/fanotify/max_user_marks>"
1994 msgstr "I</proc/sys/fs/fanotify/max_user_marks>"
1995
1996 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
1997 #. type: Plain text
1998 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1999 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2000 msgid ""
2001 "This specifies an upper limit on the number of fanotify marks that can be "
2002 "created per real user ID. Prior to Linux kernel 5.13, the hardcoded limit "
2003 "was 8192 marks per group (not per user)."
2004 msgstr ""
2005 "يحدد هذا حداً أقصى لعدد علامات fanotify التي يمكن إنشاؤها لكل معرف مستخدم "
2006 "حقيقي. قبل نواة لينكس 5.13، كان الحد المبرمج صلباً هو 8192 علامة لكل مجموعة "
2007 "(وليس لكل مستخدم)."
2008
2009 #. type: SH
2010 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2011 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2012 #, no-wrap
2013 msgid "ERRORS"
2014 msgstr "الأخطاء"
2015
2016 #. type: Plain text
2017 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2018 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2019 msgid ""
2020 "In addition to the usual errors for B<read>(2), the following errors can "
2021 "occur when reading from the fanotify file descriptor:"
2022 msgstr ""
2023 "بالإضافة إلى الأخطاء المعتادة لـ B<read>(2)، يمكن أن تحدث الأخطاء التالية "
2024 "عند القراءة من واصف ملف fanotify:"
2025
2026 #. type: TP
2027 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2028 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2029 #, no-wrap
2030 msgid "B<EINVAL>"
2031 msgstr "B<EINVAL>"
2032
2033 #. type: Plain text
2034 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2035 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2036 msgid "The buffer is too small to hold the event."
2037 msgstr "الخبيئة أصغر من أن تتسع لهذا الحدث."
2038
2039 #. type: TP
2040 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2041 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2042 #, no-wrap
2043 msgid "B<EMFILE>"
2044 msgstr "B<EMFILE>"
2045
2046 #. type: Plain text
2047 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2048 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2049 msgid ""
2050 "The per-process limit on the number of open files has been reached. See the "
2051 "description of B<RLIMIT_NOFILE> in B<getrlimit>(2)."
2052 msgstr ""
2053 "بُلغ الحد الأقصى لعدد الملفات المفتوحة لكل عملية. انظر وصف B<RLIMIT_NOFILE> "
2054 "في B<getrlimit>(2)."
2055
2056 #. type: TP
2057 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2058 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2059 #, no-wrap
2060 msgid "B<ENFILE>"
2061 msgstr "B<ENFILE>"
2062
2063 #. type: Plain text
2064 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2065 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2066 msgid ""
2067 "The system-wide limit on the total number of open files has been reached. "
2068 "See I</proc/sys/fs/file-max> in B<proc>(5)."
2069 msgstr ""
2070 "بُلغ الحد الأقصى لعدد الملفات المفتوحة على مستوى النظام بأكمله. انظر I</proc/"
2071 "sys/fs/file-max> في B<proc>(5)."
2072
2073 #. type: TP
2074 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2075 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2076 #, no-wrap
2077 msgid "B<ETXTBSY>"
2078 msgstr "B<ETXTBSY>"
2079
2080 #. type: Plain text
2081 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2082 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2083 msgid ""
2084 "This error is returned by B<read>(2) if B<O_RDWR> or B<O_WRONLY> was "
2085 "specified in the I<event_f_flags> argument when calling B<fanotify_init>(2) "
2086 "and an event occurred for a monitored file that is currently being executed."
2087 msgstr ""
2088 "يُرجع الاستدعاء B<read>(2) هذا الخطأ إذا حُدد B<O_RDWR> أو B<O_WRONLY> في "
2089 "المعامل I<event_f_flags> عند استدعاء B<fanotify_init>(2) ووقع حدث لملف مراقب "
2090 "يجري تنفيذه حاليًا."
2091
2092 #. type: Plain text
2093 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2094 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2095 msgid ""
2096 "In addition to the usual errors for B<write>(2), the following errors can "
2097 "occur when writing to the fanotify file descriptor:"
2098 msgstr ""
2099 "بالإضافة إلى الأخطاء المعتادة للاستدعاء B<write>(2)، يمكن أن تقع الأخطاء "
2100 "التالية عند الكتابة في واصف ملف fanotify:"
2101
2102 #. type: Plain text
2103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2105 msgid ""
2106 "Fanotify access permissions are not enabled in the kernel configuration or "
2107 "the value of I<response> in the response structure is not valid."
2108 msgstr ""
2109 "أذونات الوصول لـ Fanotify غير مفعّلة في ضبط النواة أو أن قيمة I<response> في "
2110 "بنية الاستجابة غير صالحة."
2111
2112 #. type: TP
2113 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2114 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2115 #, no-wrap
2116 msgid "B<ENOENT>"
2117 msgstr "B<ENOENT>"
2118
2119 #. type: Plain text
2120 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2121 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2122 msgid ""
2123 "The file descriptor I<fd> in the response structure is not valid. This may "
2124 "occur when a response for the permission event has already been written."
2125 msgstr ""
2126 "واصف الملف I<fd> في بنية الاستجابة غير صالح. قد يحدث هذا عندما تكون استجابة "
2127 "حدث الإذن قد كُتبت بالفعل."
2128
2129 #. type: SH
2130 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2131 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2132 #, no-wrap
2133 msgid "STANDARDS"
2134 msgstr "المعايير"
2135
2136 #. type: Plain text
2137 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2138 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2139 msgid "Linux."
2140 msgstr "لينكس."
2141
2142 #. type: SH
2143 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2144 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2145 #, no-wrap
2146 msgid "HISTORY"
2147 msgstr "التاريخ"
2148
2149 #. type: Plain text
2150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2152 msgid ""
2153 "The fanotify API was introduced in Linux 2.6.36 and enabled in Linux "
2154 "2.6.37. fdinfo support was added in Linux 3.8."
2155 msgstr ""
2156 "قُدمت واجهة برمجة تطبيقات fanotify في لينكس 2.6.36 وفُعّلت في لينكس 2.6.37. "
2157 "أُضيف دعم fdinfo في لينكس 3.8."
2158
2159 #. type: SH
2160 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2161 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2162 #, no-wrap
2163 msgid "NOTES"
2164 msgstr "ملاحظات"
2165
2166 #. type: Plain text
2167 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2168 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2169 msgid ""
2170 "The fanotify API is available only if the kernel was built with the "
2171 "B<CONFIG_FANOTIFY> configuration option enabled. In addition, fanotify "
2172 "permission handling is available only if the "
2173 "B<CONFIG_FANOTIFY_ACCESS_PERMISSIONS> configuration option is enabled."
2174 msgstr ""
2175 "واجهة برمجة تطبيقات fanotify متاحة فقط إذا بُنيت النواة مع تفعيل خيار الضبط "
2176 "B<CONFIG_FANOTIFY>. بالإضافة إلى ذلك، فإن معالجة أذونات fanotify متاحة فقط "
2177 "إذا فُعّل خيار الضبط B<CONFIG_FANOTIFY_ACCESS_PERMISSIONS>."
2178
2179 #. type: SS
2180 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2181 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2182 #, no-wrap
2183 msgid "Limitations and caveats"
2184 msgstr "القيود والتحذيرات"
2185
2186 #. type: Plain text
2187 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2188 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2189 msgid ""
2190 "Fanotify reports only events that a user-space program triggers through the "
2191 "filesystem API. As a result, it does not catch remote events that occur on "
2192 "network filesystems."
2193 msgstr ""
2194 "يبلغ fanotify فقط عن الأحداث التي يطلقها برنامج في مساحة المستخدم عبر واجهة "
2195 "برمجة تطبيقات نظام الملفات. ونتيجة لذلك، فإنه لا يلتقط الأحداث البعيدة التي "
2196 "تقع في أنظمة الملفات الشبكية."
2197
2198 #. type: Plain text
2199 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2200 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2201 msgid ""
2202 "The fanotify API does not report file accesses and modifications that may "
2203 "occur because of B<mmap>(2), B<msync>(2), and B<munmap>(2)."
2204 msgstr ""
2205 "لا تبلغ واجهة برمجة تطبيقات fanotify عن عمليات الوصول إلى الملفات وتعديلها "
2206 "التي قد تحدث بسبب B<mmap>(2) و B<msync>(2) و B<munmap>(2)."
2207
2208 #. type: Plain text
2209 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2210 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2211 msgid ""
2212 "Events for directories are created only if the directory itself is opened, "
2213 "read, and closed. Adding, removing, or changing children of a marked "
2214 "directory does not create events for the monitored directory itself."
2215 msgstr ""
2216 "تُنشأ أحداث الأدلة فقط إذا فُتح الدليل نفسه وقُرئ وأُغلق. إضافة أو إزالة أو "
2217 "تغيير أبناء دليل موسوم لا يُنشئ أحداثًا للدليل المراقب نفسه."
2218
2219 #. type: Plain text
2220 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2221 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2222 msgid ""
2223 "Fanotify monitoring of directories is not recursive: to monitor "
2224 "subdirectories under a directory, additional marks must be created. The "
2225 "B<FAN_CREATE> event can be used for detecting when a subdirectory has been "
2226 "created under a marked directory. An additional mark must then be set on "
2227 "the newly created subdirectory. This approach is racy, because it can lose "
2228 "events that occurred inside the newly created subdirectory, before a mark is "
2229 "added on that subdirectory. Monitoring mounts offers the capability to "
2230 "monitor a whole directory tree in a race-free manner. Monitoring "
2231 "filesystems offers the capability to monitor changes made from any mount of "
2232 "a filesystem instance in a race-free manner."
2233 msgstr ""
2234 "مراقبة fanotify للأدلة ليست عودية: لمراقبة الأدلة الفرعية تحت دليل ما، يجب "
2235 "إنشاء وسوم إضافية. يمكن استخدام حدث B<FAN_CREATE> لاكتشاف وقت إنشاء دليل "
2236 "فرعي تحت دليل موسوم. يجب بعد ذلك وضع وسم إضافي على الدليل الفرعي المنشأ "
2237 "حديثًا. هذا النهج عرضة لظروف السباق (racy)، لأنه قد يفقد الأحداث التي وقعت "
2238 "داخل الدليل الفرعي المنشأ حديثًا قبل إضافة وسم عليه. توفر مراقبة نقاط الوصل "
2239 "القدرة على مراقبة شجرة أدلة كاملة بطريقة خالية من السباق. توفر مراقبة أنظمة "
2240 "الملفات القدرة على مراقبة التغييرات التي تجري من أي وصل لمثيل نظام ملفات "
2241 "بطريقة خالية من السباق."
2242
2243 #. type: Plain text
2244 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2245 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2246 msgid "The event queue can overflow. In this case, events are lost."
2247 msgstr "قد يفيض طابور الأحداث. في هذه الحالة، تُفقد الأحداث."
2248
2249 #. type: SH
2250 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2251 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2252 #, no-wrap
2253 msgid "BUGS"
2254 msgstr "العلل"
2255
2256 #. commit 820c12d5d6c0890bc93dd63893924a13041fdc35
2257 #. type: Plain text
2258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2260 msgid ""
2261 "Before Linux 3.19, B<fallocate>(2) did not generate fanotify events. Since "
2262 "Linux 3.19, calls to B<fallocate>(2) generate B<FAN_MODIFY> events."
2263 msgstr ""
2264 "قبل لينكس 3.19، لم يكن B<fallocate>(2) يولد أحداث fanotify. منذ لينكس 3.19، "
2265 "تولد استدعاءات B<fallocate>(2) أحداث B<FAN_MODIFY>."
2266
2267 #. type: Plain text
2268 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2269 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2270 msgid "As of Linux 3.17, the following bugs exist:"
2271 msgstr "بدءًا من لينكس 3.17، توجد العلل التالية:"
2272
2273 #. type: IP
2274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2276 #, no-wrap
2277 msgid "\\[bu]"
2278 msgstr "\\[bu]"
2279
2280 #. type: Plain text
2281 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2282 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2283 msgid ""
2284 "On Linux, a filesystem object may be accessible through multiple paths, for "
2285 "example, a part of a filesystem may be remounted using the I<--bind> option "
2286 "of B<mount>(8). A listener that marked a mount will be notified only of "
2287 "events that were triggered for a filesystem object using the same mount. "
2288 "Any other event will pass unnoticed."
2289 msgstr ""
2290 "في لينكس، يمكن الوصول إلى كائن نظام ملفات عبر مسارات متعددة، على سبيل "
2291 "المثال، قد يُعاد وصل جزء من نظام ملفات باستخدام خيار I<--bind> للأمر "
2292 "B<mount>(8). المستمع الذي وسم وصلًا سيُخطر فقط بالأحداث التي أُطلقت لكائن نظام "
2293 "ملفات باستخدام الوصل نفسه. أي حدث آخر سيمر دون ملاحظة."
2294
2295 #. FIXME . A patch was proposed.
2296 #. type: Plain text
2297 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2298 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2299 msgid ""
2300 "When an event is generated, no check is made to see whether the user ID of "
2301 "the receiving process has authorization to read or write the file before "
2302 "passing a file descriptor for that file. This poses a security risk, when "
2303 "the B<CAP_SYS_ADMIN> capability is set for programs executed by unprivileged "
2304 "users."
2305 msgstr ""
2306 "عند توليد حدث، لا يُجرى أي فحص لمعرفة ما إذا كان معرف المستخدم للعملية "
2307 "المستلمة لديه تفويض للقراءة أو الكتابة في الملف قبل تمرير واصف ملف لذلك "
2308 "الملف. يمثل هذا خطرًا أمنيًا، عندما تُضبط إمكانية B<CAP_SYS_ADMIN> للبرامج التي "
2309 "ينفذها مستخدمون غير مفوضين."
2310
2311 #. type: Plain text
2312 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2313 #: opensuse-leap-16-1 opensuse-tumbleweed
2314 msgid ""
2315 "If a call to B<read>(2) processes multiple events from the fanotify queue "
2316 "and an error occurs, the return value will be the total size of the events "
2317 "successfully copied to the user-space buffer before the error occurred. The "
2318 "return value will not be -1, and I<errno> will not be set. Thus, the "
2319 "reading application has no way to detect the error."
2320 msgstr ""
2321 "إذا عالج استدعاء B<read>(2) أحداثًا متعددة من طابور fanotify وحدث خطأ، فستكون "
2322 "القيمة المرجعة هي الحجم الإجمالي للأحداث التي نُسخت بنجاح إلى خبيئة مساحة "
2323 "المستخدم قبل وقوع الخطأ. لن تكون القيمة المرجعة -1، ولن يُضبط I<errno>. "
2324 "وبالتالي، لا تملك التطبيقات القارئة أي وسيلة لاكتشاف الخطأ."
2325
2326 #. type: SH
2327 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2328 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2329 #, no-wrap
2330 msgid "EXAMPLES"
2331 msgstr "أمثلة"
2332
2333 #. type: Plain text
2334 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2335 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2336 msgid ""
2337 "The two example programs below demonstrate the usage of the fanotify API."
2338 msgstr "يوضح البرنامجان المثالان أدناه استخدام واجهة برمجة تطبيقات fanotify."
2339
2340 #. type: SS
2341 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2342 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2343 #, no-wrap
2344 msgid "Example program: fanotify_example.c"
2345 msgstr "برنامج مثال: fanotify_example.c"
2346
2347 #. type: Plain text
2348 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2349 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2350 msgid ""
2351 "The first program is an example of fanotify being used with its event object "
2352 "information passed in the form of a file descriptor. The program marks the "
2353 "mount passed as a command-line argument and waits for events of type "
2354 "B<FAN_OPEN_PERM> and B<FAN_CLOSE_WRITE>. When a permission event occurs, a "
2355 "B<FAN_ALLOW> response is given."
2356 msgstr ""
2357 "البرنامج الأول هو مثال لاستخدام fanotify مع تمرير معلومات كائن الحدث الخاص "
2358 "به في شكل واصف ملف. يوسم البرنامج نقطة الوصل الممررة كمعامل في سطر الأوامر "
2359 "وينتظر أحداثًا من النوع B<FAN_OPEN_PERM> و B<FAN_CLOSE_WRITE>. عند وقوع حدث "
2360 "إذن، تُعطى استجابة B<FAN_ALLOW>."
2361
2362 #. type: Plain text
2363 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2364 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2365 msgid ""
2366 "The following shell session shows an example of running this program. This "
2367 "session involved editing the file I</home/user/temp/notes>. Before the file "
2368 "was opened, a B<FAN_OPEN_PERM> event occurred. After the file was closed, a "
2369 "B<FAN_CLOSE_WRITE> event occurred. Execution of the program ends when the "
2370 "user presses the ENTER key."
2371 msgstr ""
2372 "تُظهر جلسة الصدفة التالية مثالًا على تشغيل هذا البرنامج. تضمنت هذه الجلسة "
2373 "تحرير الملف I</home/user/temp/notes>. قبل أن يُفتح الملف، وقع حدث "
2374 "B<FAN_OPEN_PERM>. بعد إغلاق الملف، وقع حدث B<FAN_CLOSE_WRITE>. ينتهي تنفيذ "
2375 "البرنامج عندما يضغط المستخدم على مفتاح ENTER."
2376
2377 #. type: Plain text
2378 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2379 #: opensuse-tumbleweed
2380 #, no-wrap
2381 msgid ""
2382 "#B< ./fanotify_example /home>;\n"
2383 "Press enter key to terminate.\n"
2384 "Listening for events.\n"
2385 "FAN_OPEN_PERM: File /home/user/temp/notes\n"
2386 "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
2387 "\\&\n"
2388 "Listening for events stopped.\n"
2389 msgstr ""
2390 "#B< ./fanotify_example /home>;\n"
2391 "اضغط على مفتاح ENTER للإنهاء.\n"
2392 "الاستماع للأحداث.\n"
2393 "FAN_OPEN_PERM: File /home/user/temp/notes\n"
2394 "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
2395 "\\&\n"
2396 "توقف الاستماع للأحداث.\n"
2397
2398 #. type: SS
2399 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2400 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2401 #, no-wrap
2402 msgid "Program source: fanotify_example.c"
2403 msgstr "مصدر البرنامج: fanotify_example.c"
2404
2405 #. type: Plain text
2406 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
2407 #, no-wrap
2408 msgid ""
2409 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
2410 "#include E<lt>errno.hE<gt>\n"
2411 "#include E<lt>fcntl.hE<gt>\n"
2412 "#include E<lt>limits.hE<gt>\n"
2413 "#include E<lt>poll.hE<gt>\n"
2414 "#include E<lt>stdio.hE<gt>\n"
2415 "#include E<lt>stdlib.hE<gt>\n"
2416 "#include E<lt>sys/fanotify.hE<gt>\n"
2417 "#include E<lt>unistd.hE<gt>\n"
2418 "\\&\n"
2419 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
2420 "\\&\n"
2421 "static void\n"
2422 "handle_events(int fd)\n"
2423 "{\n"
2424 " const struct fanotify_event_metadata *metadata;\n"
2425 " struct fanotify_event_metadata buf[200];\n"
2426 " ssize_t size;\n"
2427 " char path[PATH_MAX];\n"
2428 " ssize_t path_len;\n"
2429 " char procfd_path[PATH_MAX];\n"
2430 " struct fanotify_response response;\n"
2431 "\\&\n"
2432 " /* Loop while events can be read from fanotify file descriptor. */\n"
2433 "\\&\n"
2434 " for (;;) {\n"
2435 "\\&\n"
2436 " /* Read some events. */\n"
2437 "\\&\n"
2438 " size = read(fd, buf, sizeof(buf));\n"
2439 " if (size == -1 && errno != EAGAIN) {\n"
2440 " perror(\"read\");\n"
2441 " exit(EXIT_FAILURE);\n"
2442 " }\n"
2443 "\\&\n"
2444 " /* Check if end of available data reached. */\n"
2445 "\\&\n"
2446 " if (size E<lt>= 0)\n"
2447 " break;\n"
2448 "\\&\n"
2449 " /* Point to the first event in the buffer. */\n"
2450 "\\&\n"
2451 " metadata = buf;\n"
2452 "\\&\n"
2453 " /* Loop over all events in the buffer. */\n"
2454 "\\&\n"
2455 " while (FAN_EVENT_OK(metadata, size)) {\n"
2456 "\\&\n"
2457 " /* Check that run-time and compile-time structures match. */\n"
2458 "\\&\n"
2459 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
2460 " fprintf(stderr,\n"
2461 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
2462 " exit(EXIT_FAILURE);\n"
2463 " }\n"
2464 "\\&\n"
2465 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
2466 " queue overflow, or a file descriptor (a nonnegative\n"
2467 " integer). Here, we simply ignore queue overflow. */\n"
2468 "\\&\n"
2469 " if (metadata-E<gt>fd E<gt>= 0) {\n"
2470 "\\&\n"
2471 " /* Handle open permission event. */\n"
2472 "\\&\n"
2473 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
2474 " printf(\"FAN_OPEN_PERM: \");\n"
2475 "\\&\n"
2476 " /* Allow file to be opened. */\n"
2477 "\\&\n"
2478 " response.fd = metadata-E<gt>fd;\n"
2479 " response.response = FAN_ALLOW;\n"
2480 " write(fd, &response, sizeof(response));\n"
2481 " }\n"
2482 "\\&\n"
2483 " /* Handle closing of writable file event. */\n"
2484 "\\&\n"
2485 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
2486 " printf(\"FAN_CLOSE_WRITE: \");\n"
2487 "\\&\n"
2488 " /* Retrieve and print pathname of the accessed file. */\n"
2489 "\\&\n"
2490 " snprintf(procfd_path, sizeof(procfd_path),\n"
2491 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
2492 " path_len = readlink(procfd_path, path,\n"
2493 " sizeof(path) - 1);\n"
2494 " if (path_len == -1) {\n"
2495 " perror(\"readlink\");\n"
2496 " exit(EXIT_FAILURE);\n"
2497 " }\n"
2498 "\\&\n"
2499 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
2500 " printf(\"File %s\\[rs]n\", path);\n"
2501 "\\&\n"
2502 " /* Close the file descriptor of the event. */\n"
2503 "\\&\n"
2504 " close(metadata-E<gt>fd);\n"
2505 " }\n"
2506 "\\&\n"
2507 " /* Advance to next event. */\n"
2508 "\\&\n"
2509 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
2510 " }\n"
2511 " }\n"
2512 "}\n"
2513 "\\&\n"
2514 "int\n"
2515 "main(int argc, char *argv[])\n"
2516 "{\n"
2517 " char buf;\n"
2518 " int fd, poll_num;\n"
2519 " nfds_t nfds;\n"
2520 " struct pollfd fds[2];\n"
2521 "\\&\n"
2522 " /* Check mount point is supplied. */\n"
2523 "\\&\n"
2524 " if (argc != 2) {\n"
2525 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
2526 " exit(EXIT_FAILURE);\n"
2527 " }\n"
2528 "\\&\n"
2529 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
2530 "\\&\n"
2531 " /* Create the file descriptor for accessing the fanotify API. */\n"
2532 "\\&\n"
2533 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
2534 " O_RDONLY | O_LARGEFILE);\n"
2535 " if (fd == -1) {\n"
2536 " perror(\"fanotify_init\");\n"
2537 " exit(EXIT_FAILURE);\n"
2538 " }\n"
2539 "\\&\n"
2540 " /* Mark the mount for:\n"
2541 " - permission events before opening files\n"
2542 " - notification events after closing a write-enabled\n"
2543 " file descriptor. */\n"
2544 "\\&\n"
2545 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
2546 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
2547 " argv[1]) == -1) {\n"
2548 " perror(\"fanotify_mark\");\n"
2549 " exit(EXIT_FAILURE);\n"
2550 " }\n"
2551 "\\&\n"
2552 " /* Prepare for polling. */\n"
2553 "\\&\n"
2554 " nfds = 2;\n"
2555 "\\&\n"
2556 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
2557 " fds[0].events = POLLIN;\n"
2558 "\\&\n"
2559 " fds[1].fd = fd; /* Fanotify input */\n"
2560 " fds[1].events = POLLIN;\n"
2561 "\\&\n"
2562 " /* This is the loop to wait for incoming events. */\n"
2563 "\\&\n"
2564 " printf(\"Listening for events.\\[rs]n\");\n"
2565 "\\&\n"
2566 " for (;;) {\n"
2567 " poll_num = poll(fds, nfds, -1);\n"
2568 " if (poll_num == -1) {\n"
2569 " if (errno == EINTR) /* Interrupted by a signal */\n"
2570 " continue; /* Restart poll() */\n"
2571 "\\&\n"
2572 " perror(\"poll\"); /* Unexpected error */\n"
2573 " exit(EXIT_FAILURE);\n"
2574 " }\n"
2575 "\\&\n"
2576 " if (poll_num E<gt> 0) {\n"
2577 " if (fds[0].revents & POLLIN) {\n"
2578 "\\&\n"
2579 " /* Console input is available: empty stdin and quit. */\n"
2580 "\\&\n"
2581 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
2582 " continue;\n"
2583 " break;\n"
2584 " }\n"
2585 "\\&\n"
2586 " if (fds[1].revents & POLLIN) {\n"
2587 "\\&\n"
2588 " /* Fanotify events are available. */\n"
2589 "\\&\n"
2590 " handle_events(fd);\n"
2591 " }\n"
2592 " }\n"
2593 " }\n"
2594 "\\&\n"
2595 " printf(\"Listening for events stopped.\\[rs]n\");\n"
2596 " exit(EXIT_SUCCESS);\n"
2597 "}\n"
2598 msgstr ""
2599 "#define _GNU_SOURCE /* مطلوب للحصول على تعريف O_LARGEFILE */\n"
2600 "#include E<lt>errno.hE<gt>\n"
2601 "#include E<lt>fcntl.hE<gt>\n"
2602 "#include E<lt>limits.hE<gt>\n"
2603 "#include E<lt>poll.hE<gt>\n"
2604 "#include E<lt>stdio.hE<gt>\n"
2605 "#include E<lt>stdlib.hE<gt>\n"
2606 "#include E<lt>sys/fanotify.hE<gt>\n"
2607 "#include E<lt>unistd.hE<gt>\n"
2608 "\\&\n"
2609 "/* اقرأ جميع أحداث fanotify المتاحة من واصف الملف \\[aq]fd\\[aq]. */\n"
2610 "\\&\n"
2611 "static void\n"
2612 "handle_events(int fd)\n"
2613 "{\n"
2614 " const struct fanotify_event_metadata *metadata;\n"
2615 " struct fanotify_event_metadata buf[200];\n"
2616 " ssize_t size;\n"
2617 " char path[PATH_MAX];\n"
2618 " ssize_t path_len;\n"
2619 " char procfd_path[PATH_MAX];\n"
2620 " struct fanotify_response response;\n"
2621 "\\&\n"
2622 " /* التكرار طالما يمكن قراءة الأحداث من واصف ملف fanotify. */\n"
2623 "\\&\n"
2624 " for (;;) {\n"
2625 "\\&\n"
2626 " /* قراءة بعض الأحداث. */\n"
2627 "\\&\n"
2628 " size = read(fd, buf, sizeof(buf));\n"
2629 " if (size == -1 && errno != EAGAIN) {\n"
2630 " perror(\"read\");\n"
2631 " exit(EXIT_FAILURE);\n"
2632 " }\n"
2633 "\\&\n"
2634 " /* التحقق مما إذا كان قد وصل إلى نهاية البيانات المتاحة. */\n"
2635 "\\&\n"
2636 " if (size E<lt>= 0)\n"
2637 " break;\n"
2638 "\\&\n"
2639 " /* الإشارة إلى الحدث الأول في الخبيئة. */\n"
2640 "\\&\n"
2641 " metadata = buf;\n"
2642 "\\&\n"
2643 " /* التكرار عبر كافة الأحداث في الخبيئة. */\n"
2644 "\\&\n"
2645 " while (FAN_EVENT_OK(metadata, size)) {\n"
2646 "\\&\n"
2647 " /* التحقق من تطابق بنيات وقت التشغيل ووقت التجميع. */\n"
2648 "\\&\n"
2649 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
2650 " fprintf(stderr,\n"
2651 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
2652 " exit(EXIT_FAILURE);\n"
2653 " }\n"
2654 "\\&\n"
2655 " /* metadata-E<gt>fd يحتوي إما على FAN_NOFD، مما يشير إلى\n"
2656 " فيضان الطابور، أو واصف ملف (عدد صحيح غير سالب).\n"
2657 " هنا، نتجاهل ببساطة فيضان الطابور. */\n"
2658 "\\&\n"
2659 " if (metadata-E<gt>fd E<gt>= 0) {\n"
2660 "\\&\n"
2661 " /* معالجة حدث إذن الفتح. */\n"
2662 "\\&\n"
2663 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
2664 " printf(\"FAN_OPEN_PERM: \");\n"
2665 "\\&\n"
2666 " /* السماح بفتح الملف. */\n"
2667 "\\&\n"
2668 " response.fd = metadata-E<gt>fd;\n"
2669 " response.response = FAN_ALLOW;\n"
2670 " write(fd, &response, sizeof(response));\n"
2671 " }\n"
2672 "\\&\n"
2673 " /* معالجة حدث إغلاق ملف قابل للكتابة. */\n"
2674 "\\&\n"
2675 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
2676 " printf(\"FAN_CLOSE_WRITE: \");\n"
2677 "\\&\n"
2678 " /* جلب وطباعة اسم المسار للملف الذي تم الوصول إليه. */\n"
2679 "\\&\n"
2680 " snprintf(procfd_path, sizeof(procfd_path),\n"
2681 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
2682 " path_len = readlink(procfd_path, path,\n"
2683 " sizeof(path) - 1);\n"
2684 " if (path_len == -1) {\n"
2685 " perror(\"readlink\");\n"
2686 " exit(EXIT_FAILURE);\n"
2687 " }\n"
2688 "\\&\n"
2689 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
2690 " printf(\"File %s\\[rs]n\", path);\n"
2691 "\\&\n"
2692 " /* إغلاق واصف الملف الخاص بالحدث. */\n"
2693 "\\&\n"
2694 " close(metadata-E<gt>fd);\n"
2695 " }\n"
2696 "\\&\n"
2697 " /* الانتقال إلى الحدث التالي. */\n"
2698 "\\&\n"
2699 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
2700 " }\n"
2701 " }\n"
2702 "}\n"
2703 "\\&\n"
2704 "int\n"
2705 "main(int argc, char *argv[])\n"
2706 "{\n"
2707 " char buf;\n"
2708 " int fd, poll_num;\n"
2709 " nfds_t nfds;\n"
2710 " struct pollfd fds[2];\n"
2711 "\\&\n"
2712 " /* التحقق من توفير نقطة الوصل. */\n"
2713 "\\&\n"
2714 " if (argc != 2) {\n"
2715 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
2716 " exit(EXIT_FAILURE);\n"
2717 " }\n"
2718 "\\&\n"
2719 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
2720 "\\&\n"
2721 " /* إنشاء واصف الملف للوصول إلى واجهة برمجة تطبيقات fanotify. */\n"
2722 "\\&\n"
2723 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
2724 " O_RDONLY | O_LARGEFILE);\n"
2725 " if (fd == -1) {\n"
2726 " perror(\"fanotify_init\");\n"
2727 " exit(EXIT_FAILURE);\n"
2728 " }\n"
2729 "\\&\n"
2730 " /* وسم نقطة الوصل لـ:\n"
2731 " - أحداث الإذن قبل فتح الملفات\n"
2732 " - أحداث الإشعار بعد إغلاق واصف ملف\n"
2733 " مفعّل للكتابة. */\n"
2734 "\\&\n"
2735 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
2736 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
2737 " argv[1]) == -1) {\n"
2738 " perror(\"fanotify_mark\");\n"
2739 " exit(EXIT_FAILURE);\n"
2740 " }\n"
2741 "\\&\n"
2742 " /* التحضير للاستطلاع (polling). */\n"
2743 "\\&\n"
2744 " nfds = 2;\n"
2745 "\\&\n"
2746 " fds[0].fd = STDIN_FILENO; /* إدخال الكونسول */\n"
2747 " fds[0].events = POLLIN;\n"
2748 "\\&\n"
2749 " fds[1].fd = fd; /* إدخال Fanotify */\n"
2750 " fds[1].events = POLLIN;\n"
2751 "\\&\n"
2752 " /* هذا هو التكرار لانتظار الأحداث القادمة. */\n"
2753 "\\&\n"
2754 " printf(\"Listening for events.\\[rs]n\");\n"
2755 "\\&\n"
2756 " for (;;) {\n"
2757 " poll_num = poll(fds, nfds, -1);\n"
2758 " if (poll_num == -1) {\n"
2759 " if (errno == EINTR) /* قُطع بواسطة إشارة */\n"
2760 " continue; /* إعادة تشغيل poll() */\n"
2761 "\\&\n"
2762 " perror(\"poll\"); /* خطأ غير متوقع */\n"
2763 " exit(EXIT_FAILURE);\n"
2764 " }\n"
2765 "\\&\n"
2766 " if (poll_num E<gt> 0) {\n"
2767 " if (fds[0].revents & POLLIN) {\n"
2768 "\\&\n"
2769 " /* إدخال الكونسول متاح: إفراغ stdin والخروج. */\n"
2770 "\\&\n"
2771 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
2772 " continue;\n"
2773 " break;\n"
2774 " }\n"
2775 "\\&\n"
2776 " if (fds[1].revents & POLLIN) {\n"
2777 "\\&\n"
2778 " /* أحداث Fanotify متاحة. */\n"
2779 "\\&\n"
2780 " handle_events(fd);\n"
2781 " }\n"
2782 " }\n"
2783 " }\n"
2784 "\\&\n"
2785 " printf(\"Listening for events stopped.\\[rs]n\");\n"
2786 " exit(EXIT_SUCCESS);\n"
2787 "}\n"
2788
2789 #. type: SS
2790 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2791 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2792 #, no-wrap
2793 msgid "Example program: fanotify_fid.c"
2794 msgstr "برنامج مثال: fanotify_fid.c"
2795
2796 #. type: Plain text
2797 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2798 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2799 msgid ""
2800 "The second program is an example of fanotify being used with a group that "
2801 "identifies objects by file handles. The program marks the filesystem object "
2802 "that is passed as a command-line argument and waits until an event of type "
2803 "B<FAN_CREATE> has occurred. The event mask indicates which type of "
2804 "filesystem object\\[em]either a file or a directory\\[em]was created. Once "
2805 "all events have been read from the buffer and processed accordingly, the "
2806 "program simply terminates."
2807 msgstr ""
2808 "البرنامج الثاني هو مثال لاستخدام fanotify مع مجموعة تحدد الكائنات بواسطة "
2809 "مقابض الملفات. يوسم البرنامج كائن نظام الملفات الذي يُمرر كمعامل سطر أوامر "
2810 "وينتظر حتى يقع حدث من النوع B<FAN_CREATE>. يشير قناع الحدث إلى نوع كائن نظام "
2811 "الملفات\\[em]إما ملف أو دليل\\[em]الذي أُنشئ. وبمجرد قراءة جميع الأحداث من "
2812 "الخبيئة ومعالجتها وفقًا لذلك، ينتهي البرنامج ببساطة."
2813
2814 #. type: Plain text
2815 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2816 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2817 msgid ""
2818 "The following shell sessions show two different invocations of this program, "
2819 "with different actions performed on a watched object."
2820 msgstr ""
2821 "تُظهر جلسات الصدفة التالية استدعاءين مختلفين لهذا البرنامج، مع تنفيذ إجراءات "
2822 "مختلفة على كائن مراقب."
2823
2824 #. type: Plain text
2825 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2826 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2827 msgid ""
2828 "The first session shows a mark being placed on I</home/user>. This is "
2829 "followed by the creation of a regular file, I</home/user/testfile.txt>. "
2830 "This results in a B<FAN_CREATE> event being generated and reported against "
2831 "the file's parent watched directory object and with the created file name. "
2832 "Program execution ends once all events captured within the buffer have been "
2833 "processed."
2834 msgstr ""
2835 "تُظهر الجلسة الأولى وضع وسم على I</home/user>. ويتبع ذلك إنشاء ملف عادي، I</"
2836 "home/user/testfile.txt>. ينتج عن هذا توليد حدث B<FAN_CREATE> والإبلاغ عنه "
2837 "مقابل كائن الدليل الأب المراقب للملف ومع اسم الملف المنشأ. ينتهي تنفيذ "
2838 "البرنامج بمجرد معالجة جميع الأحداث الملتقطة داخل الخبيئة."
2839
2840 #. type: Plain text
2841 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2842 #: opensuse-tumbleweed
2843 #, no-wrap
2844 msgid ""
2845 "#B< ./fanotify_fid /home/user>;\n"
2846 "Listening for events.\n"
2847 "FAN_CREATE (file created):\n"
2848 " Directory /home/user has been modified.\n"
2849 " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n"
2850 "All events processed successfully. Program exiting.\n"
2851 "\\&\n"
2852 "$B< touch /home/user/testfile.txt>; # In another terminal\n"
2853 msgstr ""
2854 "#B< ./fanotify_fid /home/user>;\n"
2855 "الاستماع للأحداث.\n"
2856 "FAN_CREATE (أُنشئ ملف):\n"
2857 " عُدّل الدليل /home/user.\n"
2858 " المدخل \\[aq]testfile.txt\\[aq] ليس دليلاً فرعيًا.\n"
2859 "عولجت جميع الأحداث بنجاح. يخرج البرنامج.\n"
2860 "\\&\n"
2861 "$B< touch /home/user/testfile.txt>; # في طرفية أخرى\n"
2862
2863 #. type: Plain text
2864 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2865 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2866 msgid ""
2867 "The second session shows a mark being placed on I</home/user>. This is "
2868 "followed by the creation of a directory, I</home/user/testdir>. This "
2869 "specific action results in a B<FAN_CREATE> event being generated and is "
2870 "reported with the B<FAN_ONDIR> flag set and with the created directory name."
2871 msgstr ""
2872 "تُظهر الجلسة الثانية وضع وسم على I</home/user>. ويتبع ذلك إنشاء دليل، I</home/"
2873 "user/testdir>. ينتج عن هذا الإجراء المحدد توليد حدث B<FAN_CREATE> ويُبلغ عنه "
2874 "مع تعيين علم B<FAN_ONDIR> ومع اسم الدليل المنشأ."
2875
2876 #. type: Plain text
2877 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2878 #: opensuse-tumbleweed
2879 #, no-wrap
2880 msgid ""
2881 "#B< ./fanotify_fid /home/user>;\n"
2882 "Listening for events.\n"
2883 "FAN_CREATE | FAN_ONDIR (subdirectory created):\n"
2884 " Directory /home/user has been modified.\n"
2885 " Entry \\[aq]testdir\\[aq] is a subdirectory.\n"
2886 "All events processed successfully. Program exiting.\n"
2887 "\\&\n"
2888 "$B< mkdir -p /home/user/testdir>; # In another terminal\n"
2889 msgstr ""
2890 "#B< ./fanotify_fid /home/user>;\n"
2891 "الاستماع للأحداث.\n"
2892 "FAN_CREATE | FAN_ONDIR (أُنشئ دليل فرعي):\n"
2893 " عُدّل الدليل /home/user.\n"
2894 " المدخل \\[aq]testdir\\[aq] هو دليل فرعي.\n"
2895 "عولجت جميع الأحداث بنجاح. يخرج البرنامج.\n"
2896 "\\&\n"
2897 "$B< mkdir -p /home/user/testdir>; # في طرفية أخرى\n"
2898
2899 #. type: SS
2900 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2901 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2902 #, no-wrap
2903 msgid "Program source: fanotify_fid.c"
2904 msgstr "مصدر البرنامج: fanotify_fid.c"
2905
2906 #. type: Plain text
2907 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2908 #: opensuse-tumbleweed
2909 #, no-wrap
2910 msgid ""
2911 "#define _GNU_SOURCE\n"
2912 "#include E<lt>errno.hE<gt>\n"
2913 "#include E<lt>fcntl.hE<gt>\n"
2914 "#include E<lt>limits.hE<gt>\n"
2915 "#include E<lt>stdio.hE<gt>\n"
2916 "#include E<lt>stdlib.hE<gt>\n"
2917 "#include E<lt>sys/types.hE<gt>\n"
2918 "#include E<lt>sys/stat.hE<gt>\n"
2919 "#include E<lt>sys/fanotify.hE<gt>\n"
2920 "#include E<lt>unistd.hE<gt>\n"
2921 "\\&\n"
2922 "#define BUF_SIZE 256\n"
2923 "\\&\n"
2924 "int\n"
2925 "main(int argc, char *argv[])\n"
2926 "{\n"
2927 " int fd, ret, event_fd, mount_fd;\n"
2928 " ssize_t size, path_len;\n"
2929 " char path[PATH_MAX];\n"
2930 " char procfd_path[PATH_MAX];\n"
2931 " char events_buf[BUF_SIZE];\n"
2932 " struct file_handle *file_handle;\n"
2933 " struct fanotify_event_metadata *metadata;\n"
2934 " struct fanotify_event_info_fid *fid;\n"
2935 " const char *file_name;\n"
2936 " struct stat sb;\n"
2937 "\\&\n"
2938 " if (argc != 2) {\n"
2939 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
2940 " exit(EXIT_FAILURE);\n"
2941 " }\n"
2942 "\\&\n"
2943 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
2944 " if (mount_fd == -1) {\n"
2945 " perror(argv[1]);\n"
2946 " exit(EXIT_FAILURE);\n"
2947 " }\n"
2948 "\\&\n"
2949 " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
2950 " a flag so that program can receive fid events with directory\n"
2951 " entry name. */\n"
2952 "\\&\n"
2953 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
2954 " if (fd == -1) {\n"
2955 " perror(\"fanotify_init\");\n"
2956 " exit(EXIT_FAILURE);\n"
2957 " }\n"
2958 "\\&\n"
2959 " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
2960 "\\&\n"
2961 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
2962 " FAN_CREATE | FAN_ONDIR,\n"
2963 " AT_FDCWD, argv[1]);\n"
2964 " if (ret == -1) {\n"
2965 " perror(\"fanotify_mark\");\n"
2966 " exit(EXIT_FAILURE);\n"
2967 " }\n"
2968 "\\&\n"
2969 " printf(\"Listening for events.\\[rs]n\");\n"
2970 "\\&\n"
2971 " /* Read events from the event queue into a buffer. */\n"
2972 "\\&\n"
2973 " size = read(fd, events_buf, sizeof(events_buf));\n"
2974 " if (size == -1 && errno != EAGAIN) {\n"
2975 " perror(\"read\");\n"
2976 " exit(EXIT_FAILURE);\n"
2977 " }\n"
2978 "\\&\n"
2979 " /* Process all events within the buffer. */\n"
2980 "\\&\n"
2981 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
2982 " FAN_EVENT_OK(metadata, size);\n"
2983 " metadata = FAN_EVENT_NEXT(metadata, size)) {\n"
2984 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
2985 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
2986 "\\&\n"
2987 " /* Ensure that the event info is of the correct type. */\n"
2988 "\\&\n"
2989 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
2990 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
2991 " file_name = NULL;\n"
2992 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
2993 " file_name = file_handle-E<gt>f_handle +\n"
2994 " file_handle-E<gt>handle_bytes;\n"
2995 " } else {\n"
2996 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
2997 " exit(EXIT_FAILURE);\n"
2998 " }\n"
2999 "\\&\n"
3000 " if (metadata-E<gt>mask == FAN_CREATE)\n"
3001 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
3002 "\\&\n"
3003 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
3004 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
3005 "\\&\n"
3006 "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
3007 "\t objects by file handles. To obtain a file descriptor for\n"
3008 "\t the file object corresponding to an event you can use the\n"
3009 "\t struct file_handle that\\[aq]s provided within the\n"
3010 "\t fanotify_event_info_fid in conjunction with the\n"
3011 "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
3012 "\t done to accommodate for the situation where the file handle\n"
3013 "\t for the object was deleted prior to this system call. */\n"
3014 "\\&\n"
3015 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
3016 " if (event_fd == -1) {\n"
3017 " if (errno == ESTALE) {\n"
3018 " printf(\"File handle is no longer valid. \"\n"
3019 " \"File has been deleted\\[rs]n\");\n"
3020 " continue;\n"
3021 " } else {\n"
3022 " perror(\"open_by_handle_at\");\n"
3023 " exit(EXIT_FAILURE);\n"
3024 " }\n"
3025 " }\n"
3026 "\\&\n"
3027 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
3028 " event_fd);\n"
3029 "\\&\n"
3030 " /* Retrieve and print the path of the modified dentry. */\n"
3031 "\\&\n"
3032 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
3033 " if (path_len == -1) {\n"
3034 " perror(\"readlink\");\n"
3035 " exit(EXIT_FAILURE);\n"
3036 " }\n"
3037 "\\&\n"
3038 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
3039 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
3040 "\\&\n"
3041 " if (file_name) {\n"
3042 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
3043 " if (ret == -1) {\n"
3044 " if (errno != ENOENT) {\n"
3045 " perror(\"fstatat\");\n"
3046 " exit(EXIT_FAILURE);\n"
3047 " }\n"
3048 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
3049 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
3050 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
3051 " } else {\n"
3052 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
3053 " file_name);\n"
3054 " }\n"
3055 " }\n"
3056 "\\&\n"
3057 " /* Close associated file descriptor for this event. */\n"
3058 "\\&\n"
3059 " close(event_fd);\n"
3060 " }\n"
3061 "\\&\n"
3062 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
3063 " exit(EXIT_SUCCESS);\n"
3064 "}\n"
3065 msgstr ""
3066 "#define _GNU_SOURCE\n"
3067 "#include E<lt>errno.hE<gt>\n"
3068 "#include E<lt>fcntl.hE<gt>\n"
3069 "#include E<lt>limits.hE<gt>\n"
3070 "#include E<lt>stdio.hE<gt>\n"
3071 "#include E<lt>stdlib.hE<gt>\n"
3072 "#include E<lt>sys/types.hE<gt>\n"
3073 "#include E<lt>sys/stat.hE<gt>\n"
3074 "#include E<lt>sys/fanotify.hE<gt>\n"
3075 "#include E<lt>unistd.hE<gt>\n"
3076 "\\&\n"
3077 "#define BUF_SIZE 256\n"
3078 "\\&\n"
3079 "int\n"
3080 "main(int argc, char *argv[])\n"
3081 "{\n"
3082 " int fd, ret, event_fd, mount_fd;\n"
3083 " ssize_t size, path_len;\n"
3084 " char path[PATH_MAX];\n"
3085 " char procfd_path[PATH_MAX];\n"
3086 " char events_buf[BUF_SIZE];\n"
3087 " struct file_handle *file_handle;\n"
3088 " struct fanotify_event_metadata *metadata;\n"
3089 " struct fanotify_event_info_fid *fid;\n"
3090 " const char *file_name;\n"
3091 " struct stat sb;\n"
3092 "\\&\n"
3093 " if (argc != 2) {\n"
3094 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
3095 " exit(EXIT_FAILURE);\n"
3096 " }\n"
3097 "\\&\n"
3098 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
3099 " if (mount_fd == -1) {\n"
3100 " perror(argv[1]);\n"
3101 " exit(EXIT_FAILURE);\n"
3102 " }\n"
3103 "\\&\n"
3104 " /* إنشاء واصف ملف fanotify مع FAN_REPORT_DFID_NAME كـ\n"
3105 " علم حتى يتمكن البرنامج من استقبال أحداث fid مع اسم\n"
3106 " مدخل الدليل. */\n"
3107 "\\&\n"
3108 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
3109 " if (fd == -1) {\n"
3110 " perror(\"fanotify_init\");\n"
3111 " exit(EXIT_FAILURE);\n"
3112 " }\n"
3113 "\\&\n"
3114 " /* وضع وسم على كائن نظام الملفات الموفر في argv[1]. */\n"
3115 "\\&\n"
3116 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
3117 " FAN_CREATE | FAN_ONDIR,\n"
3118 " AT_FDCWD, argv[1]);\n"
3119 " if (ret == -1) {\n"
3120 " perror(\"fanotify_mark\");\n"
3121 " exit(EXIT_FAILURE);\n"
3122 " }\n"
3123 "\\&\n"
3124 " printf(\"Listening for events.\\[rs]n\");\n"
3125 "\\&\n"
3126 " /* قراءة الأحداث من طابور الأحداث إلى خبيئة. */\n"
3127 "\\&\n"
3128 " size = read(fd, events_buf, sizeof(events_buf));\n"
3129 " if (size == -1 && errno != EAGAIN) {\n"
3130 " perror(\"read\");\n"
3131 " exit(EXIT_FAILURE);\n"
3132 " }\n"
3133 "\\&\n"
3134 " /* معالجة جميع الأحداث داخل الخبيئة. */\n"
3135 "\\&\n"
3136 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
3137 " FAN_EVENT_OK(metadata, size);\n"
3138 " metadata = FAN_EVENT_NEXT(metadata, size)) {\n"
3139 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
3140 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
3141 "\\&\n"
3142 " /* التأكد من أن معلومات الحدث من النوع الصحيح. */\n"
3143 "\\&\n"
3144 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
3145 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
3146 " file_name = NULL;\n"
3147 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
3148 " file_name = file_handle-E<gt>f_handle +\n"
3149 " file_handle-E<gt>handle_bytes;\n"
3150 " } else {\n"
3151 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
3152 " exit(EXIT_FAILURE);\n"
3153 " }\n"
3154 "\\&\n"
3155 " if (metadata-E<gt>mask == FAN_CREATE)\n"
3156 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
3157 "\\&\n"
3158 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
3159 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
3160 "\\&\n"
3161 "\t/* يُضبط metadata-E<gt>fd على FAN_NOFD عندما تحدد المجموعة\n"
3162 "\t الكائنات بواسطة مقابض الملفات. للحصول على واصف ملف\n"
3163 "\t لكائن الملف المقابل لحدث ما، يمكنك استخدام\n"
3164 "\t struct file_handle الموفرة داخل\n"
3165 "\t fanotify_event_info_fid بالاقتران مع استدعاء\n"
3166 "\t النظام open_by_handle_at(2). يُجرى فحص لـ ESTALE\n"
3167 "\t لاستيعاب الموقف الذي حُذف فيه مقبض الملف\n"
3168 "\t للكائن قبل استدعاء النظام هذا. */\n"
3169 "\\&\n"
3170 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
3171 " if (event_fd == -1) {\n"
3172 " if (errno == ESTALE) {\n"
3173 " printf(\"File handle is no longer valid. \"\n"
3174 " \"File has been deleted\\[rs]n\");\n"
3175 " continue;\n"
3176 " } else {\n"
3177 " perror(\"open_by_handle_at\");\n"
3178 " exit(EXIT_FAILURE);\n"
3179 " }\n"
3180 " }\n"
3181 "\\&\n"
3182 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
3183 " event_fd);\n"
3184 "\\&\n"
3185 " /* جلب وطباعة مسار dentry المعدل. */\n"
3186 "\\&\n"
3187 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
3188 " if (path_len == -1) {\n"
3189 " perror(\"readlink\");\n"
3190 " exit(EXIT_FAILURE);\n"
3191 " }\n"
3192 "\\&\n"
3193 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
3194 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
3195 "\\&\n"
3196 " if (file_name) {\n"
3197 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
3198 " if (ret == -1) {\n"
3199 " if (errno != ENOENT) {\n"
3200 " perror(\"fstatat\");\n"
3201 " exit(EXIT_FAILURE);\n"
3202 " }\n"
3203 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
3204 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
3205 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
3206 " } else {\n"
3207 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
3208 " file_name);\n"
3209 " }\n"
3210 " }\n"
3211 "\\&\n"
3212 " /* إغلاق واصف الملف المرتبط بهذا الحدث. */\n"
3213 "\\&\n"
3214 " close(event_fd);\n"
3215 " }\n"
3216 "\\&\n"
3217 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
3218 " exit(EXIT_SUCCESS);\n"
3219 "}\n"
3220
3221 #. type: SH
3222 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3223 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3224 #, no-wrap
3225 msgid "SEE ALSO"
3226 msgstr "انظر أيضًا"
3227
3228 #. type: Plain text
3229 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3230 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3231 msgid "B<fanotify_init>(2), B<fanotify_mark>(2), B<inotify>(7)"
3232 msgstr "B<fanotify_init>(2)، B<fanotify_mark>(2)، B<inotify>(7)"
3233
3234 #. type: TH
3235 #: debian-trixie
3236 #, no-wrap
3237 msgid "2024-06-15"
3238 msgstr "15 يونيو 2024"
3239
3240 #. type: TH
3241 #: debian-trixie
3242 #, no-wrap
3243 msgid "Linux man-pages 6.9.1"
3244 msgstr "صفحات دليل لينكس 6.9.1"
3245
3246 #. type: Plain text
3247 #: debian-trixie
3248 msgid ""
3249 "This is the length of the data for the current event and the offset to the "
3250 "next event in the buffer. Unless the group identifies filesystem objects by "
3251 "file handles, the value of I<event_len> is always "
3252 "B<FAN_EVENT_METADATA_LEN>. For a group that identifies filesystem objects "
3253 "by file handles, I<event_len> also includes the variable length file "
3254 "identifier records."
3255 msgstr ""
3256 "هذا هو طول البيانات للحدث الحالي والإزاحة إلى الحدث التالي في الخبيئة. ما لم "
3257 "تحدد المجموعة كائنات نظام الملفات بواسطة مقابض الملفات، فإن قيمة "
3258 "I<event_len> تكون دائمًا B<FAN_EVENT_METADATA_LEN>. بالنسبة لمجموعة تحدد "
3259 "كائنات نظام الملفات بواسطة مقابض الملفات، فإن I<event_len> تتضمن أيضًا سجلات "
3260 "معرف الملف ذات الطول المتغير."
3261
3262 #. type: Plain text
3263 #: debian-trixie
3264 msgid ""
3265 "This is the length of the structure. The field was introduced to facilitate "
3266 "the implementation of optional headers per event type. No such optional "
3267 "headers exist in the current implementation."
3268 msgstr ""
3269 "هذا هو طول البنية. قُدم هذا الحقل لتسهيل تنفيذ ترويسات اختيارية لكل نوع حدث. "
3270 "لا توجد مثل هذه الترويسات الاختيارية في التنفيذ الحالي."
3271
3272 #. type: Plain text
3273 #: debian-trixie fedora-44 fedora-rawhide
3274 msgid ""
3275 "A unique integer value representing the type of information record object "
3276 "received for an event. The value of this field can be set to one of the "
3277 "following: B<FAN_EVENT_INFO_TYPE_FID>, B<FAN_EVENT_INFO_TYPE_DFID>, "
3278 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, or B<FAN_EVENT_INFO_TYPE_PIDFD>. The "
3279 "value set for this field is dependent on the flags that have been supplied "
3280 "to B<fanotify_init>(2). Refer to the field details of each information "
3281 "record object type below to understand the different cases in which the "
3282 "I<info_type> values can be set."
3283 msgstr ""
3284 "قيمة صحيحة فريدة تمثل نوع كائن سجل المعلومات المستلم لحدث ما. يمكن ضبط قيمة "
3285 "هذا الحقل على أحد الخيارات التالية: B<FAN_EVENT_INFO_TYPE_FID> أو "
3286 "B<FAN_EVENT_INFO_TYPE_DFID> أو B<FAN_EVENT_INFO_TYPE_DFID_NAME> أو "
3287 "B<FAN_EVENT_INFO_TYPE_PIDFD>. تعتمد القيمة المضبوطة لهذا الحقل على الأعلام "
3288 "التي وُفرت لـ B<fanotify_init>(2). ارجع إلى تفاصيل الحقل لكل نوع كائن سجل "
3289 "معلومات أدناه لفهم الحالات المختلفة التي يمكن فيها ضبط قيم I<info_type>."
3290
3291 #. type: Plain text
3292 #: debian-trixie
3293 msgid ""
3294 "This is a unique identifier of the filesystem containing the object "
3295 "associated with the event. It is a structure of type I<__kernel_fsid_t> and "
3296 "contains the same value as I<f_fsid> when calling B<statfs>(2)."
3297 msgstr ""
3298 "هذا معرف فريد لنظام الملفات الذي يحتوي على الكائن المرتبط بالحدث. وهو بنية "
3299 "من النوع I<__kernel_fsid_t> ويحتوي على القيمة نفسها لـ I<f_fsid> عند استدعاء "
3300 "B<statfs>(2)."
3301
3302 #. type: Plain text
3303 #: debian-trixie
3304 msgid ""
3305 "This field contains a variable-length structure of type I<struct "
3306 "file_handle>. It is an opaque handle that corresponds to a specified object "
3307 "on a filesystem as returned by B<name_to_handle_at>(2). It can be used to "
3308 "uniquely identify a file on a filesystem and can be passed as an argument to "
3309 "B<open_by_handle_at>(2). If the value of I<info_type> field is "
3310 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the file handle is followed by a null "
3311 "terminated string that identifies the created/deleted/moved directory entry "
3312 "name. For other events such as B<FAN_OPEN>, B<FAN_ATTRIB>, "
3313 "B<FAN_DELETE_SELF>, and B<FAN_MOVE_SELF>, if the value of I<info_type> field "
3314 "is B<FAN_EVENT_INFO_TYPE_FID>, the I<handle> identifies the object "
3315 "correlated to the event. If the value of I<info_type> field is "
3316 "B<FAN_EVENT_INFO_TYPE_DFID>, the I<handle> identifies the directory object "
3317 "correlated to the event or the parent directory of a non-directory object "
3318 "correlated to the event. If the value of I<info_type> field is "
3319 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the I<handle> identifies the same "
3320 "directory object that would be reported with B<FAN_EVENT_INFO_TYPE_DFID> and "
3321 "the file handle is followed by a null terminated string that identifies the "
3322 "name of a directory entry in that directory, or '.' to identify the "
3323 "directory object itself."
3324 msgstr ""
3325 "يحتوي هذا الحقل على بنية متغيرة الطول من النوع I<struct file_handle>. وهو "
3326 "مقبض مبهم يقابل كائنًا محددًا في نظام الملفات كما يُرجعه "
3327 "B<name_to_handle_at>(2). يمكن استخدامه لتحديد ملف بشكل فريد في نظام ملفات "
3328 "ويمكن تمريره كمعامل إلى B<open_by_handle_at>(2). إذا كانت قيمة حقل "
3329 "I<info_type> هي B<FAN_EVENT_INFO_TYPE_DFID_NAME>، فيتبع مقبض الملف سلسلة "
3330 "نصية تنتهي بـ null تحدد اسم مدخل الدليل المنشأ/المحذوف/المنقول. بالنسبة "
3331 "للأحداث الأخرى مثل B<FAN_OPEN> و B<FAN_ATTRIB> و B<FAN_DELETE_SELF> و "
3332 "B<FAN_MOVE_SELF>، فإذا كانت قيمة حقل I<info_type> هي "
3333 "B<FAN_EVENT_INFO_TYPE_FID>، فإن I<handle> يحدد الكائن المرتبط بالحدث. وإذا "
3334 "كانت قيمة حقل I<info_type> هي B<FAN_EVENT_INFO_TYPE_DFID>، فإن I<handle> "
3335 "يحدد كائن الدليل المرتبط بالحدث أو الدليل الأب لكائن ليس دليلًا ومرتبط "
3336 "بالحدث. وإذا كانت قيمة حقل I<info_type> هي B<FAN_EVENT_INFO_TYPE_DFID_NAME>، "
3337 "فإن I<handle> يحدد كائن الدليل نفسه الذي سيُبلغ عنه مع "
3338 "B<FAN_EVENT_INFO_TYPE_DFID> ويتبع مقبض الملف سلسلة نصية تنتهي بـ null تحدد "
3339 "اسم مدخل دليل في ذلك الدليل، أو '.' لتحديد كائن الدليل نفسه."
3340
3341 #. type: TP
3342 #: debian-trixie
3343 #, no-wrap
3344 msgid "B<FAN_EVENT_OK(meta, len)>"
3345 msgstr "B<FAN_EVENT_OK(meta, len)>"
3346
3347 #. type: Plain text
3348 #: debian-trixie
3349 msgid ""
3350 "This macro checks the remaining length I<len> of the buffer I<meta> against "
3351 "the length of the metadata structure and the I<event_len> field of the first "
3352 "metadata structure in the buffer."
3353 msgstr ""
3354 "يتحقق هذا الماكرو من الطول المتبقي I<len> للخبيئة I<meta> مقابل طول بنية "
3355 "البيانات الوصفية وحقل I<event_len> لأول بنية بيانات وصفية في الخبيئة."
3356
3357 #. type: TP
3358 #: debian-trixie
3359 #, no-wrap
3360 msgid "B<FAN_EVENT_NEXT(meta, len)>"
3361 msgstr "B<FAN_EVENT_NEXT(meta, len)>"
3362
3363 #. type: Plain text
3364 #: debian-trixie
3365 msgid ""
3366 "This macro uses the length indicated in the I<event_len> field of the "
3367 "metadata structure pointed to by I<meta> to calculate the address of the "
3368 "next metadata structure that follows I<meta>. I<len> is the number of bytes "
3369 "of metadata that currently remain in the buffer. The macro returns a "
3370 "pointer to the next metadata structure that follows I<meta>, and reduces "
3371 "I<len> by the number of bytes in the metadata structure that has been "
3372 "skipped over (i.e., it subtracts I<meta-E<gt>event_len> from I<len>)."
3373 msgstr ""
3374 "يستخدم هذا الماكرو الطول المشار إليه في حقل I<event_len> لبنية البيانات "
3375 "الوصفية التي يشير إليها I<meta> لحساب عنوان بنية البيانات الوصفية التالية "
3376 "التي تلي I<meta>. I<len> هو عدد بايتات البيانات الوصفية المتبقية حاليًا في "
3377 "الخبيئة. يُرجع الماكرو مؤشرًا إلى بنية البيانات الوصفية التالية التي تلي "
3378 "I<meta>، ويقلل I<len> بمقدار عدد البايتات في بنية البيانات الوصفية التي جرى "
3379 "تخطيها (أي يطرح I<meta-E<gt>event_len> من I<len>)."
3380
3381 #. type: Plain text
3382 #: debian-trixie fedora-44 fedora-rawhide
3383 msgid ""
3384 "This field indicates whether or not the permission is to be granted. Its "
3385 "value must be either B<FAN_ALLOW> to allow the file operation or B<FAN_DENY> "
3386 "to deny the file operation."
3387 msgstr ""
3388 "يشير هذا الحقل إلى ما إذا كان سيُمنح الإذن أم لا. يجب أن تكون قيمته إما "
3389 "B<FAN_ALLOW> للسماح بعملية الملف أو B<FAN_DENY> لرفض عملية الملف."
3390
3391 #. type: Plain text
3392 #: debian-trixie fedora-44 fedora-rawhide
3393 msgid ""
3394 "If access is denied, the requesting application call will receive an "
3395 "B<EPERM> error. Additionally, if the notification group has been created "
3396 "with the B<FAN_ENABLE_AUDIT> flag, then the B<FAN_AUDIT> flag can be set in "
3397 "the I<response> field. In that case, the audit subsystem will log "
3398 "information about the access decision to the audit logs."
3399 msgstr ""
3400 "إذا رُفض الوصول، فسيستلم استدعاء التطبيق الطالب خطأ B<EPERM>. بالإضافة إلى "
3401 "ذلك، إذا أُنشئت مجموعة الإشعارات مع علم B<FAN_ENABLE_AUDIT>، فيمكن ضبط علم "
3402 "B<FAN_AUDIT> في حقل I<response>. في تلك الحالة، سيقوم نظام التدقيق (audit) "
3403 "بتسجيل معلومات حول قرار الوصول في سجلات التدقيق."
3404
3405 #. type: Plain text
3406 #: debian-trixie fedora-44 fedora-rawhide
3407 msgid ""
3408 "Errors not directly related to a file (i.e. super block corruption) are "
3409 "reported with an invalid I<handle>. For these errors, the I<handle> will "
3410 "have the field I<handle_type> set to B<FILEID_INVALID>, and the handle "
3411 "buffer size set to B<0>."
3412 msgstr ""
3413 "الأخطاء غير المرتبطة مباشرة بملف (أي تلف الكتلة الفائقة) يُبلغ عنها بـ "
3414 "I<handle> غير صالح. لهذه الأخطاء، سيُضبط حقل I<handle_type> في I<handle> على "
3415 "B<FILEID_INVALID>، ويُضبط حجم مخزن المقبض على B<0>."
3416
3417 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
3418 #. type: Plain text
3419 #: debian-trixie
3420 msgid ""
3421 "Since Linux 5.13, the following interfaces can be used to control the amount "
3422 "of kernel resources consumed by fanotify:"
3423 msgstr ""
3424 "منذ لينكس 5.13، يمكن استخدام الواجهات التالية للتحكم في كمية موارد النواة "
3425 "التي يستهلكها fanotify:"
3426
3427 #. type: Plain text
3428 #: debian-trixie
3429 msgid ""
3430 "If a call to B<read>(2) processes multiple events from the fanotify queue "
3431 "and an error occurs, the return value will be the total length of the events "
3432 "successfully copied to the user-space buffer before the error occurred. The "
3433 "return value will not be -1, and I<errno> will not be set. Thus, the "
3434 "reading application has no way to detect the error."
3435 msgstr ""
3436 "إذا عالج استدعاء B<read>(2) أحداثًا متعددة من طابور fanotify ووقع خطأ، فستكون "
3437 "القيمة المرجعة هي الطول الإجمالي للأحداث التي نُسخت بنجاح إلى خبيئة مساحة "
3438 "المستخدم قبل وقوع الخطأ. لن تكون القيمة المرجعة -1، ولن يُضبط I<errno>. "
3439 "وبالتالي، لا تملك التطبيقات القارئة أي وسيلة لاكتشاف الخطأ."
3440
3441 #. type: Plain text
3442 #: debian-trixie fedora-44 fedora-rawhide
3443 #, no-wrap
3444 msgid ""
3445 "# B<./fanotify_example /home>\n"
3446 "Press enter key to terminate.\n"
3447 "Listening for events.\n"
3448 "FAN_OPEN_PERM: File /home/user/temp/notes\n"
3449 "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
3450 "\\&\n"
3451 "Listening for events stopped.\n"
3452 msgstr ""
3453 "#B<./fanotify_example /home>;\n"
3454 "اضغط على مفتاح ENTER للإنهاء.\n"
3455 "الاستماع للأحداث.\n"
3456 "FAN_OPEN_PERM: File /home/user/temp/notes\n"
3457 "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
3458 "\\&\n"
3459 "توقف الاستماع للأحداث.\n"
3460
3461 #. type: Plain text
3462 #: debian-trixie
3463 #, no-wrap
3464 msgid ""
3465 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
3466 "#include E<lt>errno.hE<gt>\n"
3467 "#include E<lt>fcntl.hE<gt>\n"
3468 "#include E<lt>limits.hE<gt>\n"
3469 "#include E<lt>poll.hE<gt>\n"
3470 "#include E<lt>stdio.hE<gt>\n"
3471 "#include E<lt>stdlib.hE<gt>\n"
3472 "#include E<lt>sys/fanotify.hE<gt>\n"
3473 "#include E<lt>unistd.hE<gt>\n"
3474 "\\&\n"
3475 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
3476 "\\&\n"
3477 "static void\n"
3478 "handle_events(int fd)\n"
3479 "{\n"
3480 " const struct fanotify_event_metadata *metadata;\n"
3481 " struct fanotify_event_metadata buf[200];\n"
3482 " ssize_t len;\n"
3483 " char path[PATH_MAX];\n"
3484 " ssize_t path_len;\n"
3485 " char procfd_path[PATH_MAX];\n"
3486 " struct fanotify_response response;\n"
3487 "\\&\n"
3488 " /* Loop while events can be read from fanotify file descriptor. */\n"
3489 "\\&\n"
3490 " for (;;) {\n"
3491 "\\&\n"
3492 " /* Read some events. */\n"
3493 "\\&\n"
3494 " len = read(fd, buf, sizeof(buf));\n"
3495 " if (len == -1 && errno != EAGAIN) {\n"
3496 " perror(\"read\");\n"
3497 " exit(EXIT_FAILURE);\n"
3498 " }\n"
3499 "\\&\n"
3500 " /* Check if end of available data reached. */\n"
3501 "\\&\n"
3502 " if (len E<lt>= 0)\n"
3503 " break;\n"
3504 "\\&\n"
3505 " /* Point to the first event in the buffer. */\n"
3506 "\\&\n"
3507 " metadata = buf;\n"
3508 "\\&\n"
3509 " /* Loop over all events in the buffer. */\n"
3510 "\\&\n"
3511 " while (FAN_EVENT_OK(metadata, len)) {\n"
3512 "\\&\n"
3513 " /* Check that run-time and compile-time structures match. */\n"
3514 "\\&\n"
3515 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
3516 " fprintf(stderr,\n"
3517 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
3518 " exit(EXIT_FAILURE);\n"
3519 " }\n"
3520 "\\&\n"
3521 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
3522 " queue overflow, or a file descriptor (a nonnegative\n"
3523 " integer). Here, we simply ignore queue overflow. */\n"
3524 "\\&\n"
3525 " if (metadata-E<gt>fd E<gt>= 0) {\n"
3526 "\\&\n"
3527 " /* Handle open permission event. */\n"
3528 "\\&\n"
3529 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
3530 " printf(\"FAN_OPEN_PERM: \");\n"
3531 "\\&\n"
3532 " /* Allow file to be opened. */\n"
3533 "\\&\n"
3534 " response.fd = metadata-E<gt>fd;\n"
3535 " response.response = FAN_ALLOW;\n"
3536 " write(fd, &response, sizeof(response));\n"
3537 " }\n"
3538 "\\&\n"
3539 " /* Handle closing of writable file event. */\n"
3540 "\\&\n"
3541 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
3542 " printf(\"FAN_CLOSE_WRITE: \");\n"
3543 "\\&\n"
3544 " /* Retrieve and print pathname of the accessed file. */\n"
3545 "\\&\n"
3546 " snprintf(procfd_path, sizeof(procfd_path),\n"
3547 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
3548 " path_len = readlink(procfd_path, path,\n"
3549 " sizeof(path) - 1);\n"
3550 " if (path_len == -1) {\n"
3551 " perror(\"readlink\");\n"
3552 " exit(EXIT_FAILURE);\n"
3553 " }\n"
3554 "\\&\n"
3555 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
3556 " printf(\"File %s\\[rs]n\", path);\n"
3557 "\\&\n"
3558 " /* Close the file descriptor of the event. */\n"
3559 "\\&\n"
3560 " close(metadata-E<gt>fd);\n"
3561 " }\n"
3562 "\\&\n"
3563 " /* Advance to next event. */\n"
3564 "\\&\n"
3565 " metadata = FAN_EVENT_NEXT(metadata, len);\n"
3566 " }\n"
3567 " }\n"
3568 "}\n"
3569 "\\&\n"
3570 "int\n"
3571 "main(int argc, char *argv[])\n"
3572 "{\n"
3573 " char buf;\n"
3574 " int fd, poll_num;\n"
3575 " nfds_t nfds;\n"
3576 " struct pollfd fds[2];\n"
3577 "\\&\n"
3578 " /* Check mount point is supplied. */\n"
3579 "\\&\n"
3580 " if (argc != 2) {\n"
3581 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
3582 " exit(EXIT_FAILURE);\n"
3583 " }\n"
3584 "\\&\n"
3585 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
3586 "\\&\n"
3587 " /* Create the file descriptor for accessing the fanotify API. */\n"
3588 "\\&\n"
3589 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
3590 " O_RDONLY | O_LARGEFILE);\n"
3591 " if (fd == -1) {\n"
3592 " perror(\"fanotify_init\");\n"
3593 " exit(EXIT_FAILURE);\n"
3594 " }\n"
3595 "\\&\n"
3596 " /* Mark the mount for:\n"
3597 " - permission events before opening files\n"
3598 " - notification events after closing a write-enabled\n"
3599 " file descriptor. */\n"
3600 "\\&\n"
3601 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
3602 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
3603 " argv[1]) == -1) {\n"
3604 " perror(\"fanotify_mark\");\n"
3605 " exit(EXIT_FAILURE);\n"
3606 " }\n"
3607 "\\&\n"
3608 " /* Prepare for polling. */\n"
3609 "\\&\n"
3610 " nfds = 2;\n"
3611 "\\&\n"
3612 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
3613 " fds[0].events = POLLIN;\n"
3614 "\\&\n"
3615 " fds[1].fd = fd; /* Fanotify input */\n"
3616 " fds[1].events = POLLIN;\n"
3617 "\\&\n"
3618 " /* This is the loop to wait for incoming events. */\n"
3619 "\\&\n"
3620 " printf(\"Listening for events.\\[rs]n\");\n"
3621 "\\&\n"
3622 " while (1) {\n"
3623 " poll_num = poll(fds, nfds, -1);\n"
3624 " if (poll_num == -1) {\n"
3625 " if (errno == EINTR) /* Interrupted by a signal */\n"
3626 " continue; /* Restart poll() */\n"
3627 "\\&\n"
3628 " perror(\"poll\"); /* Unexpected error */\n"
3629 " exit(EXIT_FAILURE);\n"
3630 " }\n"
3631 "\\&\n"
3632 " if (poll_num E<gt> 0) {\n"
3633 " if (fds[0].revents & POLLIN) {\n"
3634 "\\&\n"
3635 " /* Console input is available: empty stdin and quit. */\n"
3636 "\\&\n"
3637 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
3638 " continue;\n"
3639 " break;\n"
3640 " }\n"
3641 "\\&\n"
3642 " if (fds[1].revents & POLLIN) {\n"
3643 "\\&\n"
3644 " /* Fanotify events are available. */\n"
3645 "\\&\n"
3646 " handle_events(fd);\n"
3647 " }\n"
3648 " }\n"
3649 " }\n"
3650 "\\&\n"
3651 " printf(\"Listening for events stopped.\\[rs]n\");\n"
3652 " exit(EXIT_SUCCESS);\n"
3653 "}\n"
3654 msgstr ""
3655 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
3656 "#include E<lt>errno.hE<gt>\n"
3657 "#include E<lt>fcntl.hE<gt>\n"
3658 "#include E<lt>limits.hE<gt>\n"
3659 "#include E<lt>poll.hE<gt>\n"
3660 "#include E<lt>stdio.hE<gt>\n"
3661 "#include E<lt>stdlib.hE<gt>\n"
3662 "#include E<lt>sys/fanotify.hE<gt>\n"
3663 "#include E<lt>unistd.hE<gt>\n"
3664 "\\&\n"
3665 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
3666 "\\&\n"
3667 "static void\n"
3668 "handle_events(int fd)\n"
3669 "{\n"
3670 " const struct fanotify_event_metadata *metadata;\n"
3671 " struct fanotify_event_metadata buf[200];\n"
3672 " ssize_t len;\n"
3673 " char path[PATH_MAX];\n"
3674 " ssize_t path_len;\n"
3675 " char procfd_path[PATH_MAX];\n"
3676 " struct fanotify_response response;\n"
3677 "\\&\n"
3678 " /* Loop while events can be read from fanotify file descriptor. */\n"
3679 "\\&\n"
3680 " for (;;) {\n"
3681 "\\&\n"
3682 " /* Read some events. */\n"
3683 "\\&\n"
3684 " len = read(fd, buf, sizeof(buf));\n"
3685 " if (len == -1 && errno != EAGAIN) {\n"
3686 " perror(\"read\");\n"
3687 " exit(EXIT_FAILURE);\n"
3688 " }\n"
3689 "\\&\n"
3690 " /* Check if end of available data reached. */\n"
3691 "\\&\n"
3692 " if (len E<lt>= 0)\n"
3693 " break;\n"
3694 "\\&\n"
3695 " /* Point to the first event in the buffer. */\n"
3696 "\\&\n"
3697 " metadata = buf;\n"
3698 "\\&\n"
3699 " /* Loop over all events in the buffer. */\n"
3700 "\\&\n"
3701 " while (FAN_EVENT_OK(metadata, len)) {\n"
3702 "\\&\n"
3703 " /* Check that run-time and compile-time structures match. */\n"
3704 "\\&\n"
3705 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
3706 " fprintf(stderr,\n"
3707 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
3708 " exit(EXIT_FAILURE);\n"
3709 " }\n"
3710 "\\&\n"
3711 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
3712 " queue overflow, or a file descriptor (a nonnegative\n"
3713 " integer). Here, we simply ignore queue overflow. */\n"
3714 "\\&\n"
3715 " if (metadata-E<gt>fd E<gt>= 0) {\n"
3716 "\\&\n"
3717 " /* Handle open permission event. */\n"
3718 "\\&\n"
3719 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
3720 " printf(\"FAN_OPEN_PERM: \");\n"
3721 "\\&\n"
3722 " /* Allow file to be opened. */\n"
3723 "\\&\n"
3724 " response.fd = metadata-E<gt>fd;\n"
3725 " response.response = FAN_ALLOW;\n"
3726 " write(fd, &response, sizeof(response));\n"
3727 " }\n"
3728 "\\&\n"
3729 " /* Handle closing of writable file event. */\n"
3730 "\\&\n"
3731 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
3732 " printf(\"FAN_CLOSE_WRITE: \");\n"
3733 "\\&\n"
3734 " /* Retrieve and print pathname of the accessed file. */\n"
3735 "\\&\n"
3736 " snprintf(procfd_path, sizeof(procfd_path),\n"
3737 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
3738 " path_len = readlink(procfd_path, path,\n"
3739 " sizeof(path) - 1);\n"
3740 " if (path_len == -1) {\n"
3741 " perror(\"readlink\");\n"
3742 " exit(EXIT_FAILURE);\n"
3743 " }\n"
3744 "\\&\n"
3745 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
3746 " printf(\"File %s\\[rs]n\", path);\n"
3747 "\\&\n"
3748 " /* Close the file descriptor of the event. */\n"
3749 "\\&\n"
3750 " close(metadata-E<gt>fd);\n"
3751 " }\n"
3752 "\\&\n"
3753 " /* Advance to next event. */\n"
3754 "\\&\n"
3755 " metadata = FAN_EVENT_NEXT(metadata, len);\n"
3756 " }\n"
3757 " }\n"
3758 "}\n"
3759 "\\&\n"
3760 "int\n"
3761 "main(int argc, char *argv[])\n"
3762 "{\n"
3763 " char buf;\n"
3764 " int fd, poll_num;\n"
3765 " nfds_t nfds;\n"
3766 " struct pollfd fds[2];\n"
3767 "\\&\n"
3768 " /* Check mount point is supplied. */\n"
3769 "\\&\n"
3770 " if (argc != 2) {\n"
3771 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
3772 " exit(EXIT_FAILURE);\n"
3773 " }\n"
3774 "\\&\n"
3775 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
3776 "\\&\n"
3777 " /* Create the file descriptor for accessing the fanotify API. */\n"
3778 "\\&\n"
3779 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
3780 " O_RDONLY | O_LARGEFILE);\n"
3781 " if (fd == -1) {\n"
3782 " perror(\"fanotify_init\");\n"
3783 " exit(EXIT_FAILURE);\n"
3784 " }\n"
3785 "\\&\n"
3786 " /* Mark the mount for:\n"
3787 " - permission events before opening files\n"
3788 " - notification events after closing a write-enabled\n"
3789 " file descriptor. */\n"
3790 "\\&\n"
3791 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
3792 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
3793 " argv[1]) == -1) {\n"
3794 " perror(\"fanotify_mark\");\n"
3795 " exit(EXIT_FAILURE);\n"
3796 " }\n"
3797 "\\&\n"
3798 " /* Prepare for polling. */\n"
3799 "\\&\n"
3800 " nfds = 2;\n"
3801 "\\&\n"
3802 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
3803 " fds[0].events = POLLIN;\n"
3804 "\\&\n"
3805 " fds[1].fd = fd; /* Fanotify input */\n"
3806 " fds[1].events = POLLIN;\n"
3807 "\\&\n"
3808 " /* This is the loop to wait for incoming events. */\n"
3809 "\\&\n"
3810 " printf(\"Listening for events.\\[rs]n\");\n"
3811 "\\&\n"
3812 " while (1) {\n"
3813 " poll_num = poll(fds, nfds, -1);\n"
3814 " if (poll_num == -1) {\n"
3815 " if (errno == EINTR) /* Interrupted by a signal */\n"
3816 " continue; /* Restart poll() */\n"
3817 "\\&\n"
3818 " perror(\"poll\"); /* Unexpected error */\n"
3819 " exit(EXIT_FAILURE);\n"
3820 " }\n"
3821 "\\&\n"
3822 " if (poll_num E<gt> 0) {\n"
3823 " if (fds[0].revents & POLLIN) {\n"
3824 "\\&\n"
3825 " /* Console input is available: empty stdin and quit. */\n"
3826 "\\&\n"
3827 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
3828 " continue;\n"
3829 " break;\n"
3830 " }\n"
3831 "\\&\n"
3832 " if (fds[1].revents & POLLIN) {\n"
3833 "\\&\n"
3834 " /* Fanotify events are available. */\n"
3835 "\\&\n"
3836 " handle_events(fd);\n"
3837 " }\n"
3838 " }\n"
3839 " }\n"
3840 "\\&\n"
3841 " printf(\"Listening for events stopped.\\[rs]n\");\n"
3842 " exit(EXIT_SUCCESS);\n"
3843 "}\n"
3844
3845 #. type: Plain text
3846 #: debian-trixie fedora-44 fedora-rawhide
3847 #, no-wrap
3848 msgid ""
3849 "# B<./fanotify_fid /home/user>\n"
3850 "Listening for events.\n"
3851 "FAN_CREATE (file created):\n"
3852 " Directory /home/user has been modified.\n"
3853 " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n"
3854 "All events processed successfully. Program exiting.\n"
3855 "\\&\n"
3856 "$ B<touch /home/user/testfile.txt> # In another terminal\n"
3857 msgstr ""
3858 "# B<./fanotify_fid /home/user>\n"
3859 "Listening for events.\n"
3860 "FAN_CREATE (file created):\n"
3861 " Directory /home/user has been modified.\n"
3862 " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n"
3863 "All events processed successfully. Program exiting.\n"
3864 "\\&\n"
3865 "$ B<touch /home/user/testfile.txt> # In another terminal\n"
3866
3867 #. type: Plain text
3868 #: debian-trixie fedora-44 fedora-rawhide
3869 #, no-wrap
3870 msgid ""
3871 "# B<./fanotify_fid /home/user>\n"
3872 "Listening for events.\n"
3873 "FAN_CREATE | FAN_ONDIR (subdirectory created):\n"
3874 " Directory /home/user has been modified.\n"
3875 " Entry \\[aq]testdir\\[aq] is a subdirectory.\n"
3876 "All events processed successfully. Program exiting.\n"
3877 "\\&\n"
3878 "$ B<mkdir -p /home/user/testdir> # In another terminal\n"
3879 msgstr ""
3880 "# B<./fanotify_fid /home/user>\n"
3881 "Listening for events.\n"
3882 "FAN_CREATE | FAN_ONDIR (subdirectory created):\n"
3883 " Directory /home/user has been modified.\n"
3884 " Entry \\[aq]testdir\\[aq] is a subdirectory.\n"
3885 "All events processed successfully. Program exiting.\n"
3886 "\\&\n"
3887 "$ B<mkdir -p /home/user/testdir> # In another terminal\n"
3888
3889 #. type: Plain text
3890 #: debian-trixie
3891 #, no-wrap
3892 msgid ""
3893 "#define _GNU_SOURCE\n"
3894 "#include E<lt>errno.hE<gt>\n"
3895 "#include E<lt>fcntl.hE<gt>\n"
3896 "#include E<lt>limits.hE<gt>\n"
3897 "#include E<lt>stdio.hE<gt>\n"
3898 "#include E<lt>stdlib.hE<gt>\n"
3899 "#include E<lt>sys/types.hE<gt>\n"
3900 "#include E<lt>sys/stat.hE<gt>\n"
3901 "#include E<lt>sys/fanotify.hE<gt>\n"
3902 "#include E<lt>unistd.hE<gt>\n"
3903 "\\&\n"
3904 "#define BUF_SIZE 256\n"
3905 "\\&\n"
3906 "int\n"
3907 "main(int argc, char *argv[])\n"
3908 "{\n"
3909 " int fd, ret, event_fd, mount_fd;\n"
3910 " ssize_t len, path_len;\n"
3911 " char path[PATH_MAX];\n"
3912 " char procfd_path[PATH_MAX];\n"
3913 " char events_buf[BUF_SIZE];\n"
3914 " struct file_handle *file_handle;\n"
3915 " struct fanotify_event_metadata *metadata;\n"
3916 " struct fanotify_event_info_fid *fid;\n"
3917 " const char *file_name;\n"
3918 " struct stat sb;\n"
3919 "\\&\n"
3920 " if (argc != 2) {\n"
3921 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
3922 " exit(EXIT_FAILURE);\n"
3923 " }\n"
3924 "\\&\n"
3925 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
3926 " if (mount_fd == -1) {\n"
3927 " perror(argv[1]);\n"
3928 " exit(EXIT_FAILURE);\n"
3929 " }\n"
3930 "\\&\n"
3931 " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
3932 " a flag so that program can receive fid events with directory\n"
3933 " entry name. */\n"
3934 "\\&\n"
3935 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
3936 " if (fd == -1) {\n"
3937 " perror(\"fanotify_init\");\n"
3938 " exit(EXIT_FAILURE);\n"
3939 " }\n"
3940 "\\&\n"
3941 " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
3942 "\\&\n"
3943 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
3944 " FAN_CREATE | FAN_ONDIR,\n"
3945 " AT_FDCWD, argv[1]);\n"
3946 " if (ret == -1) {\n"
3947 " perror(\"fanotify_mark\");\n"
3948 " exit(EXIT_FAILURE);\n"
3949 " }\n"
3950 "\\&\n"
3951 " printf(\"Listening for events.\\[rs]n\");\n"
3952 "\\&\n"
3953 " /* Read events from the event queue into a buffer. */\n"
3954 "\\&\n"
3955 " len = read(fd, events_buf, sizeof(events_buf));\n"
3956 " if (len == -1 && errno != EAGAIN) {\n"
3957 " perror(\"read\");\n"
3958 " exit(EXIT_FAILURE);\n"
3959 " }\n"
3960 "\\&\n"
3961 " /* Process all events within the buffer. */\n"
3962 "\\&\n"
3963 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
3964 " FAN_EVENT_OK(metadata, len);\n"
3965 " metadata = FAN_EVENT_NEXT(metadata, len)) {\n"
3966 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
3967 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
3968 "\\&\n"
3969 " /* Ensure that the event info is of the correct type. */\n"
3970 "\\&\n"
3971 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
3972 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
3973 " file_name = NULL;\n"
3974 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
3975 " file_name = file_handle-E<gt>f_handle +\n"
3976 " file_handle-E<gt>handle_bytes;\n"
3977 " } else {\n"
3978 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
3979 " exit(EXIT_FAILURE);\n"
3980 " }\n"
3981 "\\&\n"
3982 " if (metadata-E<gt>mask == FAN_CREATE)\n"
3983 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
3984 "\\&\n"
3985 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
3986 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
3987 "\\&\n"
3988 "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
3989 "\t objects by file handles. To obtain a file descriptor for\n"
3990 "\t the file object corresponding to an event you can use the\n"
3991 "\t struct file_handle that\\[aq]s provided within the\n"
3992 "\t fanotify_event_info_fid in conjunction with the\n"
3993 "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
3994 "\t done to accommodate for the situation where the file handle\n"
3995 "\t for the object was deleted prior to this system call. */\n"
3996 "\\&\n"
3997 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
3998 " if (event_fd == -1) {\n"
3999 " if (errno == ESTALE) {\n"
4000 " printf(\"File handle is no longer valid. \"\n"
4001 " \"File has been deleted\\[rs]n\");\n"
4002 " continue;\n"
4003 " } else {\n"
4004 " perror(\"open_by_handle_at\");\n"
4005 " exit(EXIT_FAILURE);\n"
4006 " }\n"
4007 " }\n"
4008 "\\&\n"
4009 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
4010 " event_fd);\n"
4011 "\\&\n"
4012 " /* Retrieve and print the path of the modified dentry. */\n"
4013 "\\&\n"
4014 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
4015 " if (path_len == -1) {\n"
4016 " perror(\"readlink\");\n"
4017 " exit(EXIT_FAILURE);\n"
4018 " }\n"
4019 "\\&\n"
4020 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4021 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
4022 "\\&\n"
4023 " if (file_name) {\n"
4024 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
4025 " if (ret == -1) {\n"
4026 " if (errno != ENOENT) {\n"
4027 " perror(\"fstatat\");\n"
4028 " exit(EXIT_FAILURE);\n"
4029 " }\n"
4030 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
4031 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
4032 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
4033 " } else {\n"
4034 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
4035 " file_name);\n"
4036 " }\n"
4037 " }\n"
4038 "\\&\n"
4039 " /* Close associated file descriptor for this event. */\n"
4040 "\\&\n"
4041 " close(event_fd);\n"
4042 " }\n"
4043 "\\&\n"
4044 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
4045 " exit(EXIT_SUCCESS);\n"
4046 "}\n"
4047 msgstr ""
4048 "#define _GNU_SOURCE\n"
4049 "#include E<lt>errno.hE<gt>\n"
4050 "#include E<lt>fcntl.hE<gt>\n"
4051 "#include E<lt>limits.hE<gt>\n"
4052 "#include E<lt>stdio.hE<gt>\n"
4053 "#include E<lt>stdlib.hE<gt>\n"
4054 "#include E<lt>sys/types.hE<gt>\n"
4055 "#include E<lt>sys/stat.hE<gt>\n"
4056 "#include E<lt>sys/fanotify.hE<gt>\n"
4057 "#include E<lt>unistd.hE<gt>\n"
4058 "\\&\n"
4059 "#define BUF_SIZE 256\n"
4060 "\\&\n"
4061 "int\n"
4062 "main(int argc, char *argv[])\n"
4063 "{\n"
4064 " int fd, ret, event_fd, mount_fd;\n"
4065 " ssize_t len, path_len;\n"
4066 " char path[PATH_MAX];\n"
4067 " char procfd_path[PATH_MAX];\n"
4068 " char events_buf[BUF_SIZE];\n"
4069 " struct file_handle *file_handle;\n"
4070 " struct fanotify_event_metadata *metadata;\n"
4071 " struct fanotify_event_info_fid *fid;\n"
4072 " const char *file_name;\n"
4073 " struct stat sb;\n"
4074 "\\&\n"
4075 " if (argc != 2) {\n"
4076 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
4077 " exit(EXIT_FAILURE);\n"
4078 " }\n"
4079 "\\&\n"
4080 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
4081 " if (mount_fd == -1) {\n"
4082 " perror(argv[1]);\n"
4083 " exit(EXIT_FAILURE);\n"
4084 " }\n"
4085 "\\&\n"
4086 " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
4087 " a flag so that program can receive fid events with directory\n"
4088 " entry name. */\n"
4089 "\\&\n"
4090 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
4091 " if (fd == -1) {\n"
4092 " perror(\"fanotify_init\");\n"
4093 " exit(EXIT_FAILURE);\n"
4094 " }\n"
4095 "\\&\n"
4096 " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
4097 "\\&\n"
4098 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
4099 " FAN_CREATE | FAN_ONDIR,\n"
4100 " AT_FDCWD, argv[1]);\n"
4101 " if (ret == -1) {\n"
4102 " perror(\"fanotify_mark\");\n"
4103 " exit(EXIT_FAILURE);\n"
4104 " }\n"
4105 "\\&\n"
4106 " printf(\"Listening for events.\\[rs]n\");\n"
4107 "\\&\n"
4108 " /* Read events from the event queue into a buffer. */\n"
4109 "\\&\n"
4110 " len = read(fd, events_buf, sizeof(events_buf));\n"
4111 " if (len == -1 && errno != EAGAIN) {\n"
4112 " perror(\"read\");\n"
4113 " exit(EXIT_FAILURE);\n"
4114 " }\n"
4115 "\\&\n"
4116 " /* Process all events within the buffer. */\n"
4117 "\\&\n"
4118 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
4119 " FAN_EVENT_OK(metadata, len);\n"
4120 " metadata = FAN_EVENT_NEXT(metadata, len)) {\n"
4121 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
4122 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
4123 "\\&\n"
4124 " /* Ensure that the event info is of the correct type. */\n"
4125 "\\&\n"
4126 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
4127 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
4128 " file_name = NULL;\n"
4129 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
4130 " file_name = file_handle-E<gt>f_handle +\n"
4131 " file_handle-E<gt>handle_bytes;\n"
4132 " } else {\n"
4133 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
4134 " exit(EXIT_FAILURE);\n"
4135 " }\n"
4136 "\\&\n"
4137 " if (metadata-E<gt>mask == FAN_CREATE)\n"
4138 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
4139 "\\&\n"
4140 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
4141 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
4142 "\\&\n"
4143 "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
4144 "\t objects by file handles. To obtain a file descriptor for\n"
4145 "\t the file object corresponding to an event you can use the\n"
4146 "\t struct file_handle that\\[aq]s provided within the\n"
4147 "\t fanotify_event_info_fid in conjunction with the\n"
4148 "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
4149 "\t done to accommodate for the situation where the file handle\n"
4150 "\t for the object was deleted prior to this system call. */\n"
4151 "\\&\n"
4152 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
4153 " if (event_fd == -1) {\n"
4154 " if (errno == ESTALE) {\n"
4155 " printf(\"File handle is no longer valid. \"\n"
4156 " \"File has been deleted\\[rs]n\");\n"
4157 " continue;\n"
4158 " } else {\n"
4159 " perror(\"open_by_handle_at\");\n"
4160 " exit(EXIT_FAILURE);\n"
4161 " }\n"
4162 " }\n"
4163 "\\&\n"
4164 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
4165 " event_fd);\n"
4166 "\\&\n"
4167 " /* Retrieve and print the path of the modified dentry. */\n"
4168 "\\&\n"
4169 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
4170 " if (path_len == -1) {\n"
4171 " perror(\"readlink\");\n"
4172 " exit(EXIT_FAILURE);\n"
4173 " }\n"
4174 "\\&\n"
4175 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4176 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
4177 "\\&\n"
4178 " if (file_name) {\n"
4179 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
4180 " if (ret == -1) {\n"
4181 " if (errno != ENOENT) {\n"
4182 " perror(\"fstatat\");\n"
4183 " exit(EXIT_FAILURE);\n"
4184 " }\n"
4185 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
4186 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
4187 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
4188 " } else {\n"
4189 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
4190 " file_name);\n"
4191 " }\n"
4192 " }\n"
4193 "\\&\n"
4194 " /* Close associated file descriptor for this event. */\n"
4195 "\\&\n"
4196 " close(event_fd);\n"
4197 " }\n"
4198 "\\&\n"
4199 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
4200 " exit(EXIT_SUCCESS);\n"
4201 "}\n"
4202
4203 #. type: TH
4204 #: fedora-44 fedora-rawhide
4205 #, no-wrap
4206 msgid "2024-11-17"
4207 msgstr "17 نوفمبر 2024"
4208
4209 #. type: TH
4210 #: fedora-44 fedora-rawhide
4211 #, no-wrap
4212 msgid "Linux man-pages 6.13"
4213 msgstr "صفحات دليل لينكس 6.13"
4214
4215 #. type: Plain text
4216 #: fedora-44 fedora-rawhide
4217 #, no-wrap
4218 msgid ""
4219 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
4220 "#include E<lt>errno.hE<gt>\n"
4221 "#include E<lt>fcntl.hE<gt>\n"
4222 "#include E<lt>limits.hE<gt>\n"
4223 "#include E<lt>poll.hE<gt>\n"
4224 "#include E<lt>stdio.hE<gt>\n"
4225 "#include E<lt>stdlib.hE<gt>\n"
4226 "#include E<lt>sys/fanotify.hE<gt>\n"
4227 "#include E<lt>unistd.hE<gt>\n"
4228 "\\&\n"
4229 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
4230 "\\&\n"
4231 "static void\n"
4232 "handle_events(int fd)\n"
4233 "{\n"
4234 " const struct fanotify_event_metadata *metadata;\n"
4235 " struct fanotify_event_metadata buf[200];\n"
4236 " ssize_t size;\n"
4237 " char path[PATH_MAX];\n"
4238 " ssize_t path_len;\n"
4239 " char procfd_path[PATH_MAX];\n"
4240 " struct fanotify_response response;\n"
4241 "\\&\n"
4242 " /* Loop while events can be read from fanotify file descriptor. */\n"
4243 "\\&\n"
4244 " for (;;) {\n"
4245 "\\&\n"
4246 " /* Read some events. */\n"
4247 "\\&\n"
4248 " size = read(fd, buf, sizeof(buf));\n"
4249 " if (size == -1 && errno != EAGAIN) {\n"
4250 " perror(\"read\");\n"
4251 " exit(EXIT_FAILURE);\n"
4252 " }\n"
4253 "\\&\n"
4254 " /* Check if end of available data reached. */\n"
4255 "\\&\n"
4256 " if (size E<lt>= 0)\n"
4257 " break;\n"
4258 "\\&\n"
4259 " /* Point to the first event in the buffer. */\n"
4260 "\\&\n"
4261 " metadata = buf;\n"
4262 "\\&\n"
4263 " /* Loop over all events in the buffer. */\n"
4264 "\\&\n"
4265 " while (FAN_EVENT_OK(metadata, size)) {\n"
4266 "\\&\n"
4267 " /* Check that run-time and compile-time structures match. */\n"
4268 "\\&\n"
4269 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
4270 " fprintf(stderr,\n"
4271 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
4272 " exit(EXIT_FAILURE);\n"
4273 " }\n"
4274 "\\&\n"
4275 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
4276 " queue overflow, or a file descriptor (a nonnegative\n"
4277 " integer). Here, we simply ignore queue overflow. */\n"
4278 "\\&\n"
4279 " if (metadata-E<gt>fd E<gt>= 0) {\n"
4280 "\\&\n"
4281 " /* Handle open permission event. */\n"
4282 "\\&\n"
4283 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
4284 " printf(\"FAN_OPEN_PERM: \");\n"
4285 "\\&\n"
4286 " /* Allow file to be opened. */\n"
4287 "\\&\n"
4288 " response.fd = metadata-E<gt>fd;\n"
4289 " response.response = FAN_ALLOW;\n"
4290 " write(fd, &response, sizeof(response));\n"
4291 " }\n"
4292 "\\&\n"
4293 " /* Handle closing of writable file event. */\n"
4294 "\\&\n"
4295 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
4296 " printf(\"FAN_CLOSE_WRITE: \");\n"
4297 "\\&\n"
4298 " /* Retrieve and print pathname of the accessed file. */\n"
4299 "\\&\n"
4300 " snprintf(procfd_path, sizeof(procfd_path),\n"
4301 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
4302 " path_len = readlink(procfd_path, path,\n"
4303 " sizeof(path) - 1);\n"
4304 " if (path_len == -1) {\n"
4305 " perror(\"readlink\");\n"
4306 " exit(EXIT_FAILURE);\n"
4307 " }\n"
4308 "\\&\n"
4309 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4310 " printf(\"File %s\\[rs]n\", path);\n"
4311 "\\&\n"
4312 " /* Close the file descriptor of the event. */\n"
4313 "\\&\n"
4314 " close(metadata-E<gt>fd);\n"
4315 " }\n"
4316 "\\&\n"
4317 " /* Advance to next event. */\n"
4318 "\\&\n"
4319 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
4320 " }\n"
4321 " }\n"
4322 "}\n"
4323 "\\&\n"
4324 "int\n"
4325 "main(int argc, char *argv[])\n"
4326 "{\n"
4327 " char buf;\n"
4328 " int fd, poll_num;\n"
4329 " nfds_t nfds;\n"
4330 " struct pollfd fds[2];\n"
4331 "\\&\n"
4332 " /* Check mount point is supplied. */\n"
4333 "\\&\n"
4334 " if (argc != 2) {\n"
4335 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
4336 " exit(EXIT_FAILURE);\n"
4337 " }\n"
4338 "\\&\n"
4339 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
4340 "\\&\n"
4341 " /* Create the file descriptor for accessing the fanotify API. */\n"
4342 "\\&\n"
4343 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
4344 " O_RDONLY | O_LARGEFILE);\n"
4345 " if (fd == -1) {\n"
4346 " perror(\"fanotify_init\");\n"
4347 " exit(EXIT_FAILURE);\n"
4348 " }\n"
4349 "\\&\n"
4350 " /* Mark the mount for:\n"
4351 " - permission events before opening files\n"
4352 " - notification events after closing a write-enabled\n"
4353 " file descriptor. */\n"
4354 "\\&\n"
4355 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
4356 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
4357 " argv[1]) == -1) {\n"
4358 " perror(\"fanotify_mark\");\n"
4359 " exit(EXIT_FAILURE);\n"
4360 " }\n"
4361 "\\&\n"
4362 " /* Prepare for polling. */\n"
4363 "\\&\n"
4364 " nfds = 2;\n"
4365 "\\&\n"
4366 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
4367 " fds[0].events = POLLIN;\n"
4368 "\\&\n"
4369 " fds[1].fd = fd; /* Fanotify input */\n"
4370 " fds[1].events = POLLIN;\n"
4371 "\\&\n"
4372 " /* This is the loop to wait for incoming events. */\n"
4373 "\\&\n"
4374 " printf(\"Listening for events.\\[rs]n\");\n"
4375 "\\&\n"
4376 " while (1) {\n"
4377 " poll_num = poll(fds, nfds, -1);\n"
4378 " if (poll_num == -1) {\n"
4379 " if (errno == EINTR) /* Interrupted by a signal */\n"
4380 " continue; /* Restart poll() */\n"
4381 "\\&\n"
4382 " perror(\"poll\"); /* Unexpected error */\n"
4383 " exit(EXIT_FAILURE);\n"
4384 " }\n"
4385 "\\&\n"
4386 " if (poll_num E<gt> 0) {\n"
4387 " if (fds[0].revents & POLLIN) {\n"
4388 "\\&\n"
4389 " /* Console input is available: empty stdin and quit. */\n"
4390 "\\&\n"
4391 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
4392 " continue;\n"
4393 " break;\n"
4394 " }\n"
4395 "\\&\n"
4396 " if (fds[1].revents & POLLIN) {\n"
4397 "\\&\n"
4398 " /* Fanotify events are available. */\n"
4399 "\\&\n"
4400 " handle_events(fd);\n"
4401 " }\n"
4402 " }\n"
4403 " }\n"
4404 "\\&\n"
4405 " printf(\"Listening for events stopped.\\[rs]n\");\n"
4406 " exit(EXIT_SUCCESS);\n"
4407 "}\n"
4408 msgstr ""
4409 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
4410 "#include E<lt>errno.hE<gt>\n"
4411 "#include E<lt>fcntl.hE<gt>\n"
4412 "#include E<lt>limits.hE<gt>\n"
4413 "#include E<lt>poll.hE<gt>\n"
4414 "#include E<lt>stdio.hE<gt>\n"
4415 "#include E<lt>stdlib.hE<gt>\n"
4416 "#include E<lt>sys/fanotify.hE<gt>\n"
4417 "#include E<lt>unistd.hE<gt>\n"
4418 "\\&\n"
4419 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
4420 "\\&\n"
4421 "static void\n"
4422 "handle_events(int fd)\n"
4423 "{\n"
4424 " const struct fanotify_event_metadata *metadata;\n"
4425 " struct fanotify_event_metadata buf[200];\n"
4426 " ssize_t size;\n"
4427 " char path[PATH_MAX];\n"
4428 " ssize_t path_len;\n"
4429 " char procfd_path[PATH_MAX];\n"
4430 " struct fanotify_response response;\n"
4431 "\\&\n"
4432 " /* Loop while events can be read from fanotify file descriptor. */\n"
4433 "\\&\n"
4434 " for (;;) {\n"
4435 "\\&\n"
4436 " /* Read some events. */\n"
4437 "\\&\n"
4438 " size = read(fd, buf, sizeof(buf));\n"
4439 " if (size == -1 && errno != EAGAIN) {\n"
4440 " perror(\"read\");\n"
4441 " exit(EXIT_FAILURE);\n"
4442 " }\n"
4443 "\\&\n"
4444 " /* Check if end of available data reached. */\n"
4445 "\\&\n"
4446 " if (size E<lt>= 0)\n"
4447 " break;\n"
4448 "\\&\n"
4449 " /* Point to the first event in the buffer. */\n"
4450 "\\&\n"
4451 " metadata = buf;\n"
4452 "\\&\n"
4453 " /* Loop over all events in the buffer. */\n"
4454 "\\&\n"
4455 " while (FAN_EVENT_OK(metadata, size)) {\n"
4456 "\\&\n"
4457 " /* Check that run-time and compile-time structures match. */\n"
4458 "\\&\n"
4459 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
4460 " fprintf(stderr,\n"
4461 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
4462 " exit(EXIT_FAILURE);\n"
4463 " }\n"
4464 "\\&\n"
4465 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
4466 " queue overflow, or a file descriptor (a nonnegative\n"
4467 " integer). Here, we simply ignore queue overflow. */\n"
4468 "\\&\n"
4469 " if (metadata-E<gt>fd E<gt>= 0) {\n"
4470 "\\&\n"
4471 " /* Handle open permission event. */\n"
4472 "\\&\n"
4473 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
4474 " printf(\"FAN_OPEN_PERM: \");\n"
4475 "\\&\n"
4476 " /* Allow file to be opened. */\n"
4477 "\\&\n"
4478 " response.fd = metadata-E<gt>fd;\n"
4479 " response.response = FAN_ALLOW;\n"
4480 " write(fd, &response, sizeof(response));\n"
4481 " }\n"
4482 "\\&\n"
4483 " /* Handle closing of writable file event. */\n"
4484 "\\&\n"
4485 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
4486 " printf(\"FAN_CLOSE_WRITE: \");\n"
4487 "\\&\n"
4488 " /* Retrieve and print pathname of the accessed file. */\n"
4489 "\\&\n"
4490 " snprintf(procfd_path, sizeof(procfd_path),\n"
4491 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
4492 " path_len = readlink(procfd_path, path,\n"
4493 " sizeof(path) - 1);\n"
4494 " if (path_len == -1) {\n"
4495 " perror(\"readlink\");\n"
4496 " exit(EXIT_FAILURE);\n"
4497 " }\n"
4498 "\\&\n"
4499 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4500 " printf(\"File %s\\[rs]n\", path);\n"
4501 "\\&\n"
4502 " /* Close the file descriptor of the event. */\n"
4503 "\\&\n"
4504 " close(metadata-E<gt>fd);\n"
4505 " }\n"
4506 "\\&\n"
4507 " /* Advance to next event. */\n"
4508 "\\&\n"
4509 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
4510 " }\n"
4511 " }\n"
4512 "}\n"
4513 "\\&\n"
4514 "int\n"
4515 "main(int argc, char *argv[])\n"
4516 "{\n"
4517 " char buf;\n"
4518 " int fd, poll_num;\n"
4519 " nfds_t nfds;\n"
4520 " struct pollfd fds[2];\n"
4521 "\\&\n"
4522 " /* Check mount point is supplied. */\n"
4523 "\\&\n"
4524 " if (argc != 2) {\n"
4525 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
4526 " exit(EXIT_FAILURE);\n"
4527 " }\n"
4528 "\\&\n"
4529 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
4530 "\\&\n"
4531 " /* Create the file descriptor for accessing the fanotify API. */\n"
4532 "\\&\n"
4533 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
4534 " O_RDONLY | O_LARGEFILE);\n"
4535 " if (fd == -1) {\n"
4536 " perror(\"fanotify_init\");\n"
4537 " exit(EXIT_FAILURE);\n"
4538 " }\n"
4539 "\\&\n"
4540 " /* Mark the mount for:\n"
4541 " - permission events before opening files\n"
4542 " - notification events after closing a write-enabled\n"
4543 " file descriptor. */\n"
4544 "\\&\n"
4545 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
4546 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
4547 " argv[1]) == -1) {\n"
4548 " perror(\"fanotify_mark\");\n"
4549 " exit(EXIT_FAILURE);\n"
4550 " }\n"
4551 "\\&\n"
4552 " /* Prepare for polling. */\n"
4553 "\\&\n"
4554 " nfds = 2;\n"
4555 "\\&\n"
4556 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
4557 " fds[0].events = POLLIN;\n"
4558 "\\&\n"
4559 " fds[1].fd = fd; /* Fanotify input */\n"
4560 " fds[1].events = POLLIN;\n"
4561 "\\&\n"
4562 " /* This is the loop to wait for incoming events. */\n"
4563 "\\&\n"
4564 " printf(\"Listening for events.\\[rs]n\");\n"
4565 "\\&\n"
4566 " while (1) {\n"
4567 " poll_num = poll(fds, nfds, -1);\n"
4568 " if (poll_num == -1) {\n"
4569 " if (errno == EINTR) /* Interrupted by a signal */\n"
4570 " continue; /* Restart poll() */\n"
4571 "\\&\n"
4572 " perror(\"poll\"); /* Unexpected error */\n"
4573 " exit(EXIT_FAILURE);\n"
4574 " }\n"
4575 "\\&\n"
4576 " if (poll_num E<gt> 0) {\n"
4577 " if (fds[0].revents & POLLIN) {\n"
4578 "\\&\n"
4579 " /* Console input is available: empty stdin and quit. */\n"
4580 "\\&\n"
4581 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
4582 " continue;\n"
4583 " break;\n"
4584 " }\n"
4585 "\\&\n"
4586 " if (fds[1].revents & POLLIN) {\n"
4587 "\\&\n"
4588 " /* Fanotify events are available. */\n"
4589 "\\&\n"
4590 " handle_events(fd);\n"
4591 " }\n"
4592 " }\n"
4593 " }\n"
4594 "\\&\n"
4595 " printf(\"Listening for events stopped.\\[rs]n\");\n"
4596 " exit(EXIT_SUCCESS);\n"
4597 "}\n"
4598
4599 #. type: Plain text
4600 #: fedora-44 fedora-rawhide
4601 #, no-wrap
4602 msgid ""
4603 "#define _GNU_SOURCE\n"
4604 "#include E<lt>errno.hE<gt>\n"
4605 "#include E<lt>fcntl.hE<gt>\n"
4606 "#include E<lt>limits.hE<gt>\n"
4607 "#include E<lt>stdio.hE<gt>\n"
4608 "#include E<lt>stdlib.hE<gt>\n"
4609 "#include E<lt>sys/types.hE<gt>\n"
4610 "#include E<lt>sys/stat.hE<gt>\n"
4611 "#include E<lt>sys/fanotify.hE<gt>\n"
4612 "#include E<lt>unistd.hE<gt>\n"
4613 "\\&\n"
4614 "#define BUF_SIZE 256\n"
4615 "\\&\n"
4616 "int\n"
4617 "main(int argc, char *argv[])\n"
4618 "{\n"
4619 " int fd, ret, event_fd, mount_fd;\n"
4620 " ssize_t size, path_len;\n"
4621 " char path[PATH_MAX];\n"
4622 " char procfd_path[PATH_MAX];\n"
4623 " char events_buf[BUF_SIZE];\n"
4624 " struct file_handle *file_handle;\n"
4625 " struct fanotify_event_metadata *metadata;\n"
4626 " struct fanotify_event_info_fid *fid;\n"
4627 " const char *file_name;\n"
4628 " struct stat sb;\n"
4629 "\\&\n"
4630 " if (argc != 2) {\n"
4631 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
4632 " exit(EXIT_FAILURE);\n"
4633 " }\n"
4634 "\\&\n"
4635 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
4636 " if (mount_fd == -1) {\n"
4637 " perror(argv[1]);\n"
4638 " exit(EXIT_FAILURE);\n"
4639 " }\n"
4640 "\\&\n"
4641 " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
4642 " a flag so that program can receive fid events with directory\n"
4643 " entry name. */\n"
4644 "\\&\n"
4645 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
4646 " if (fd == -1) {\n"
4647 " perror(\"fanotify_init\");\n"
4648 " exit(EXIT_FAILURE);\n"
4649 " }\n"
4650 "\\&\n"
4651 " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
4652 "\\&\n"
4653 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
4654 " FAN_CREATE | FAN_ONDIR,\n"
4655 " AT_FDCWD, argv[1]);\n"
4656 " if (ret == -1) {\n"
4657 " perror(\"fanotify_mark\");\n"
4658 " exit(EXIT_FAILURE);\n"
4659 " }\n"
4660 "\\&\n"
4661 " printf(\"Listening for events.\\[rs]n\");\n"
4662 "\\&\n"
4663 " /* Read events from the event queue into a buffer. */\n"
4664 "\\&\n"
4665 " size = read(fd, events_buf, sizeof(events_buf));\n"
4666 " if (size == -1 && errno != EAGAIN) {\n"
4667 " perror(\"read\");\n"
4668 " exit(EXIT_FAILURE);\n"
4669 " }\n"
4670 "\\&\n"
4671 " /* Process all events within the buffer. */\n"
4672 "\\&\n"
4673 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
4674 " FAN_EVENT_OK(metadata, size);\n"
4675 " metadata = FAN_EVENT_NEXT(metadata, size)) {\n"
4676 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
4677 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
4678 "\\&\n"
4679 " /* Ensure that the event info is of the correct type. */\n"
4680 "\\&\n"
4681 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
4682 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
4683 " file_name = NULL;\n"
4684 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
4685 " file_name = file_handle-E<gt>f_handle +\n"
4686 " file_handle-E<gt>handle_bytes;\n"
4687 " } else {\n"
4688 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
4689 " exit(EXIT_FAILURE);\n"
4690 " }\n"
4691 "\\&\n"
4692 " if (metadata-E<gt>mask == FAN_CREATE)\n"
4693 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
4694 "\\&\n"
4695 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
4696 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
4697 "\\&\n"
4698 "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
4699 "\t objects by file handles. To obtain a file descriptor for\n"
4700 "\t the file object corresponding to an event you can use the\n"
4701 "\t struct file_handle that\\[aq]s provided within the\n"
4702 "\t fanotify_event_info_fid in conjunction with the\n"
4703 "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
4704 "\t done to accommodate for the situation where the file handle\n"
4705 "\t for the object was deleted prior to this system call. */\n"
4706 "\\&\n"
4707 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
4708 " if (event_fd == -1) {\n"
4709 " if (errno == ESTALE) {\n"
4710 " printf(\"File handle is no longer valid. \"\n"
4711 " \"File has been deleted\\[rs]n\");\n"
4712 " continue;\n"
4713 " } else {\n"
4714 " perror(\"open_by_handle_at\");\n"
4715 " exit(EXIT_FAILURE);\n"
4716 " }\n"
4717 " }\n"
4718 "\\&\n"
4719 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
4720 " event_fd);\n"
4721 "\\&\n"
4722 " /* Retrieve and print the path of the modified dentry. */\n"
4723 "\\&\n"
4724 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
4725 " if (path_len == -1) {\n"
4726 " perror(\"readlink\");\n"
4727 " exit(EXIT_FAILURE);\n"
4728 " }\n"
4729 "\\&\n"
4730 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4731 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
4732 "\\&\n"
4733 " if (file_name) {\n"
4734 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
4735 " if (ret == -1) {\n"
4736 " if (errno != ENOENT) {\n"
4737 " perror(\"fstatat\");\n"
4738 " exit(EXIT_FAILURE);\n"
4739 " }\n"
4740 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
4741 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
4742 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
4743 " } else {\n"
4744 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
4745 " file_name);\n"
4746 " }\n"
4747 " }\n"
4748 "\\&\n"
4749 " /* Close associated file descriptor for this event. */\n"
4750 "\\&\n"
4751 " close(event_fd);\n"
4752 " }\n"
4753 "\\&\n"
4754 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
4755 " exit(EXIT_SUCCESS);\n"
4756 "}\n"
4757 msgstr ""
4758 "#define _GNU_SOURCE\n"
4759 "#include E<lt>errno.hE<gt>\n"
4760 "#include E<lt>fcntl.hE<gt>\n"
4761 "#include E<lt>limits.hE<gt>\n"
4762 "#include E<lt>stdio.hE<gt>\n"
4763 "#include E<lt>stdlib.hE<gt>\n"
4764 "#include E<lt>sys/types.hE<gt>\n"
4765 "#include E<lt>sys/stat.hE<gt>\n"
4766 "#include E<lt>sys/fanotify.hE<gt>\n"
4767 "#include E<lt>unistd.hE<gt>\n"
4768 "\\&\n"
4769 "#define BUF_SIZE 256\n"
4770 "\\&\n"
4771 "int\n"
4772 "main(int argc, char *argv[])\n"
4773 "{\n"
4774 " int fd, ret, event_fd, mount_fd;\n"
4775 " ssize_t size, path_len;\n"
4776 " char path[PATH_MAX];\n"
4777 " char procfd_path[PATH_MAX];\n"
4778 " char events_buf[BUF_SIZE];\n"
4779 " struct file_handle *file_handle;\n"
4780 " struct fanotify_event_metadata *metadata;\n"
4781 " struct fanotify_event_info_fid *fid;\n"
4782 " const char *file_name;\n"
4783 " struct stat sb;\n"
4784 "\\&\n"
4785 " if (argc != 2) {\n"
4786 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
4787 " exit(EXIT_FAILURE);\n"
4788 " }\n"
4789 "\\&\n"
4790 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
4791 " if (mount_fd == -1) {\n"
4792 " perror(argv[1]);\n"
4793 " exit(EXIT_FAILURE);\n"
4794 " }\n"
4795 "\\&\n"
4796 " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
4797 " a flag so that program can receive fid events with directory\n"
4798 " entry name. */\n"
4799 "\\&\n"
4800 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
4801 " if (fd == -1) {\n"
4802 " perror(\"fanotify_init\");\n"
4803 " exit(EXIT_FAILURE);\n"
4804 " }\n"
4805 "\\&\n"
4806 " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
4807 "\\&\n"
4808 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
4809 " FAN_CREATE | FAN_ONDIR,\n"
4810 " AT_FDCWD, argv[1]);\n"
4811 " if (ret == -1) {\n"
4812 " perror(\"fanotify_mark\");\n"
4813 " exit(EXIT_FAILURE);\n"
4814 " }\n"
4815 "\\&\n"
4816 " printf(\"Listening for events.\\[rs]n\");\n"
4817 "\\&\n"
4818 " /* Read events from the event queue into a buffer. */\n"
4819 "\\&\n"
4820 " size = read(fd, events_buf, sizeof(events_buf));\n"
4821 " if (size == -1 && errno != EAGAIN) {\n"
4822 " perror(\"read\");\n"
4823 " exit(EXIT_FAILURE);\n"
4824 " }\n"
4825 "\\&\n"
4826 " /* Process all events within the buffer. */\n"
4827 "\\&\n"
4828 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
4829 " FAN_EVENT_OK(metadata, size);\n"
4830 " metadata = FAN_EVENT_NEXT(metadata, size)) {\n"
4831 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
4832 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
4833 "\\&\n"
4834 " /* Ensure that the event info is of the correct type. */\n"
4835 "\\&\n"
4836 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
4837 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
4838 " file_name = NULL;\n"
4839 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
4840 " file_name = file_handle-E<gt>f_handle +\n"
4841 " file_handle-E<gt>handle_bytes;\n"
4842 " } else {\n"
4843 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
4844 " exit(EXIT_FAILURE);\n"
4845 " }\n"
4846 "\\&\n"
4847 " if (metadata-E<gt>mask == FAN_CREATE)\n"
4848 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
4849 "\\&\n"
4850 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
4851 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
4852 "\\&\n"
4853 "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
4854 "\t objects by file handles. To obtain a file descriptor for\n"
4855 "\t the file object corresponding to an event you can use the\n"
4856 "\t struct file_handle that\\[aq]s provided within the\n"
4857 "\t fanotify_event_info_fid in conjunction with the\n"
4858 "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
4859 "\t done to accommodate for the situation where the file handle\n"
4860 "\t for the object was deleted prior to this system call. */\n"
4861 "\\&\n"
4862 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
4863 " if (event_fd == -1) {\n"
4864 " if (errno == ESTALE) {\n"
4865 " printf(\"File handle is no longer valid. \"\n"
4866 " \"File has been deleted\\[rs]n\");\n"
4867 " continue;\n"
4868 " } else {\n"
4869 " perror(\"open_by_handle_at\");\n"
4870 " exit(EXIT_FAILURE);\n"
4871 " }\n"
4872 " }\n"
4873 "\\&\n"
4874 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
4875 " event_fd);\n"
4876 "\\&\n"
4877 " /* Retrieve and print the path of the modified dentry. */\n"
4878 "\\&\n"
4879 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
4880 " if (path_len == -1) {\n"
4881 " perror(\"readlink\");\n"
4882 " exit(EXIT_FAILURE);\n"
4883 " }\n"
4884 "\\&\n"
4885 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4886 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
4887 "\\&\n"
4888 " if (file_name) {\n"
4889 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
4890 " if (ret == -1) {\n"
4891 " if (errno != ENOENT) {\n"
4892 " perror(\"fstatat\");\n"
4893 " exit(EXIT_FAILURE);\n"
4894 " }\n"
4895 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
4896 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
4897 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
4898 " } else {\n"
4899 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
4900 " file_name);\n"
4901 " }\n"
4902 " }\n"
4903 "\\&\n"
4904 " /* Close associated file descriptor for this event. */\n"
4905 "\\&\n"
4906 " close(event_fd);\n"
4907 " }\n"
4908 "\\&\n"
4909 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
4910 " exit(EXIT_SUCCESS);\n"
4911 "}\n"
4912
4913 #. type: TH
4914 #: mageia-cauldron
4915 #, no-wrap
4916 msgid "2026-02-08"
4917 msgstr "8 فبراير 2026"
4918
4919 #. type: TH
4920 #: mageia-cauldron
4921 #, no-wrap
4922 msgid "Linux man-pages 6.17"
4923 msgstr "صفحات دليل لينكس 6.17"
4924
4925 #. type: Plain text
4926 #: mageia-cauldron
4927 #, no-wrap
4928 msgid ""
4929 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
4930 "#include E<lt>errno.hE<gt>\n"
4931 "#include E<lt>fcntl.hE<gt>\n"
4932 "#include E<lt>limits.hE<gt>\n"
4933 "#include E<lt>poll.hE<gt>\n"
4934 "#include E<lt>stdio.hE<gt>\n"
4935 "#include E<lt>stdlib.hE<gt>\n"
4936 "#include E<lt>sys/fanotify.hE<gt>\n"
4937 "#include E<lt>unistd.hE<gt>\n"
4938 "\\&\n"
4939 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
4940 "\\&\n"
4941 "static void\n"
4942 "handle_events(int fd)\n"
4943 "{\n"
4944 " const struct fanotify_event_metadata *metadata;\n"
4945 " struct fanotify_event_metadata buf[200];\n"
4946 " ssize_t size;\n"
4947 " char path[PATH_MAX];\n"
4948 " ssize_t path_len;\n"
4949 " char procfd_path[PATH_MAX];\n"
4950 " struct fanotify_response response;\n"
4951 "\\&\n"
4952 " /* Loop while events can be read from fanotify file descriptor. */\n"
4953 "\\&\n"
4954 " for (;;) {\n"
4955 "\\&\n"
4956 " /* Read some events. */\n"
4957 "\\&\n"
4958 " size = read(fd, buf, sizeof(buf));\n"
4959 " if (size == -1 && errno != EAGAIN) {\n"
4960 " perror(\"read\");\n"
4961 " exit(EXIT_FAILURE);\n"
4962 " }\n"
4963 "\\&\n"
4964 " /* Check if end of available data reached. */\n"
4965 "\\&\n"
4966 " if (size E<lt>= 0)\n"
4967 " break;\n"
4968 "\\&\n"
4969 " /* Point to the first event in the buffer. */\n"
4970 "\\&\n"
4971 " metadata = buf;\n"
4972 "\\&\n"
4973 " /* Loop over all events in the buffer. */\n"
4974 "\\&\n"
4975 " while (FAN_EVENT_OK(metadata, size)) {\n"
4976 "\\&\n"
4977 " /* Check that run-time and compile-time structures match. */\n"
4978 "\\&\n"
4979 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
4980 " fprintf(stderr,\n"
4981 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
4982 " exit(EXIT_FAILURE);\n"
4983 " }\n"
4984 "\\&\n"
4985 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
4986 " queue overflow, or a file descriptor (a nonnegative\n"
4987 " integer). Here, we simply ignore queue overflow. */\n"
4988 "\\&\n"
4989 " if (metadata-E<gt>fd E<gt>= 0) {\n"
4990 "\\&\n"
4991 " /* Handle open permission event. */\n"
4992 "\\&\n"
4993 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
4994 " printf(\"FAN_OPEN_PERM: \");\n"
4995 "\\&\n"
4996 " /* Allow file to be opened. */\n"
4997 "\\&\n"
4998 " response.fd = metadata-E<gt>fd;\n"
4999 " response.response = FAN_ALLOW;\n"
5000 " write(fd, &response, sizeof(response));\n"
5001 " }\n"
5002 "\\&\n"
5003 " /* Handle closing of writable file event. */\n"
5004 "\\&\n"
5005 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
5006 " printf(\"FAN_CLOSE_WRITE: \");\n"
5007 "\\&\n"
5008 " /* Retrieve and print pathname of the accessed file. */\n"
5009 "\\&\n"
5010 " snprintf(procfd_path, sizeof(procfd_path),\n"
5011 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
5012 " path_len = readlink(procfd_path, path,\n"
5013 " sizeof(path) - 1);\n"
5014 " if (path_len == -1) {\n"
5015 " perror(\"readlink\");\n"
5016 " exit(EXIT_FAILURE);\n"
5017 " }\n"
5018 "\\&\n"
5019 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
5020 " printf(\"File %s\\[rs]n\", path);\n"
5021 "\\&\n"
5022 " /* Close the file descriptor of the event. */\n"
5023 "\\&\n"
5024 " close(metadata-E<gt>fd);\n"
5025 " }\n"
5026 "\\&\n"
5027 " /* Advance to next event. */\n"
5028 "\\&\n"
5029 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
5030 " }\n"
5031 " }\n"
5032 "}\n"
5033 "\\&\n"
5034 "int\n"
5035 "main(int argc, char *argv[])\n"
5036 "{\n"
5037 " char buf;\n"
5038 " int fd, poll_num;\n"
5039 " nfds_t nfds;\n"
5040 " struct pollfd fds[2];\n"
5041 "\\&\n"
5042 " /* Check mount point is supplied. */\n"
5043 "\\&\n"
5044 " if (argc != 2) {\n"
5045 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
5046 " exit(EXIT_FAILURE);\n"
5047 " }\n"
5048 "\\&\n"
5049 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
5050 "\\&\n"
5051 " /* Create the file descriptor for accessing the fanotify API. */\n"
5052 "\\&\n"
5053 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
5054 " O_RDONLY | O_LARGEFILE);\n"
5055 " if (fd == -1) {\n"
5056 " perror(\"fanotify_init\");\n"
5057 " exit(EXIT_FAILURE);\n"
5058 " }\n"
5059 "\\&\n"
5060 " /* Mark the mount for:\n"
5061 " - permission events before opening files\n"
5062 " - notification events after closing a write-enabled\n"
5063 " file descriptor. */\n"
5064 "\\&\n"
5065 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
5066 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
5067 " argv[1]) == -1) {\n"
5068 " perror(\"fanotify_mark\");\n"
5069 " exit(EXIT_FAILURE);\n"
5070 " }\n"
5071 "\\&\n"
5072 " /* Prepare for polling. */\n"
5073 "\\&\n"
5074 " nfds = 2;\n"
5075 "\\&\n"
5076 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
5077 " fds[0].events = POLLIN;\n"
5078 "\\&\n"
5079 " fds[1].fd = fd; /* Fanotify input */\n"
5080 " fds[1].events = POLLIN;\n"
5081 "\\&\n"
5082 " /* This is the loop to wait for incoming events. */\n"
5083 "\\&\n"
5084 " printf(\"Listening for events.\\[rs]n\");\n"
5085 "\\&\n"
5086 " while (1) {\n"
5087 " poll_num = poll(fds, nfds, -1);\n"
5088 " if (poll_num == -1) {\n"
5089 " if (errno == EINTR) /* Interrupted by a signal */\n"
5090 " continue; /* Restart poll() */\n"
5091 "\\&\n"
5092 " perror(\"poll\"); /* Unexpected error */\n"
5093 " exit(EXIT_FAILURE);\n"
5094 " }\n"
5095 "\\&\n"
5096 " if (poll_num E<gt> 0) {\n"
5097 " if (fds[0].revents & POLLIN) {\n"
5098 "\\&\n"
5099 " /* Console input is available: empty stdin and quit. */\n"
5100 "\\&\n"
5101 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
5102 " continue;\n"
5103 " break;\n"
5104 " }\n"
5105 "\\&\n"
5106 " if (fds[1].revents & POLLIN) {\n"
5107 "\\&\n"
5108 " /* Fanotify events are available. */\n"
5109 "\\&\n"
5110 " handle_events(fd);\n"
5111 " }\n"
5112 " }\n"
5113 " }\n"
5114 "\\&\n"
5115 " printf(\"Listening for events stopped.\\[rs]n\");\n"
5116 " exit(EXIT_SUCCESS);\n"
5117 "}\n"
5118 msgstr ""
5119 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
5120 "#include E<lt>errno.hE<gt>\n"
5121 "#include E<lt>fcntl.hE<gt>\n"
5122 "#include E<lt>limits.hE<gt>\n"
5123 "#include E<lt>poll.hE<gt>\n"
5124 "#include E<lt>stdio.hE<gt>\n"
5125 "#include E<lt>stdlib.hE<gt>\n"
5126 "#include E<lt>sys/fanotify.hE<gt>\n"
5127 "#include E<lt>unistd.hE<gt>\n"
5128 "\\&\n"
5129 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
5130 "\\&\n"
5131 "static void\n"
5132 "handle_events(int fd)\n"
5133 "{\n"
5134 " const struct fanotify_event_metadata *metadata;\n"
5135 " struct fanotify_event_metadata buf[200];\n"
5136 " ssize_t size;\n"
5137 " char path[PATH_MAX];\n"
5138 " ssize_t path_len;\n"
5139 " char procfd_path[PATH_MAX];\n"
5140 " struct fanotify_response response;\n"
5141 "\\&\n"
5142 " /* Loop while events can be read from fanotify file descriptor. */\n"
5143 "\\&\n"
5144 " for (;;) {\n"
5145 "\\&\n"
5146 " /* Read some events. */\n"
5147 "\\&\n"
5148 " size = read(fd, buf, sizeof(buf));\n"
5149 " if (size == -1 && errno != EAGAIN) {\n"
5150 " perror(\"read\");\n"
5151 " exit(EXIT_FAILURE);\n"
5152 " }\n"
5153 "\\&\n"
5154 " /* Check if end of available data reached. */\n"
5155 "\\&\n"
5156 " if (size E<lt>= 0)\n"
5157 " break;\n"
5158 "\\&\n"
5159 " /* Point to the first event in the buffer. */\n"
5160 "\\&\n"
5161 " metadata = buf;\n"
5162 "\\&\n"
5163 " /* Loop over all events in the buffer. */\n"
5164 "\\&\n"
5165 " while (FAN_EVENT_OK(metadata, size)) {\n"
5166 "\\&\n"
5167 " /* Check that run-time and compile-time structures match. */\n"
5168 "\\&\n"
5169 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
5170 " fprintf(stderr,\n"
5171 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
5172 " exit(EXIT_FAILURE);\n"
5173 " }\n"
5174 "\\&\n"
5175 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
5176 " queue overflow, or a file descriptor (a nonnegative\n"
5177 " integer). Here, we simply ignore queue overflow. */\n"
5178 "\\&\n"
5179 " if (metadata-E<gt>fd E<gt>= 0) {\n"
5180 "\\&\n"
5181 " /* Handle open permission event. */\n"
5182 "\\&\n"
5183 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
5184 " printf(\"FAN_OPEN_PERM: \");\n"
5185 "\\&\n"
5186 " /* Allow file to be opened. */\n"
5187 "\\&\n"
5188 " response.fd = metadata-E<gt>fd;\n"
5189 " response.response = FAN_ALLOW;\n"
5190 " write(fd, &response, sizeof(response));\n"
5191 " }\n"
5192 "\\&\n"
5193 " /* Handle closing of writable file event. */\n"
5194 "\\&\n"
5195 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
5196 " printf(\"FAN_CLOSE_WRITE: \");\n"
5197 "\\&\n"
5198 " /* Retrieve and print pathname of the accessed file. */\n"
5199 "\\&\n"
5200 " snprintf(procfd_path, sizeof(procfd_path),\n"
5201 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
5202 " path_len = readlink(procfd_path, path,\n"
5203 " sizeof(path) - 1);\n"
5204 " if (path_len == -1) {\n"
5205 " perror(\"readlink\");\n"
5206 " exit(EXIT_FAILURE);\n"
5207 " }\n"
5208 "\\&\n"
5209 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
5210 " printf(\"File %s\\[rs]n\", path);\n"
5211 "\\&\n"
5212 " /* Close the file descriptor of the event. */\n"
5213 "\\&\n"
5214 " close(metadata-E<gt>fd);\n"
5215 " }\n"
5216 "\\&\n"
5217 " /* Advance to next event. */\n"
5218 "\\&\n"
5219 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
5220 " }\n"
5221 " }\n"
5222 "}\n"
5223 "\\&\n"
5224 "int\n"
5225 "main(int argc, char *argv[])\n"
5226 "{\n"
5227 " char buf;\n"
5228 " int fd, poll_num;\n"
5229 " nfds_t nfds;\n"
5230 " struct pollfd fds[2];\n"
5231 "\\&\n"
5232 " /* Check mount point is supplied. */\n"
5233 "\\&\n"
5234 " if (argc != 2) {\n"
5235 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
5236 " exit(EXIT_FAILURE);\n"
5237 " }\n"
5238 "\\&\n"
5239 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
5240 "\\&\n"
5241 " /* Create the file descriptor for accessing the fanotify API. */\n"
5242 "\\&\n"
5243 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
5244 " O_RDONLY | O_LARGEFILE);\n"
5245 " if (fd == -1) {\n"
5246 " perror(\"fanotify_init\");\n"
5247 " exit(EXIT_FAILURE);\n"
5248 " }\n"
5249 "\\&\n"
5250 " /* Mark the mount for:\n"
5251 " - permission events before opening files\n"
5252 " - notification events after closing a write-enabled\n"
5253 " file descriptor. */\n"
5254 "\\&\n"
5255 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
5256 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
5257 " argv[1]) == -1) {\n"
5258 " perror(\"fanotify_mark\");\n"
5259 " exit(EXIT_FAILURE);\n"
5260 " }\n"
5261 "\\&\n"
5262 " /* Prepare for polling. */\n"
5263 "\\&\n"
5264 " nfds = 2;\n"
5265 "\\&\n"
5266 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
5267 " fds[0].events = POLLIN;\n"
5268 "\\&\n"
5269 " fds[1].fd = fd; /* Fanotify input */\n"
5270 " fds[1].events = POLLIN;\n"
5271 "\\&\n"
5272 " /* This is the loop to wait for incoming events. */\n"
5273 "\\&\n"
5274 " printf(\"Listening for events.\\[rs]n\");\n"
5275 "\\&\n"
5276 " while (1) {\n"
5277 " poll_num = poll(fds, nfds, -1);\n"
5278 " if (poll_num == -1) {\n"
5279 " if (errno == EINTR) /* Interrupted by a signal */\n"
5280 " continue; /* Restart poll() */\n"
5281 "\\&\n"
5282 " perror(\"poll\"); /* Unexpected error */\n"
5283 " exit(EXIT_FAILURE);\n"
5284 " }\n"
5285 "\\&\n"
5286 " if (poll_num E<gt> 0) {\n"
5287 " if (fds[0].revents & POLLIN) {\n"
5288 "\\&\n"
5289 " /* Console input is available: empty stdin and quit. */\n"
5290 "\\&\n"
5291 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
5292 " continue;\n"
5293 " break;\n"
5294 " }\n"
5295 "\\&\n"
5296 " if (fds[1].revents & POLLIN) {\n"
5297 "\\&\n"
5298 " /* Fanotify events are available. */\n"
5299 "\\&\n"
5300 " handle_events(fd);\n"
5301 " }\n"
5302 " }\n"
5303 " }\n"
5304 "\\&\n"
5305 " printf(\"Listening for events stopped.\\[rs]n\");\n"
5306 " exit(EXIT_SUCCESS);\n"
5307 "}\n"
5308
5309 #. type: TH
5310 #: opensuse-leap-16-1 opensuse-tumbleweed
5311 #, no-wrap
5312 msgid "Linux man-pages (unreleased)"
5313 msgstr "صفحات دليل لينكس (لم تصدر بعد)"