Debian Codegraph @

po/ru/man7/fanotify.7.po

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