Debian Codegraph @

po/fr/man7/fanotify.7.po

raw
1 # French translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Christophe Blaess <https://www.blaess.fr/christophe/>, 1996-2003.
5 # Stéphan Rafin <[email protected]>, 2002.
6 # Thierry Vignaud <[email protected]>, 1999, 2002.
7 # François Micaux, 2002.
8 # Alain Portal <[email protected]>, 2003-2008.
9 # Jean-Philippe Guérard <[email protected]>, 2005-2006.
10 # Jean-Luc Coulon (f5ibh) <[email protected]>, 2006-2007.
11 # Julien Cristau <[email protected]>, 2006-2007.
12 # Thomas Huriaux <[email protected]>, 2006-2008.
13 # Nicolas François <[email protected]>, 2006-2008.
14 # Florentin Duneau <[email protected]>, 2006-2010.
15 # Simon Paillard <[email protected]>, 2006.
16 # Denis Barbier <[email protected]>, 2006, 2010.
17 # David Prévot <[email protected]>, 2010, 2012-2014.
18 # Jean-Paul Guillonneau <[email protected]>, 2021, 2024.
19 msgid ""
20 msgstr ""
21 "Project-Id-Version: manpages-l10n 4.22.0\n"
22 "POT-Creation-Date: 2026-06-05 06:24+0200\n"
23 "PO-Revision-Date: 2024-07-08 08:53+0200\n"
24 "Last-Translator: Jean-Paul Guillonneau <[email protected]>\n"
25 "Language-Team: French <[email protected]>\n"
26 "Language: fr\n"
27 "MIME-Version: 1.0\n"
28 "Content-Type: text/plain; charset=UTF-8\n"
29 "Content-Transfer-Encoding: 8bit\n"
30 "Plural-Forms: nplurals=2; plural=n > 1;\n"
31 "X-Generator: vim\n"
32
33 #. type: TH
34 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
35 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
36 #, no-wrap
37 msgid "fanotify"
38 msgstr "fanotify"
39
40 #. type: TH
41 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "2026-02-14"
44 msgstr "14 février 2026"
45
46 #. type: TH
47 #: archlinux debian-unstable
48 #, no-wrap
49 msgid "Linux man-pages 6.18"
50 msgstr "Pages du manuel de Linux 6.18"
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "NAME"
57 msgstr "NOM"
58
59 #. type: Plain text
60 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
61 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
62 msgid "fanotify - monitoring filesystem events"
63 msgstr "fanotify – Surveiller les événements des systèmes de fichiers"
64
65 #. type: SH
66 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
67 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
68 #, no-wrap
69 msgid "DESCRIPTION"
70 msgstr "DESCRIPTION"
71
72 #. type: Plain text
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 msgid ""
76 "The fanotify API provides notification and interception of filesystem "
77 "events. Use cases include virus scanning and hierarchical storage "
78 "management. In the original fanotify API, only a limited set of events was "
79 "supported. In particular, there was no support for create, delete, and move "
80 "events. The support for those events was added in Linux 5.1. (See "
81 "B<inotify>(7) for details of an API that did notify those events pre Linux "
82 "5.1.)"
83 msgstr ""
84 "L’interface de programmation fanotify permet la notification et "
85 "l’interception des événements du système de fichiers. La recherche de virus "
86 "et la gestion de stockage hiérarchisé font partie des cas d’utilisation. "
87 "Dans l’interface originelle seul un ensemble limité d’événements était pris "
88 "en charge. En particulier, les événements de création, de suppression ou de "
89 "déplacement n’étaient pas pris en charge. La prise en charge de ces "
90 "évènements a été ajoutée dans Linux 5.1. Consultez B<inotify>(7) pour plus "
91 "de précisions sur l’interface qui ne notifiait pas ces évènements avant "
92 "Linux 5.1."
93
94 #. type: Plain text
95 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
96 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
97 msgid ""
98 "Additional capabilities compared to the B<inotify>(7) API include the "
99 "ability to monitor all of the objects in a mounted filesystem, the ability "
100 "to make access permission decisions, and the possibility to read or modify "
101 "files before access by other applications."
102 msgstr ""
103 "La capacité de surveiller tous les objets d’un système de fichiers monté, la "
104 "capacité de décider des droits d’accès et la possibilité de lire ou modifier "
105 "les fichiers avant qu’ils ne soient accédés par d’autres applications font "
106 "partie des capacités supplémentaires à celles de l’interface de "
107 "programmation B<inotify>(7)."
108
109 #. type: Plain text
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 msgid ""
113 "The following system calls are used with this API: B<fanotify_init>(2), "
114 "B<fanotify_mark>(2), B<read>(2), B<write>(2), and B<close>(2)."
115 msgstr ""
116 "Les appels système suivants sont utilisés avec cette interface de "
117 "programmation : B<fanotify_init>(2), B<fanotify_mark>(2), B<read>(2), "
118 "B<write>(2) et B<close>(2)."
119
120 #. type: SS
121 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
122 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
123 #, no-wrap
124 msgid "fanotify_init(), fanotify_mark(), and notification groups"
125 msgstr "fanotify_init(), fanotify_mark() et groupes de notification"
126
127 #. type: Plain text
128 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
129 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
130 msgid ""
131 "The B<fanotify_init>(2) system call creates and initializes an fanotify "
132 "notification group and returns a file descriptor referring to it."
133 msgstr ""
134 "L’appel système B<fanotify_init>(2) crée et initialise un groupe de "
135 "notifications fanotify et renvoie un descripteur de fichier le référençant."
136
137 #. type: Plain text
138 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
139 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
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 "Un groupe de notifications fanotify est un objet interne au noyau qui "
146 "contient une liste de fichiers, répertoires et points de montage pour "
147 "lesquels des événements seront créés."
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 msgid ""
153 "For each entry in an fanotify notification group, two bit masks exist: the "
154 "I<mark> mask and the I<ignore> mask. The mark mask defines file activities "
155 "for which an event shall be created. The ignore mask defines activities for "
156 "which no event shall be generated. Having these two types of masks permits "
157 "a filesystem, mount, or directory to be marked for receiving events, while "
158 "at the same time ignoring events for specific objects under a mount or "
159 "directory."
160 msgstr ""
161 "Pour chaque entrée dans un groupe de notifications fanotify, deux masques "
162 "binaires sont présents : le masque I<mark> et le masque I<ignore>. Le masque "
163 "I<mark> définit les activités de fichier pour lesquelles un événement doit "
164 "être créé. Le masque I<ignore> définit les activités pour lesquelles aucun "
165 "événement ne doit être créé. Avoir ces deux types de masque permet à un "
166 "point de montage ou à un répertoire d’être marqué pour recevoir des "
167 "événements, tout en ignorant en même temps les événements pour des objets "
168 "spécifiques dans ce point de montage ou répertoire."
169
170 #. type: Plain text
171 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
172 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
173 msgid ""
174 "The B<fanotify_mark>(2) system call adds a file, directory, filesystem, or "
175 "mount to a notification group and specifies which events shall be reported "
176 "(or ignored), or removes or modifies such an entry."
177 msgstr ""
178 "L’appel système B<fanotify_mark>(2) ajoute un fichier, répertoire ou point "
179 "de montage à un groupe de notifications et indique les événements qui "
180 "doivent être signalés (ou ignorés), ou supprime ou modifie une telle entrée."
181
182 #. type: Plain text
183 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
184 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
185 msgid ""
186 "A possible usage of the ignore mask is for a file cache. Events of interest "
187 "for a file cache are modification of a file and closing of the same. Hence, "
188 "the cached directory or mount is to be marked to receive these events. "
189 "After receiving the first event informing that a file has been modified, the "
190 "corresponding cache entry will be invalidated. No further modification "
191 "events for this file are of interest until the file is closed. Hence, the "
192 "modify event can be added to the ignore mask. Upon receiving the close "
193 "event, the modify event can be removed from the ignore mask and the file "
194 "cache entry can be updated."
195 msgstr ""
196 "Le masque I<ignore> peut servir pour un cache de fichier. Les événements "
197 "intéressants pour un cache de fichier sont la modification et la fermeture "
198 "d’un fichier. Ainsi, le répertoire ou point de montage en cache va être "
199 "marqué pour recevoir ces événements. Après la réception du premier événement "
200 "informant qu’un fichier a été modifié, l’entrée correspondante du cache sera "
201 "désactivée. Aucun autre événement de modification pour ce fichier ne sera "
202 "utile jusqu’à sa fermeture. Ainsi, l’événement de modification peut être "
203 "ajouté au masque ignore. Lors de la réception d’un événement de fermeture, "
204 "l’événement de modification peut être supprimé du masque I<ignore> et "
205 "l’entrée de cache de fichier peut être mise à jour."
206
207 #. type: Plain text
208 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
209 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
210 msgid ""
211 "The entries in the fanotify notification groups refer to files and "
212 "directories via their inode number and to mounts via their mount ID. If "
213 "files or directories are renamed or moved within the same mount, the "
214 "respective entries survive. If files or directories are deleted or moved to "
215 "another mount or if filesystems or mounts are unmounted, the corresponding "
216 "entries are deleted."
217 msgstr ""
218 "Les entrées des groupes de notification fanotify font référence aux fichiers "
219 "et répertoires à l’aide de leur numéro d’inœud et aux montages à l’aide de "
220 "leur identifiant de montage. Si les fichiers ou répertoires sont renommés ou "
221 "déplacés dans le même montage, les entrées correspondantes survivent. Si les "
222 "fichiers ou répertoires sont supprimés ou déplacés dans un autre montage ou "
223 "si les montages sont démontés, les entrées correspondantes sont supprimées."
224
225 #. type: SS
226 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
227 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
228 #, no-wrap
229 msgid "The event queue"
230 msgstr "La file d’événements"
231
232 #. type: Plain text
233 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
234 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
235 msgid ""
236 "As events occur on the filesystem objects monitored by a notification group, "
237 "the fanotify system generates events that are collected in a queue. These "
238 "events can then be read (using B<read>(2) or similar) from the fanotify "
239 "file descriptor returned by B<fanotify_init>(2)."
240 msgstr ""
241 "Comme les événements surviennent sur les objets de système de fichiers "
242 "surveillés par un groupe de notifications, le système fanotify génère les "
243 "événements qui sont collectés dans une file. Ces événements peuvent être lus "
244 "(en utilisant B<read>(2) ou similaire) à partir du descripteur de fichier "
245 "fanotify renvoyé par B<fanotify_init>(2)."
246
247 #. type: Plain text
248 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
249 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
250 msgid ""
251 "Two types of events are generated: I<notification> events and I<permission> "
252 "events. Notification events are merely informative and require no action to "
253 "be taken by the receiving application with one exception: if a valid file "
254 "descriptor is provided within a generic event, the file descriptor must be "
255 "closed. Permission events are requests to the receiving application to "
256 "decide whether permission for a file access shall be granted. For these "
257 "events, the recipient must write a response which decides whether access is "
258 "granted or not."
259 msgstr ""
260 "Deux types d’événements sont créés : les événements de I<notification> et "
261 "les événements de I<permission>. Les événements de notification sont surtout "
262 "informatifs et ne nécessitent pas d’action à prendre par l’application qui "
263 "les reçoit à part pour la fermeture du descripteur de fichier valable passé "
264 "dans l’événement (voir ci-dessous). Les événements de permission sont des "
265 "demandes à l’application qui les reçoit pour décider si les droits d’accès à "
266 "un fichier doivent être attribués. Pour ces événements, le destinataire doit "
267 "écrire une réponse qui décide d’attribuer l’accès ou non."
268
269 #. type: Plain text
270 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
271 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
272 msgid ""
273 "An event is removed from the event queue of the fanotify group when it has "
274 "been read. Permission events that have been read are kept in an internal "
275 "list of the fanotify group until either a permission decision has been taken "
276 "by writing to the fanotify file descriptor or the fanotify file descriptor "
277 "is closed."
278 msgstr ""
279 "Un événement est supprimé de la file d’événements du groupe fanotify quand "
280 "il a été lu. Les événements de permission qui ont été lus sont gardés dans "
281 "une liste interne du groupe fanotify jusqu’à ce qu’une décision "
282 "d’attribution de droits ait été prise en écrivant dans le descripteur de "
283 "fichier fanotify ou que le descripteur de fichier fanotify soit fermé."
284
285 #. type: SS
286 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
287 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
288 #, no-wrap
289 msgid "Reading fanotify events"
290 msgstr "Lecture d’événements fanotify"
291
292 #. type: Plain text
293 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
294 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
295 msgid ""
296 "Calling B<read>(2) for the file descriptor returned by B<fanotify_init>(2) "
297 "blocks (if the flag B<FAN_NONBLOCK> is not specified in the call to "
298 "B<fanotify_init>(2)) until either a file event occurs or the call is "
299 "interrupted by a signal (see B<signal>(7))."
300 msgstr ""
301 "Appeler B<read>(2) pour le descripteur de fichier renvoyé par "
302 "B<fanotify_init>(2) bloque (si l’attribut B<FAN_NONBLOCK> n’est pas indiqué "
303 "dans l’appel de B<fanotify_init>(2)) jusqu’à ce qu’un événement de fichier "
304 "survienne ou que l’appel soit interrompu par un signal (consultez "
305 "B<signal>(7))."
306
307 #. type: Plain text
308 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
309 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
310 msgid ""
311 "After a successful B<read>(2), the read buffer contains one or more of the "
312 "following structures:"
313 msgstr ""
314 "Après un B<read>(2) réussi, le tampon de lecture contient une ou plus des "
315 "structures suivantes :"
316
317 #. type: Plain text
318 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
319 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
320 #, no-wrap
321 msgid ""
322 "struct fanotify_event_metadata {\n"
323 " __u32 event_len;\n"
324 " __u8 vers;\n"
325 " __u8 reserved;\n"
326 " __u16 metadata_len;\n"
327 " __aligned_u64 mask;\n"
328 " __s32 fd;\n"
329 " __s32 pid;\n"
330 "};\n"
331 msgstr ""
332 "struct fanotify_event_metadata {\n"
333 " __u32 event_len;\n"
334 " __u8 vers;\n"
335 " __u8 reserved;\n"
336 " __u16 metadata_len;\n"
337 " __aligned_u64 mask;\n"
338 " __s32 fd;\n"
339 " __s32 pid;\n"
340 "};\n"
341
342 #. type: Plain text
343 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
344 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
345 msgid ""
346 "Information records are supplemental pieces of information that may be "
347 "provided alongside the generic I<fanotify_event_metadata> structure. The "
348 "I<flags> passed to B<fanotify_init>(2) have influence over the type of "
349 "information records that may be returned for an event. For example, if a "
350 "notification group is initialized with B<FAN_REPORT_FID> or "
351 "B<FAN_REPORT_DIR_FID>, then event listeners should also expect to receive a "
352 "I<fanotify_event_info_fid> structure alongside the "
353 "I<fanotify_event_metadata> structure, whereby file handles are used to "
354 "identify filesystem objects rather than file descriptors. Information "
355 "records may also be stacked, meaning that using the various B<FAN_REPORT_*> "
356 "flags in conjunction with one another is supported. In such cases, multiple "
357 "information records can be returned for an event alongside the generic "
358 "I<fanotify_event_metadata> structure. For example, if a notification group "
359 "is initialized with B<FAN_REPORT_TARGET_FID> and B<FAN_REPORT_PIDFD>, then "
360 "an event listener should expect to receive up to two "
361 "I<fanotify_event_info_fid> information records and one "
362 "I<fanotify_event_info_pidfd> information record alongside the generic "
363 "I<fanotify_event_metadata> structure. Importantly, fanotify provides no "
364 "guarantee around the ordering of information records when a notification "
365 "group is initialized with a stacked based configuration. Each information "
366 "record has a nested structure of type I<fanotify_event_info_header>. It is "
367 "imperative for event listeners to inspect the I<info_type> field of this "
368 "structure in order to determine the type of information record that had been "
369 "received for a given event."
370 msgstr ""
371 "Les enregistrements d’information sont des pièces d’information "
372 "supplémentaires qui peuvent être fournies en même temps que la structure "
373 "générique, I<fanotify_event_metadata>. Les I<flag> passés à "
374 "B<fanotify_init>(2) ont une influence sur le type d’enregistrement "
375 "d’information qui peut être renvoyé pour l’évènement. Par exemple, si un "
376 "groupe de notifications est initialisé avec B<FAN_REPORT_FID> ou "
377 "B<FAN_REPORT_DIR_FID>, les écouteurs d’évènement pourront s’attendre aussi à "
378 "recevoir une structure I<fanotify_event_info_fid> en même temps que la "
379 "structure I<fanotify_event_metadata> par laquelle les gestionnaires de "
380 "fichier sont utilisés pour identifier des objets de système de fichiers "
381 "plutôt que des descripteurs de fichier. Les enregistrements d’information "
382 "peuvent être aussi empilés, signifiant qu’utiliser les divers I<flag> "
383 "B<FAN_REPORT_*> en même temps que l’un ou l’autre est pris en charge. Dans "
384 "de tels cas, plusieurs enregistrements d’information peuvent être renvoyés "
385 "pour un évènement en même temps que la structure générique "
386 "I<fanotify_event_metadata>. Par exemple, si un groupe de notifications est "
387 "initialisé avec B<FAN_REPORT_TARGET_FID> et B<FAN_REPORT_PIDFD>, un écouteur "
388 "d’évènement peut s’attendre à recevoir jusqu’à deux enregistrements "
389 "d’information I<fanotify_event_info_fid> et un enregistrement d’information "
390 "I<fanotify_event_info_pidfd> en même temps que la structure générique "
391 "I<fanotify_event_metadata>. Notablement, fanotify ne fournit aucune garantie "
392 "sur l’ordre des enregistrements d’information quand un groupe de "
393 "notifications est initialisé avec une configuration basée sur l’empilage. "
394 "Chaque enregistrement d’information a une structure imbriquée de type "
395 "I<fanotify_event_info_header>. Il est impératif pour les écouteurs "
396 "d’évènement d’inspecter le champ I<info_type> de cette structure pour "
397 "déterminer le type d’enregistrement d’information qui a été reçu pour un "
398 "évènement donné."
399
400 #. type: Plain text
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 msgid ""
404 "In cases where an fanotify group identifies filesystem objects by file "
405 "handles, event listeners should also expect to receive one or more of the "
406 "below information record objects alongside the generic "
407 "I<fanotify_event_metadata> structure within the read buffer:"
408 msgstr ""
409 "Dans le cas d’un groupe fanotify qui identifie des objets de système de "
410 "fichiers par des gestionnaires de fichiers, les écouteurs d’événement "
411 "espèrent recevoir un ou plusieurs objets d’enregistrement d’informations ci-"
412 "dessous en même temps que la structure générique I<fanotify_event_metadata> "
413 "dans le tampon de lecture :"
414
415 #. type: Plain text
416 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
417 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
418 #, no-wrap
419 msgid ""
420 "struct fanotify_event_info_fid {\n"
421 " struct fanotify_event_info_header hdr;\n"
422 " __kernel_fsid_t fsid;\n"
423 " unsigned char handle[];\n"
424 "};\n"
425 msgstr ""
426 "struct fanotify_event_info_fid {\n"
427 " struct fanotify_event_info_header hdr;\n"
428 " __kernel_fsid_t fsid;\n"
429 " unsigned char handle[];\n"
430 "};\n"
431
432 #. type: Plain text
433 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
434 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
435 msgid ""
436 "In cases where an fanotify group is initialized with B<FAN_REPORT_PIDFD>, "
437 "event listeners should expect to receive the below information record object "
438 "alongside the generic I<fanotify_event_metadata> structure within the read "
439 "buffer:"
440 msgstr ""
441 "Dans le cas où un groupe fanotify est initialisé avec B<FAN_REPORT_PIDFD>, "
442 "les écouteurs d’évènement doivent s’attendre à recevoir l’objet "
443 "d’enregistrement d’information ci-dessous en même temps que la structure "
444 "I<fanotify_event_metadata> dans le tampon de lecture :"
445
446 #. type: Plain text
447 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
448 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
449 #, no-wrap
450 msgid ""
451 "struct fanotify_event_info_pidfd {\n"
452 " struct fanotify_event_info_header hdr;\n"
453 " __s32 pidfd;\n"
454 "};\n"
455 msgstr ""
456 "struct fanotify_event_info_pidfd {\n"
457 " struct fanotify_event_info_header hdr;\n"
458 " __s32 pidfd;\n"
459 "};\n"
460
461 #. type: Plain text
462 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
463 #: opensuse-tumbleweed
464 #, fuzzy
465 #| msgid ""
466 #| "In cases where an fanotify group is initialized with B<FAN_REPORT_PIDFD>, "
467 #| "event listeners should expect to receive the below information record "
468 #| "object alongside the generic I<fanotify_event_metadata> structure within "
469 #| "the read buffer:"
470 msgid ""
471 "In cases where an fanotify group is initialized with B<FAN_REPORT_MNT>, "
472 "event listeners should expect to receive the below information record object "
473 "alongside the generic I<fanotify_event_metadata> structure within the read "
474 "buffer. This structure is defined as follows:"
475 msgstr ""
476 "Dans le cas où un groupe fanotify est initialisé avec B<FAN_REPORT_PIDFD>, "
477 "les écouteurs d’évènement doivent s’attendre à recevoir l’objet "
478 "d’enregistrement d’information ci-dessous en même temps que la structure "
479 "I<fanotify_event_metadata> dans le tampon de lecture :"
480
481 #. type: Plain text
482 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
483 #: opensuse-tumbleweed
484 #, fuzzy, no-wrap
485 #| msgid ""
486 #| "struct fanotify_event_info_pidfd {\n"
487 #| " struct fanotify_event_info_header hdr;\n"
488 #| " __s32 pidfd;\n"
489 #| "};\n"
490 msgid ""
491 "struct fanotify_event_info_mnt {\n"
492 " struct fanotify_event_info_header hdr;\n"
493 " __u64 mnt_id;\n"
494 "};\n"
495 msgstr ""
496 "struct fanotify_event_info_pidfd {\n"
497 " struct fanotify_event_info_header hdr;\n"
498 " __s32 pidfd;\n"
499 "};\n"
500
501 #. type: Plain text
502 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
503 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
504 msgid ""
505 "In case of a B<FAN_FS_ERROR> event, an additional information record "
506 "describing the error that occurred is returned alongside the generic "
507 "I<fanotify_event_metadata> structure within the read buffer. This structure "
508 "is defined as follows:"
509 msgstr ""
510 "Dans le cas d’un évènement B<FAN_FS_ERROR>, un enregistrement supplémentaire "
511 "d’information décrivant l’erreur qui s’est produite est renvoyé en même "
512 "temps que la structure I<fanotify_event_metadata> générique dans le tampon "
513 "de lecture. Cette structure est définie comme suit :"
514
515 #. type: Plain text
516 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
517 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
518 #, no-wrap
519 msgid ""
520 "struct fanotify_event_info_error {\n"
521 " struct fanotify_event_info_header hdr;\n"
522 " __s32 error;\n"
523 " __u32 error_count;\n"
524 "};\n"
525 msgstr ""
526 "struct fanotify_event_info_error {\n"
527 " struct fanotify_event_info_header hdr;\n"
528 " __s32 error;\n"
529 " __u32 error_count;\n"
530 "};\n"
531
532 #. type: Plain text
533 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
534 #: opensuse-tumbleweed
535 #, fuzzy
536 #| msgid ""
537 #| "In case of a B<FAN_FS_ERROR> event, an additional information record "
538 #| "describing the error that occurred is returned alongside the generic "
539 #| "I<fanotify_event_metadata> structure within the read buffer. This "
540 #| "structure is defined as follows:"
541 msgid ""
542 "In case of B<FAN_PRE_ACCESS> events, an additional information record "
543 "describing the access range is returned alongside the generic "
544 "I<fanotify_event_metadata> structure within the read buffer. This structure "
545 "is defined as follows:"
546 msgstr ""
547 "Dans le cas d’un évènement B<FAN_FS_ERROR>, un enregistrement supplémentaire "
548 "d’information décrivant l’erreur qui s’est produite est renvoyé en même "
549 "temps que la structure I<fanotify_event_metadata> générique dans le tampon "
550 "de lecture. Cette structure est définie comme suit :"
551
552 #. type: Plain text
553 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
554 #: opensuse-tumbleweed
555 #, fuzzy, no-wrap
556 #| msgid ""
557 #| "struct fanotify_event_info_error {\n"
558 #| " struct fanotify_event_info_header hdr;\n"
559 #| " __s32 error;\n"
560 #| " __u32 error_count;\n"
561 #| "};\n"
562 msgid ""
563 "struct fanotify_event_info_range {\n"
564 " struct fanotify_event_info_header hdr;\n"
565 " __u32 pad;\n"
566 " __u64 offset;\n"
567 " __u64 count;\n"
568 "};\n"
569 msgstr ""
570 "struct fanotify_event_info_error {\n"
571 " struct fanotify_event_info_header hdr;\n"
572 " __s32 error;\n"
573 " __u32 error_count;\n"
574 "};\n"
575
576 #. type: Plain text
577 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
578 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
579 msgid ""
580 "All information records contain a nested structure of type "
581 "I<fanotify_event_info_header>. This structure holds meta-information about "
582 "the information record that may have been returned alongside the generic "
583 "I<fanotify_event_metadata> structure. This structure is defined as follows:"
584 msgstr ""
585 "Tous les enregistrements d’information contiennent une structure imbriquée "
586 "de type I<fanotify_event_info_header>. Cette structure contient des méta-"
587 "informations sur l’enregistrement d’information qui a pu être renvoyé en "
588 "même temps que la structure I<fanotify_event_metadata> générique. Cette "
589 "structure est définie comme suit :"
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 #, no-wrap
595 msgid ""
596 "struct fanotify_event_info_header {\n"
597 "\t__u8 info_type;\n"
598 "\t__u8 pad;\n"
599 "\t__u16 len;\n"
600 "};\n"
601 msgstr ""
602 "struct fanotify_event_info_header {\n"
603 "\t__u8 info_type;\n"
604 "\t__u8 pad;\n"
605 "\t__u16 len;\n"
606 "};\n"
607
608 #. type: Plain text
609 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
610 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
611 msgid ""
612 "For performance reasons, it is recommended to use a large buffer size (for "
613 "example, 4096 bytes), so that multiple events can be retrieved by a single "
614 "B<read>(2)."
615 msgstr ""
616 "Pour des raisons de performances, une grande taille de tampon (par exemple "
617 "4096 octets) est conseillée pour que plusieurs événements puissent être "
618 "récupérés en une seule lecture."
619
620 #. type: Plain text
621 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
622 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
623 msgid ""
624 "The return value of B<read>(2) is the number of bytes placed in the buffer, "
625 "or -1 in case of an error (but see BUGS)."
626 msgstr ""
627 "La valeur de retour de B<read>(2) est le nombre d’octets placés dans le "
628 "tampon, ou B<-1> en cas d’erreur (mais consultez B<BOGUES>)."
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 "The fields of the I<fanotify_event_metadata> structure are as follows:"
634 msgstr ""
635 "Les membres de la structure I<fanotify_event_metadata> sont les suivants."
636
637 #. type: TP
638 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
639 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
640 #, no-wrap
641 msgid "I<event_len>"
642 msgstr "I<event_len>"
643
644 #. type: Plain text
645 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
646 #: opensuse-leap-16-1 opensuse-tumbleweed
647 #, fuzzy
648 #| msgid ""
649 #| "This is the length of the data for the current event and the offset to "
650 #| "the next event in the buffer. Unless the group identifies filesystem "
651 #| "objects by file handles, the value of I<event_len> is always "
652 #| "B<FAN_EVENT_METADATA_LEN>. For a group that identifies filesystem "
653 #| "objects by file handles, I<event_len> also includes the variable length "
654 #| "file identifier records."
655 msgid ""
656 "This is the size of the data for the current event and the offset to the "
657 "next event in the buffer. Unless the group identifies filesystem objects by "
658 "file handles, the value of I<event_len> is always "
659 "B<FAN_EVENT_METADATA_LEN>. For a group that identifies filesystem objects "
660 "by file handles, I<event_len> also includes the variable size file "
661 "identifier records."
662 msgstr ""
663 "C’est la taille des données pour l’événement actuel et la position du "
664 "prochain événement dans le tampon. À moins que le groupe identifie des "
665 "objets du système de fichiers par des gestionnaires de fichiers, la valeur "
666 "d’I<event_len> est toujours B<FAN_EVENT_METADATA_LEN>. Pour un groupe qui "
667 "identifie les objets du système de fichiers par des gestionnaires de "
668 "fichiers, I<event_len> inclut aussi des enregistrements d’identificateur de "
669 "fichier de taille variable."
670
671 #. type: TP
672 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
673 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
674 #, no-wrap
675 msgid "I<vers>"
676 msgstr "I<vers>"
677
678 #. type: Plain text
679 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
680 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
681 msgid ""
682 "This field holds a version number for the structure. It must be compared to "
683 "B<FANOTIFY_METADATA_VERSION> to verify that the structures returned at run "
684 "time match the structures defined at compile time. In case of a mismatch, "
685 "the application should abandon trying to use the fanotify file descriptor."
686 msgstr ""
687 "Ce champ contient un numéro de version pour la structure. Il doit être "
688 "comparé à B<FANOTIFY_METADATA_VERSION> pour vérifier que les structures "
689 "renvoyées pendant l’exécution correspondent aux structures définies à la "
690 "compilation. En cas d’erreur de correspondance, l’application devrait "
691 "arrêter d’essayer d’utiliser le descripteur de fichier fanotify."
692
693 #. type: TP
694 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
695 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
696 #, no-wrap
697 msgid "I<reserved>"
698 msgstr "I<reserved>"
699
700 #. type: Plain text
701 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
702 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
703 msgid "This field is not used."
704 msgstr "Ce champ n’est pas utilisé."
705
706 #. type: TP
707 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
708 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
709 #, no-wrap
710 msgid "I<metadata_len>"
711 msgstr "I<metadata_len>"
712
713 #. type: Plain text
714 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
715 #: opensuse-leap-16-1 opensuse-tumbleweed
716 #, fuzzy
717 #| msgid ""
718 #| "This is the length of the structure. The field was introduced to "
719 #| "facilitate the implementation of optional headers per event type. No "
720 #| "such optional headers exist in the current implementation."
721 msgid ""
722 "This is the size of the structure. The field was introduced to facilitate "
723 "the implementation of optional headers per event type. No such optional "
724 "headers exist in the current implementation."
725 msgstr ""
726 "C’est la taille de la structure. Le champ a été introduit pour faciliter "
727 "l’implémentation d’en-têtes facultatifs par type d’événement. Aucun en-tête "
728 "facultatif n’existe dans l’implémentation actuelle."
729
730 #. type: TP
731 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
732 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
733 #, no-wrap
734 msgid "I<mask>"
735 msgstr "I<mask>"
736
737 #. type: Plain text
738 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
739 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
740 msgid "This is a bit mask describing the event (see below)."
741 msgstr "C’est un masque binaire décrivant l’événement (voir ci-dessous)."
742
743 #. type: TP
744 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
745 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
746 #, no-wrap
747 msgid "I<fd>"
748 msgstr "I<fd>"
749
750 #. type: Plain text
751 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
752 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
753 msgid ""
754 "This is an open file descriptor for the object being accessed, or "
755 "B<FAN_NOFD> if a queue overflow occurred. With an fanotify group that "
756 "identifies filesystem objects by file handles, applications should expect "
757 "this value to be set to B<FAN_NOFD> for each event that is received. The "
758 "file descriptor can be used to access the contents of the monitored file or "
759 "directory. The reading application is responsible for closing this file "
760 "descriptor."
761 msgstr ""
762 "C’est un descripteur de fichier ouvert pour l’objet actuellement accédé ou "
763 "B<FAN_NOFD> si un dépassement de file est survenu. Avec un groupe fanotify "
764 "qui identifie les objets de système d’exploitation par des gestionnaires de "
765 "fichiers, les applications doivent escompter que cette valeur soit "
766 "B<FAN_NOFD> pour chaque évènement qu’elles reçoivent. Le descripteur de "
767 "fichier peut être utilisé pour accéder au contenu du fichier ou répertoire "
768 "surveillé. L’application qui lit est responsable de la fermeture de ce "
769 "descripteur de fichier."
770
771 #. type: Plain text
772 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
773 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
774 msgid ""
775 "When calling B<fanotify_init>(2), the caller may specify (via the "
776 "I<event_f_flags> argument) various file status flags that are to be set on "
777 "the open file description that corresponds to this file descriptor. In "
778 "addition, the (kernel-internal) B<FMODE_NONOTIFY> file status flag is set "
779 "on the open file description. This flag suppresses fanotify event "
780 "generation. Hence, when the receiver of the fanotify event accesses the "
781 "notified file or directory using this file descriptor, no additional events "
782 "will be created."
783 msgstr ""
784 "Lors d’un appel de B<fanotify_init>(2), l’appelant pourrait indiquer (à "
785 "l’aide de l’argument I<event_f_flags>) plusieurs attributs d’état de fichier "
786 "à définir dans la description de fichier ouverte qui correspond à ce "
787 "descripteur de fichier. De plus, l’attribut d’état de fichier "
788 "B<FMODE_NONOTIFY> (interne au noyau) est défini dans la description de "
789 "fichier ouverte. L’attribut supprime la création d’événement fanotify. "
790 "Ainsi, quand le destinataire de l’événement fanotify accède au fichier ou "
791 "répertoire notifié en utilisant ce descripteur de fichier, aucun événement "
792 "supplémentaire n’est créé."
793
794 #. type: Plain text
795 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
796 #: opensuse-tumbleweed
797 msgid ""
798 "When an fanotify group is initialized using B<FAN_REPORT_FD_ERROR>, this "
799 "field will contain a negative error value in case a file descriptor could "
800 "not be opened and in case of a queue overflow, the value will be B<-EBADF>."
801 msgstr ""
802
803 #. type: TP
804 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
805 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
806 #, no-wrap
807 msgid "I<pid>"
808 msgstr "I<pid>"
809
810 #. type: Plain text
811 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
812 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
813 msgid ""
814 "If flag B<FAN_REPORT_TID> was set in B<fanotify_init>(2), this is the TID of "
815 "the thread that caused the event. Otherwise, this the PID of the process "
816 "that caused the event."
817 msgstr ""
818 "Si l’attribut B<FAN_REPORT_TID> était réglé dans B<fanotify_init>(2), c’est "
819 "l’identifiant (TID) du thread qui a provoqué cet évènement. Sinon, c’est le "
820 "PID du processus qui a provoqué cet évènement."
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 "A program listening to fanotify events can compare this PID to the PID "
827 "returned by B<getpid>(2), to determine whether the event is caused by the "
828 "listener itself, or is due to a file access by another process."
829 msgstr ""
830 "Un programme écoutant les événements fanotify peut comparer ce PID au PID "
831 "renvoyé par B<getpid>(2) pour déterminer si l’événement est provoqué par "
832 "l’écoutant lui-même ou par un autre processus accédant au fichier."
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 "The bit mask in I<mask> indicates which events have occurred for a single "
839 "filesystem object. Multiple bits may be set in this mask, if more than one "
840 "event occurred for the monitored filesystem object. In particular, "
841 "consecutive events for the same filesystem object and originating from the "
842 "same process may be merged into a single event, with the exception that two "
843 "permission events are never merged into one queue entry."
844 msgstr ""
845 "Le masque binaire I<mask> indique les événements survenus pour un seul objet "
846 "de système de fichiers. Plusieurs bits pourraient être définis dans ce "
847 "masque si plus d’un événement est survenu pour l’objet de système de "
848 "fichiers surveillé. En particulier, les événements consécutifs pour le même "
849 "objet de système de fichiers et originaires du même processus pourraient "
850 "être fusionnés dans un seul événement, mais deux événements de permission ne "
851 "sont jamais fusionnés dans une entrée de file."
852
853 #. type: Plain text
854 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
855 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
856 msgid "The bits that may appear in I<mask> are as follows:"
857 msgstr "Les bits pouvant apparaître dans I<mask> sont les suivants."
858
859 #. type: TP
860 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
861 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
862 #, no-wrap
863 msgid "B<FAN_ACCESS>"
864 msgstr "B<FAN_ACCESS>"
865
866 #. type: Plain text
867 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
868 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
869 msgid "A file or a directory (but see BUGS) was accessed (read)."
870 msgstr ""
871 "Un fichier ou un répertoire (mais consultez B<BOGUES>) a été accédé (en "
872 "lecture)."
873
874 #. type: TP
875 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
876 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
877 #, no-wrap
878 msgid "B<FAN_OPEN>"
879 msgstr "B<FAN_OPEN>"
880
881 #. type: Plain text
882 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
883 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
884 msgid "A file or a directory was opened."
885 msgstr "Un fichier ou un répertoire a été ouvert."
886
887 #. type: TP
888 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
889 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
890 #, no-wrap
891 msgid "B<FAN_OPEN_EXEC>"
892 msgstr "B<FAN_OPEN_EXEC>"
893
894 #. type: Plain text
895 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
896 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
897 msgid ""
898 "A file was opened with the intent to be executed. See NOTES in "
899 "B<fanotify_mark>(2) for additional details."
900 msgstr ""
901 "Un fichier a été ouvert dans le but d’être exécuté. Consultez NOTES dans "
902 "B<fanotify_mark>(2) pour plus de détails."
903
904 #. type: TP
905 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
906 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
907 #, no-wrap
908 msgid "B<FAN_ATTRIB>"
909 msgstr "B<FAN_ATTRIB>"
910
911 #. type: Plain text
912 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
913 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
914 msgid "A file or directory metadata was changed."
915 msgstr "Une métadonnée de fichier ou d’un répertoire a été modifiée."
916
917 #. type: TP
918 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
919 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
920 #, no-wrap
921 msgid "B<FAN_CREATE>"
922 msgstr "B<FAN_CREATE>"
923
924 #. type: Plain text
925 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
926 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
927 msgid "A child file or directory was created in a watched parent."
928 msgstr ""
929 "Un fichier enfant ou un répertoire a été créé dans le répertoire surveillé."
930
931 #. type: TP
932 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
933 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
934 #, no-wrap
935 msgid "B<FAN_DELETE>"
936 msgstr "B<FAN_DELETE>"
937
938 #. type: Plain text
939 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
940 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
941 msgid "A child file or directory was deleted in a watched parent."
942 msgstr ""
943 "Un fichier enfant ou un répertoire a été supprimé dans le répertoire "
944 "surveillé."
945
946 #. type: TP
947 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
948 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
949 #, no-wrap
950 msgid "B<FAN_DELETE_SELF>"
951 msgstr "B<FAN_DELETE_SELF>"
952
953 #. type: Plain text
954 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
955 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
956 msgid "A watched file or directory was deleted."
957 msgstr "Un fichier ou un répertoire a été supprimé."
958
959 #. type: TP
960 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
961 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
962 #, no-wrap
963 msgid "B<FAN_RENAME>"
964 msgstr "B<FAN_RENAME>"
965
966 #. type: Plain text
967 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
968 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
969 msgid ""
970 "A file or directory has been moved to or from a watched parent directory."
971 msgstr ""
972 "Un fichier ou un répertoire a été déplacé de ou vers un répertoire parent "
973 "surveillé."
974
975 #. type: TP
976 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
977 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
978 #, no-wrap
979 msgid "B<FAN_MOVED_FROM>"
980 msgstr "B<FAN_MOVED_FROM>"
981
982 #. type: Plain text
983 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
984 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
985 msgid "A file or directory has been moved from a watched parent directory."
986 msgstr "Un fichier ou un répertoire a été déplacé du répertoire surveillé."
987
988 #. type: TP
989 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
990 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
991 #, no-wrap
992 msgid "B<FAN_MOVED_TO>"
993 msgstr "B<FAN_MOVED_TO>"
994
995 #. type: Plain text
996 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
997 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
998 msgid "A file or directory has been moved to a watched parent directory."
999 msgstr ""
1000 "Un fichier ou un répertoire a été déplacé vers un répertoire parent "
1001 "surveillé."
1002
1003 #. type: TP
1004 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1005 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1006 #, no-wrap
1007 msgid "B<FAN_MOVE_SELF>"
1008 msgstr "B<IN_MOVE_SELF>"
1009
1010 #. type: Plain text
1011 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1012 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1013 msgid "A watched file or directory was moved."
1014 msgstr "Un fichier ou un répertoire surveillé a été déplacé."
1015
1016 #. type: TP
1017 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1018 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1019 #, no-wrap
1020 msgid "B<FAN_MODIFY>"
1021 msgstr "B<FAN_MODIFY>"
1022
1023 #. type: Plain text
1024 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1025 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1026 msgid "A file was modified."
1027 msgstr "Un fichier a été modifié."
1028
1029 #. type: TP
1030 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1031 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1032 #, no-wrap
1033 msgid "B<FAN_CLOSE_WRITE>"
1034 msgstr "B<FAN_CLOSE_WRITE>"
1035
1036 #. type: Plain text
1037 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1038 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1039 msgid ""
1040 "A file that was opened for writing (B<O_WRONLY> or B<O_RDWR>) was closed."
1041 msgstr ""
1042 "Un fichier qui était ouvert en écriture (B<O_WRONLY> ou B<O_RDWR>) a été "
1043 "fermé."
1044
1045 #. type: TP
1046 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1047 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1048 #, no-wrap
1049 msgid "B<FAN_CLOSE_NOWRITE>"
1050 msgstr "B<FAN_CLOSE_NOWRITE>"
1051
1052 #. type: Plain text
1053 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1054 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1055 msgid ""
1056 "A file or directory that was opened read-only (B<O_RDONLY>) was closed."
1057 msgstr ""
1058 "Un fichier ou un répertoire, qui était ouvert en lecture seule "
1059 "(B<O_RDONLY>), a été fermé."
1060
1061 #. type: TP
1062 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1063 #: opensuse-tumbleweed
1064 #, fuzzy, no-wrap
1065 #| msgid "B<FAN_ATTRIB>"
1066 msgid "B<FAN_MNT_ATTACH>"
1067 msgstr "B<FAN_ATTRIB>"
1068
1069 #. type: Plain text
1070 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1071 #: opensuse-tumbleweed
1072 msgid "A mount was attached to mount namespace."
1073 msgstr ""
1074
1075 #. type: TP
1076 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1077 #: opensuse-tumbleweed
1078 #, fuzzy, no-wrap
1079 #| msgid "B<FAN_OPEN_EXEC>"
1080 msgid "B<FAN_MNT_DETACH>"
1081 msgstr "B<FAN_OPEN_EXEC>"
1082
1083 #. type: Plain text
1084 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1085 #: opensuse-tumbleweed
1086 msgid "A mount was detached from mount namespace."
1087 msgstr ""
1088
1089 #. type: TP
1090 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1091 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1092 #, no-wrap
1093 msgid "B<FAN_FS_ERROR>"
1094 msgstr "B<FAN_FS_ERROR>"
1095
1096 #. type: Plain text
1097 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1098 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1099 msgid "A filesystem error was detected."
1100 msgstr "Une erreur de système de fichiers a été détectée."
1101
1102 #. type: TP
1103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1105 #, no-wrap
1106 msgid "B<FAN_Q_OVERFLOW>"
1107 msgstr "B<FAN_Q_OVERFLOW>"
1108
1109 #. type: Plain text
1110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1112 msgid ""
1113 "The event queue exceeded the limit on number of events. This limit can be "
1114 "overridden by specifying the B<FAN_UNLIMITED_QUEUE> flag when calling "
1115 "B<fanotify_init>(2)."
1116 msgstr ""
1117 "La file d’événements a dépassé la limite du nombre d’évènements. Cette "
1118 "limite peut être écrasée en indiquant l’attribut B<FAN_UNLIMITED_QUEUE> lors "
1119 "de l’appel de B<fanotify_init>(2)."
1120
1121 #. type: TP
1122 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1123 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1124 #, no-wrap
1125 msgid "B<FAN_ACCESS_PERM>"
1126 msgstr "B<FAN_ACCESS_PERM>"
1127
1128 #. type: Plain text
1129 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1130 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1131 msgid ""
1132 "An application wants to read a file or directory, for example using "
1133 "B<read>(2) or B<readdir>(2). The reader must write a response (as "
1134 "described below) that determines whether the permission to access the "
1135 "filesystem object shall be granted."
1136 msgstr ""
1137 "Une application veut lire un fichier ou répertoire, par exemple en utilisant "
1138 "B<read>(2) ou B<readdir>(2). Le lecteur doit écrire une réponse (telle que "
1139 "décrite ci-dessous) qui détermine si le droit d’accès à l’objet de système "
1140 "de fichiers sera attribué."
1141
1142 #. type: TP
1143 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1144 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1145 #, no-wrap
1146 msgid "B<FAN_OPEN_PERM>"
1147 msgstr "B<FAN_OPEN_PERM>"
1148
1149 #. type: Plain text
1150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1152 msgid ""
1153 "An application wants to open a file or directory. The reader must write a "
1154 "response that determines whether the permission to open the filesystem "
1155 "object shall be granted."
1156 msgstr ""
1157 "Une application veut ouvrir un fichier ou un répertoire. Le lecteur doit "
1158 "écrire une réponse qui détermine si le droit d’ouvrir l’objet de système de "
1159 "fichiers sera attribué."
1160
1161 #. type: TP
1162 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1163 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1164 #, no-wrap
1165 msgid "B<FAN_OPEN_EXEC_PERM>"
1166 msgstr "B<FAN_OPEN_EXEC_PERM>"
1167
1168 #. type: Plain text
1169 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1170 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1171 msgid ""
1172 "An application wants to open a file for execution. The reader must write a "
1173 "response that determines whether the permission to open the filesystem "
1174 "object for execution shall be granted. See NOTES in B<fanotify_mark>(2) "
1175 "for additional details."
1176 msgstr ""
1177 "Une application veut ouvrir un fichier pour une exécution. Le lecteur doit "
1178 "écrire une réponse qui détermine si le droit d’ouvrir l’objet de système de "
1179 "fichiers sera attribué. Consultez NOTES dans B<fanotify_mark>(2) pour plus "
1180 "de détails."
1181
1182 #. type: Plain text
1183 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1184 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1185 msgid "To check for any close event, the following bit mask may be used:"
1186 msgstr ""
1187 "Pour vérifier tous les événements fermés, le masque binaire suivant pourrait "
1188 "être utilisé :"
1189
1190 #. type: TP
1191 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1192 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1193 #, no-wrap
1194 msgid "B<FAN_CLOSE>"
1195 msgstr "B<FAN_CLOSE>"
1196
1197 #. type: Plain text
1198 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1199 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1200 msgid "A file was closed. This is a synonym for:"
1201 msgstr "Un fichier a été fermé. C’est un synonyme de :"
1202
1203 #. type: Plain text
1204 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1205 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1206 #, no-wrap
1207 msgid "FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE\n"
1208 msgstr "FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE\n"
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 msgid "To check for any move event, the following bit mask may be used:"
1214 msgstr ""
1215 "Pour vérifier tous les événements de déplacement, le masque binaire suivant "
1216 "pourrait être utilisé :"
1217
1218 #. type: TP
1219 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1220 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1221 #, no-wrap
1222 msgid "B<FAN_MOVE>"
1223 msgstr "B<FAN_MOVE>"
1224
1225 #. type: Plain text
1226 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1227 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1228 msgid "A file or directory was moved. This is a synonym for:"
1229 msgstr "Un fichier ou un répertoire a été déplacé. C’est un synonyme de :"
1230
1231 #. type: Plain text
1232 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1233 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1234 #, no-wrap
1235 msgid "FAN_MOVED_FROM | FAN_MOVED_TO\n"
1236 msgstr "FAN_MOVED_FROM | FAN_MOVED_TO\n"
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 msgid ""
1242 "The following bits may appear in I<mask> only in conjunction with other "
1243 "event type bits:"
1244 msgstr ""
1245 "Les bits suivants peuvent apparaître dans I<mask> seulement conjointement "
1246 "avec d’autres bits de type d’évènement :"
1247
1248 #. type: TP
1249 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1250 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1251 #, no-wrap
1252 msgid "B<FAN_ONDIR>"
1253 msgstr "B<FAN_ONDIR>"
1254
1255 #. type: Plain text
1256 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1257 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1258 msgid ""
1259 "The events described in the I<mask> have occurred on a directory object. "
1260 "Reporting events on directories requires setting this flag in the mark "
1261 "mask. See B<fanotify_mark>(2) for additional details. The B<FAN_ONDIR> "
1262 "flag is reported in an event mask only if the fanotify group identifies "
1263 "filesystem objects by file handles."
1264 msgstr ""
1265 "Les évènements décrits dans le I<mask> se sont déroulés dans un objet de "
1266 "répertoire. Le rapport d’évènements dans des répertoires requiert le réglage "
1267 "de cet attribut dans le masque I<mark>. Consultez B<fanotify_mark>(2) pour "
1268 "plus de détails. L’attribut B<FAN_ONDIR> est rapporté dans un masque "
1269 "d’évènement seulement si le groupe fanotify identifie les objets de système "
1270 "d’exploitation avec des gestionnaires de fichiers."
1271
1272 #. type: Plain text
1273 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1274 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1275 msgid ""
1276 "Information records that are supplied alongside the generic "
1277 "I<fanotify_event_metadata> structure will always contain a nested structure "
1278 "of type I<fanotify_event_info_header>. The fields of the "
1279 "I<fanotify_event_info_header> are as follows:"
1280 msgstr ""
1281 "Les enregistrements d’information qui sont fournis en même temps que la "
1282 "structure I<fanotify_event_metadata> générique contiendront toujours une "
1283 "structure imbriquée de type I<fanotify_event_info_header>. Les membres de "
1284 "I<fanotify_event_info_header> sont les suivants :"
1285
1286 #. type: TP
1287 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1288 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1289 #, no-wrap
1290 msgid "I<info_type>"
1291 msgstr "I<info_type>"
1292
1293 #. type: Plain text
1294 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1295 #: opensuse-tumbleweed
1296 msgid ""
1297 "A unique integer value representing the type of information record object "
1298 "received for an event. The value of this field can be set to one of the "
1299 "following."
1300 msgstr ""
1301
1302 #. type: TP
1303 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1304 #: opensuse-tumbleweed
1305 #, no-wrap
1306 msgid "B<FAN_EVENT_INFO_TYPE_FID>"
1307 msgstr ""
1308
1309 #. type: TQ
1310 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1311 #: opensuse-tumbleweed
1312 #, no-wrap
1313 msgid "B<FAN_EVENT_INFO_TYPE_DFID>"
1314 msgstr ""
1315
1316 #. type: TQ
1317 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1318 #: opensuse-tumbleweed
1319 #, no-wrap
1320 msgid "B<FAN_EVENT_INFO_TYPE_DFID_NAME>"
1321 msgstr ""
1322
1323 #. type: TQ
1324 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1325 #: opensuse-tumbleweed
1326 #, no-wrap
1327 msgid "B<FAN_EVENT_INFO_TYPE_PIDFD>"
1328 msgstr ""
1329
1330 #. type: TQ
1331 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1332 #: opensuse-tumbleweed
1333 #, fuzzy, no-wrap
1334 #| msgid "B<FAN_FS_ERROR>"
1335 msgid "B<FAN_EVENT_INFO_TYPE_ERROR>"
1336 msgstr "B<FAN_FS_ERROR>"
1337
1338 #. type: TQ
1339 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1340 #: opensuse-tumbleweed
1341 #, fuzzy, no-wrap
1342 #| msgid "B<FAN_EVENT_METADATA_LEN>"
1343 msgid "B<FAN_EVENT_INFO_TYPE_RANGE>"
1344 msgstr "B<FAN_EVENT_METADATA_LEN>"
1345
1346 #. type: TQ
1347 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1348 #: opensuse-tumbleweed
1349 #, fuzzy, no-wrap
1350 #| msgid "B<FAN_EVENT_METADATA_LEN>"
1351 msgid "B<FAN_EVENT_INFO_TYPE_MNT>"
1352 msgstr "B<FAN_EVENT_METADATA_LEN>"
1353
1354 #. type: Plain text
1355 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1356 #: opensuse-tumbleweed
1357 #, fuzzy
1358 #| msgid ""
1359 #| "A unique integer value representing the type of information record object "
1360 #| "received for an event. The value of this field can be set to one of the "
1361 #| "following: B<FAN_EVENT_INFO_TYPE_FID>, B<FAN_EVENT_INFO_TYPE_DFID>, "
1362 #| "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, or B<FAN_EVENT_INFO_TYPE_PIDFD>. The "
1363 #| "value set for this field is dependent on the flags that have been "
1364 #| "supplied to B<fanotify_init>(2). Refer to the field details of each "
1365 #| "information record object type below to understand the different cases in "
1366 #| "which the I<info_type> values can be set."
1367 msgid ""
1368 "The value set for this field is dependent on the flags that have been "
1369 "supplied to B<fanotify_init>(2). Refer to the field details of each "
1370 "information record object type below to understand the different cases in "
1371 "which the I<info_type> values can be set."
1372 msgstr ""
1373 "Valeur entière unique représentant le type d’objet d’enregistrement "
1374 "d’information reçu pour un évènement. Ce champ peut être défini à une des "
1375 "valeurs suivantes : B<FAN_EVENT_INFO_TYPE_FID>, B<FAN_EVENT_INFO_TYPE_DFID>, "
1376 "B<FAN_EVENT_INFO_TYPE_DFID_NAME> ou B<FAN_EVENT_INFO_TYPE_PIDFD>. L’ensemble "
1377 "des valeurs pour ce champ est dépendant des drapeaux qui ont été fournis à "
1378 "B<fanotify_init>(2). Se référer aux détails des champs pour chaque type "
1379 "d’objet d’enregistrement d’information ci-dessous pour appréhender les "
1380 "différents cas dans lesquels les valeurs I<info_type> peuvent être définies."
1381
1382 #. type: TP
1383 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1384 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1385 #, no-wrap
1386 msgid "I<pad>"
1387 msgstr "I<pad>"
1388
1389 #. type: Plain text
1390 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1391 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1392 msgid ""
1393 "This field is currently not used by any information record object type and "
1394 "therefore is set to zero."
1395 msgstr ""
1396 "Ce champ n’est actuellement utilisé par aucun type d’objet d’enregistrement "
1397 "d’information et, par conséquent, est défini à zéro."
1398
1399 #. type: TP
1400 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1401 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1402 #, no-wrap
1403 msgid "I<len>"
1404 msgstr "I<len>"
1405
1406 #. type: Plain text
1407 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1408 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1409 msgid ""
1410 "The value of I<len> is set to the size of the information record object, "
1411 "including the I<fanotify_event_info_header>. The total size of all "
1412 "additional information records is not expected to be larger than "
1413 "(I<event_len> - I<metadata_len>)."
1414 msgstr ""
1415 "La valeur de I<len> est définie à la taille de l’objet d’enregistrement "
1416 "d’information, incluant le I<fanotify_event_info_header>. La taille totale "
1417 "de tous les enregistrements d’information supplémentaires ne peut être "
1418 "supérieure à (I<event_len> - I<metadata_len>)."
1419
1420 #. type: Plain text
1421 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1422 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1423 msgid "The fields of the I<fanotify_event_info_fid> structure are as follows:"
1424 msgstr ""
1425 "Les membres de la structure I<fanotify_event_info_fid> sont les suivants."
1426
1427 #. type: TP
1428 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1429 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1430 #, no-wrap
1431 msgid "I<hdr>"
1432 msgstr "I<hdr>"
1433
1434 #. type: Plain text
1435 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1436 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1437 msgid ""
1438 "This is a structure of type I<fanotify_event_info_header>. For example, "
1439 "when an fanotify file descriptor is created using B<FAN_REPORT_FID>, a "
1440 "single information record is expected to be attached to the event with "
1441 "I<info_type> field value of B<FAN_EVENT_INFO_TYPE_FID>. When an fanotify "
1442 "file descriptor is created using the combination of B<FAN_REPORT_FID> and "
1443 "B<FAN_REPORT_DIR_FID>, there may be two information records attached to the "
1444 "event: one with I<info_type> field value of B<FAN_EVENT_INFO_TYPE_DFID>, "
1445 "identifying a parent directory object, and one with I<info_type> field value "
1446 "of B<FAN_EVENT_INFO_TYPE_FID>, identifying a child object. Note that for "
1447 "the directory entry modification events B<FAN_CREATE>, B<FAN_DELETE>, "
1448 "B<FAN_MOVE>, and B<FAN_RENAME>, an information record identifying the "
1449 "created/deleted/moved child object is reported only if an fanotify group was "
1450 "initialized with the flag B<FAN_REPORT_TARGET_FID>."
1451 msgstr ""
1452 "C’est une structure de type I<fanotify_event_info_header>. Par exemple, "
1453 "quand un descripteur de fichier fanotify est créé en utilisant "
1454 "B<FAN_REPORT_FID>, un enregistrement unique est supposé être attaché à "
1455 "l’évènement avec la valeur de champ I<info_type> de "
1456 "B<FAN_EVENT_INFO_TYPE_FID>. Quand un descripteur de fichier fanotify est "
1457 "créé en utilisant la combinaison de B<FAN_REPORT_FID> et "
1458 "B<FAN_REPORT_DIR_FID>, il peut y avoir deux enregistrements d’informations "
1459 "attachés à l’évènement : un avec une valeur de champ I<info_type> de "
1460 "B<FAN_EVENT_INFO_TYPE_DFID>, identifiant un objet de répertoire parent, et "
1461 "un avec une valeur de champ I<info_type> de B<FAN_EVENT_INFO_TYPE_FID>, "
1462 "identifiant un objet enfant. Il est à remarquer que pour des évènements de "
1463 "modification d’entrée de répertoire B<FAN_CREATE>, B<FAN_DELETE>, "
1464 "B<FAN_MOVE> et B<FAN_RENAME>, un enregistrement d’information identifiant "
1465 "l’objet enfant créé, supprimé ou déplacé est rapporté seulement si un groupe "
1466 "fanotify a été initialisé avec le drapeau B<FAN_REPORT_TARGET_FID>."
1467
1468 #. type: TP
1469 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1470 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1471 #, no-wrap
1472 msgid "I<fsid>"
1473 msgstr "I<fsid>"
1474
1475 #. type: Plain text
1476 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1477 #: opensuse-leap-16-1 opensuse-tumbleweed
1478 msgid ""
1479 "This is a unique identifier of the filesystem containing the object "
1480 "associated with the event. It is a structure of type I<__kernel_fsid_t> and "
1481 "contains the same value as I<f_fsid> when calling B<statfs>(2). Note that "
1482 "some filesystems (e.g., B<fuse>(4)) report zero I<fsid>. In these cases, "
1483 "it is not possible to use I<fsid> to associate the event with a specific "
1484 "filesystem instance, so monitoring different filesystem instances that "
1485 "report zero I<fsid> with the same fanotify group is not supported."
1486 msgstr ""
1487
1488 #. type: TP
1489 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1490 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1491 #, no-wrap
1492 msgid "I<handle>"
1493 msgstr "I<handle>"
1494
1495 #. type: Plain text
1496 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1497 #: opensuse-leap-16-1 opensuse-tumbleweed
1498 #, fuzzy
1499 #| msgid ""
1500 #| "This field contains a variable-length structure of type I<struct "
1501 #| "file_handle>. It is an opaque handle that corresponds to a specified "
1502 #| "object on a filesystem as returned by B<name_to_handle_at>(2). It can be "
1503 #| "used to uniquely identify a file on a filesystem and can be passed as an "
1504 #| "argument to B<open_by_handle_at>(2). If the value of I<info_type> field "
1505 #| "is B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the file handle is followed by a "
1506 #| "null terminated string that identifies the created/deleted/moved "
1507 #| "directory entry name. For other events such as B<FAN_OPEN>, "
1508 #| "B<FAN_ATTRIB>, B<FAN_DELETE_SELF>, and B<FAN_MOVE_SELF>, if the value of "
1509 #| "I<info_type> field is B<FAN_EVENT_INFO_TYPE_FID>, the I<handle> "
1510 #| "identifies the object correlated to the event. If the value of "
1511 #| "I<info_type> field is B<FAN_EVENT_INFO_TYPE_DFID>, the I<handle> "
1512 #| "identifies the directory object correlated to the event or the parent "
1513 #| "directory of a non-directory object correlated to the event. If the "
1514 #| "value of I<info_type> field is B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the "
1515 #| "I<handle> identifies the same directory object that would be reported "
1516 #| "with B<FAN_EVENT_INFO_TYPE_DFID> and the file handle is followed by a "
1517 #| "null terminated string that identifies the name of a directory entry in "
1518 #| "that directory, or '.' to identify the directory object itself."
1519 msgid ""
1520 "This field contains a variable-size structure of type I<struct "
1521 "file_handle>. It is an opaque handle that corresponds to a specified object "
1522 "on a filesystem as returned by B<name_to_handle_at>(2). It can be used to "
1523 "uniquely identify a file on a filesystem and can be passed as an argument to "
1524 "B<open_by_handle_at>(2). If the value of I<info_type> field is "
1525 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the file handle is followed by a null "
1526 "terminated string that identifies the created/deleted/moved directory entry "
1527 "name. For other events such as B<FAN_OPEN>, B<FAN_ATTRIB>, "
1528 "B<FAN_DELETE_SELF>, and B<FAN_MOVE_SELF>, if the value of I<info_type> field "
1529 "is B<FAN_EVENT_INFO_TYPE_FID>, the I<handle> identifies the object "
1530 "correlated to the event. If the value of I<info_type> field is "
1531 "B<FAN_EVENT_INFO_TYPE_DFID>, the I<handle> identifies the directory object "
1532 "correlated to the event or the parent directory of a non-directory object "
1533 "correlated to the event. If the value of I<info_type> field is "
1534 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the I<handle> identifies the same "
1535 "directory object that would be reported with B<FAN_EVENT_INFO_TYPE_DFID> and "
1536 "the file handle is followed by a null terminated string that identifies the "
1537 "name of a directory entry in that directory, or '.' to identify the "
1538 "directory object itself."
1539 msgstr ""
1540 "Ce champ contient une structure de taille variable de type I<struct "
1541 "file_handle>. C’est un gestionnaire opaque qui correspond à un objet précis "
1542 "de système de fichiers comme renvoyé par B<name_to_handle_at>(2). Il peut "
1543 "être utilisé uniquement pour identifier un fichier d’un système de fichiers "
1544 "et peut être passé comme argument à B<open_by_handle_at>(2). Si la valeur du "
1545 "champ I<info_type> est B<FAN_EVENT_INFO_TYPE_DFID_NAME>, le gestionnaire de "
1546 "fichiers est suivi d’un octet NULL final qui identifie le nom d’entrée de "
1547 "répertoire créée/supprimée/déplacée. Pour les autres évènements tels que "
1548 "B<FAN_OPEN>, B<FAN_ATTRIB>, B<FAN_DELETE_SELF> et B<FAN_MOVE_SELF>, si la "
1549 "valeur du champ I<info_type> est B<FAN_EVENT_INFO_TYPE_FID>, le I<handle> "
1550 "identifie l’objet corrélé à l’évènement. Si la valeur du champ I<info_type> "
1551 "est B<FAN_EVENT_INFO_TYPE_DFID>, le I<handle> identifie l’objet de "
1552 "répertoire corrélé à l’évènement ou le répertoire parent d’un objet non-"
1553 "répertoire corrélé à l’évènement. Si la valeur du champ I<info_type> est "
1554 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, le I<handle> identifie le même objet de "
1555 "répertoire qui aurait été rapporté avec B<FAN_EVENT_INFO_TYPE_DFID> et le "
1556 "gestionnaire de fichier est suivi d’un octet NULL final qui identifie le nom "
1557 "de l’entrée de répertoire dans ce répertoire ou « . » pour identifier "
1558 "l’objet du répertoire."
1559
1560 #. type: Plain text
1561 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1562 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1563 msgid ""
1564 "The fields of the I<fanotify_event_info_pidfd> structure are as follows:"
1565 msgstr ""
1566 "Les membres de la structure I<fanotify_event_info_pidfd> sont les suivants."
1567
1568 #. type: Plain text
1569 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1570 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1571 msgid ""
1572 "This is a structure of type I<fanotify_event_info_header>. When an fanotify "
1573 "group is initialized using B<FAN_REPORT_PIDFD>, the I<info_type> field value "
1574 "of the I<fanotify_event_info_header> is set to B<FAN_EVENT_INFO_TYPE_PIDFD>."
1575 msgstr ""
1576 "C’est une structure de type I<fanotify_event_info_header>. Quand un groupe "
1577 "fanotify est initialisé avec B<FAN_REPORT_PIDFD>, le champ I<info_type> de "
1578 "I<fanotify_event_info_header> est défini à B<FAN_EVENT_INFO_TYPE_PIDFD>."
1579
1580 #. type: TP
1581 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1582 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1583 #, no-wrap
1584 msgid "I<pidfd>"
1585 msgstr "I<pidfd>"
1586
1587 #. type: Plain text
1588 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1589 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1590 msgid ""
1591 "This is a process file descriptor that refers to the process responsible for "
1592 "generating the event. The returned process file descriptor is no different "
1593 "from one which could be obtained manually if B<pidfd_open>(2) were to be "
1594 "called on I<fanotify_event_metadata.pid>. In the instance that an error is "
1595 "encountered during pidfd creation, one of two possible error types "
1596 "represented by a negative integer value may be returned in this I<pidfd> "
1597 "field. In cases where the process responsible for generating the event has "
1598 "terminated prior to the event listener being able to read events from the "
1599 "notification queue, B<FAN_NOPIDFD> is returned. The pidfd creation for an "
1600 "event is only performed at the time the events are read from the "
1601 "notification queue. All other possible pidfd creation failures are "
1602 "represented by B<FAN_EPIDFD>. Once the event listener has dealt with an "
1603 "event and the pidfd is no longer required, the pidfd should be closed via "
1604 "B<close>(2)."
1605 msgstr ""
1606 "C’est un descripteur de fichier de processus qui fait référence au processus "
1607 "responsable de la génération de l’évènement. Le descripteur de fichier de "
1608 "processus n’est pas différent de celui qui pourrait être obtenu manuellement "
1609 "si B<pidfd_open>(2) était appelé sur I<fanotify_event_metadata.pid>. Dans "
1610 "cette instance où une erreur pourrait se produire lors de la création de "
1611 "pidfd, un des deux types d’erreur possibles représentés par un entier "
1612 "négatif pourrait être renvoyé dans ce champ I<pidfd>. Dans le cas où le "
1613 "processus responsable de la création de l’évènement s’est terminé avant que "
1614 "l’écouteur d’évènement soit capable de lire des évènements dans la file de "
1615 "notifications, B<FAN_NOPIDFD> est renvoyé. La création de pidfd pour un "
1616 "évènement est seulement faite au moment où les évènements sont lus à partir "
1617 "de la file de notifications. Tous les autres échecs possibles de création de "
1618 "pidfd sont représentés par B<FAN_EPIDFD>. Une fois que l’écouteur "
1619 "d’évènement a traité un évènement et que le pidfd n’est plus nécessaire, "
1620 "celui-ci sera fermé à l’aide de B<close>(2)."
1621
1622 #. type: Plain text
1623 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1624 #: opensuse-tumbleweed
1625 msgid ""
1626 "When an fanotify group is initialized using B<FAN_REPORT_FD_ERROR>, this "
1627 "field will contain a negative error value in case a pidfd creation failure "
1628 "and in case of a terminated process, the value will be B<-ESRCH>."
1629 msgstr ""
1630
1631 #. type: Plain text
1632 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1633 #: opensuse-tumbleweed
1634 #, fuzzy
1635 #| msgid ""
1636 #| "The fields of the I<fanotify_event_info_fid> structure are as follows:"
1637 msgid "The fields of the I<fanotify_event_info_mnt> structure are as follows:"
1638 msgstr ""
1639 "Les membres de la structure I<fanotify_event_info_fid> sont les suivants."
1640
1641 #. type: TP
1642 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1643 #: opensuse-tumbleweed
1644 #, fuzzy, no-wrap
1645 #| msgid "I<hdr>"
1646 msgid "I<.hdr>"
1647 msgstr "I<hdr>"
1648
1649 #. type: Plain text
1650 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1651 #: opensuse-tumbleweed
1652 #, fuzzy
1653 #| msgid ""
1654 #| "This is a structure of type I<fanotify_event_info_header>. The "
1655 #| "I<info_type> field is set to B<FAN_EVENT_INFO_TYPE_ERROR>."
1656 msgid ""
1657 "This is a structure of type I<fanotify_event_info_header>. The "
1658 "I<.info_type> field is set to B<FAN_EVENT_INFO_TYPE_MNT>."
1659 msgstr ""
1660 "C’est une structure de type I<fanotify_event_info_header>. Le champ "
1661 "I<info_type> est défini à B<FAN_EVENT_INFO_TYPE_ERROR>."
1662
1663 #. type: TP
1664 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1665 #: opensuse-tumbleweed
1666 #, fuzzy, no-wrap
1667 #| msgid "I<mnt_id>"
1668 msgid "I<.mnt_id>"
1669 msgstr "I<mnt_id>"
1670
1671 #. type: Plain text
1672 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1673 #: opensuse-tumbleweed
1674 msgid ""
1675 "Identifies the mount associated with the event. It is a 64-bit unique mount "
1676 "id as the one returned by B<statx>(2) with the B<STATX_MNT_ID_UNIQUE> flag."
1677 msgstr ""
1678
1679 #. type: Plain text
1680 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1681 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1682 msgid ""
1683 "The fields of the I<fanotify_event_info_error> structure are as follows:"
1684 msgstr ""
1685 "Les membres de la structure I<fanotify_event_info_error> sont les suivants."
1686
1687 #. type: Plain text
1688 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1689 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1690 msgid ""
1691 "This is a structure of type I<fanotify_event_info_header>. The I<info_type> "
1692 "field is set to B<FAN_EVENT_INFO_TYPE_ERROR>."
1693 msgstr ""
1694 "C’est une structure de type I<fanotify_event_info_header>. Le champ "
1695 "I<info_type> est défini à B<FAN_EVENT_INFO_TYPE_ERROR>."
1696
1697 #. type: TP
1698 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1699 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1700 #, no-wrap
1701 msgid "I<error>"
1702 msgstr "I<error>"
1703
1704 #. type: Plain text
1705 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1706 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1707 msgid "Identifies the type of error that occurred."
1708 msgstr "Ce champ identifie le type d’erreur qui s’est produite."
1709
1710 #. type: TP
1711 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1712 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1713 #, no-wrap
1714 msgid "I<error_count>"
1715 msgstr "I<error_count>"
1716
1717 #. type: Plain text
1718 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1719 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1720 msgid ""
1721 "This is a counter of the number of errors suppressed since the last error "
1722 "was read."
1723 msgstr ""
1724 "C’est un compteur du nombre d’erreurs supprimées depuis que la dernière "
1725 "erreur a été lue."
1726
1727 #. type: Plain text
1728 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1729 #: opensuse-tumbleweed
1730 #, fuzzy
1731 #| msgid ""
1732 #| "The fields of the I<fanotify_event_info_error> structure are as follows:"
1733 msgid ""
1734 "The fields of the I<fanotify_event_info_range> structure are as follows:"
1735 msgstr ""
1736 "Les membres de la structure I<fanotify_event_info_error> sont les suivants."
1737
1738 #. type: Plain text
1739 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1740 #: opensuse-tumbleweed
1741 #, fuzzy
1742 #| msgid ""
1743 #| "This is a structure of type I<fanotify_event_info_header>. The "
1744 #| "I<info_type> field is set to B<FAN_EVENT_INFO_TYPE_ERROR>."
1745 msgid ""
1746 "This is a structure of type I<fanotify_event_info_header>. The I<info_type> "
1747 "field is set to B<FAN_EVENT_INFO_TYPE_RANGE>."
1748 msgstr ""
1749 "C’est une structure de type I<fanotify_event_info_header>. Le champ "
1750 "I<info_type> est défini à B<FAN_EVENT_INFO_TYPE_ERROR>."
1751
1752 #. type: TP
1753 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1754 #: opensuse-tumbleweed
1755 #, fuzzy, no-wrap
1756 #| msgid "I<error_count>"
1757 msgid "I<count>"
1758 msgstr "I<error_count>"
1759
1760 #. type: Plain text
1761 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1762 #: opensuse-tumbleweed
1763 #, fuzzy
1764 #| msgid "The following values may be written to the file:"
1765 msgid "The number of bytes being read or written to the file."
1766 msgstr "Les valeurs suivantes peuvent être écrites dans le fichier :"
1767
1768 #. type: TP
1769 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1770 #: opensuse-tumbleweed
1771 #, fuzzy, no-wrap
1772 #| msgid "I<aio_offset>"
1773 msgid "I<offset>"
1774 msgstr "I<aio_offset>"
1775
1776 #. type: Plain text
1777 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1778 #: opensuse-tumbleweed
1779 #, fuzzy
1780 #| msgid "The following values may be written to the file:"
1781 msgid "The offset from which bytes are read or written to the file."
1782 msgstr "Les valeurs suivantes peuvent être écrites dans le fichier :"
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 "The following macros are provided to iterate over a buffer containing "
1789 "fanotify event metadata returned by a B<read>(2) from an fanotify file "
1790 "descriptor:"
1791 msgstr ""
1792 "Les macros suivantes sont fournies pour itérer sur un tampon contenant les "
1793 "métadonnées d’événement fanotify renvoyées par B<read>(2) à partir d’un "
1794 "descripteur de fichier fanotify."
1795
1796 #. type: TP
1797 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1798 #: opensuse-leap-16-1 opensuse-tumbleweed
1799 #, fuzzy, no-wrap
1800 #| msgid "B<FAN_EVENT_OK(meta, len)>"
1801 msgid "B<FAN_EVENT_OK(meta, size)>"
1802 msgstr "B<FAN_EVENT_OK(meta, len)>"
1803
1804 #. type: Plain text
1805 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1806 #: opensuse-leap-16-1 opensuse-tumbleweed
1807 #, fuzzy
1808 #| msgid ""
1809 #| "This macro checks the remaining length I<len> of the buffer I<meta> "
1810 #| "against the length of the metadata structure and the I<event_len> field "
1811 #| "of the first metadata structure in the buffer."
1812 msgid ""
1813 "This macro checks the remaining size I<size> of the buffer I<meta> against "
1814 "the size of the metadata structure and the I<event_len> field of the first "
1815 "metadata structure in the buffer."
1816 msgstr ""
1817 "Cette macro compare la taille restante I<len> du tampon I<meta> à la taille "
1818 "de la structure de métadonnées et au champ I<event_len> de la première "
1819 "structure de métadonnées du tampon."
1820
1821 #. type: TP
1822 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1823 #: opensuse-leap-16-1 opensuse-tumbleweed
1824 #, fuzzy, no-wrap
1825 #| msgid "B<FAN_EVENT_NEXT(meta, len)>"
1826 msgid "B<FAN_EVENT_NEXT(meta, size)>"
1827 msgstr "B<FAN_EVENT_NEXT(meta, len)>"
1828
1829 #. type: Plain text
1830 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1831 #: opensuse-leap-16-1 opensuse-tumbleweed
1832 #, fuzzy
1833 #| msgid ""
1834 #| "This macro uses the length indicated in the I<event_len> field of the "
1835 #| "metadata structure pointed to by I<meta> to calculate the address of the "
1836 #| "next metadata structure that follows I<meta>. I<len> is the number of "
1837 #| "bytes of metadata that currently remain in the buffer. The macro returns "
1838 #| "a pointer to the next metadata structure that follows I<meta>, and "
1839 #| "reduces I<len> by the number of bytes in the metadata structure that has "
1840 #| "been skipped over (i.e., it subtracts I<meta-E<gt>event_len> from I<len>)."
1841 msgid ""
1842 "This macro uses the size indicated in the I<event_len> field of the metadata "
1843 "structure pointed to by I<meta> to calculate the address of the next "
1844 "metadata structure that follows I<meta>. I<size> is the number of bytes of "
1845 "metadata that currently remain in the buffer. The macro returns a pointer "
1846 "to the next metadata structure that follows I<meta>, and reduces I<size> by "
1847 "the number of bytes in the metadata structure that has been skipped over "
1848 "(i.e., it subtracts I<meta-E<gt>event_len> from I<size>)."
1849 msgstr ""
1850 "Cette macro utilise la taille indiquée dans le champ I<event_len> de la "
1851 "structure de métadonnées pointée par I<meta> pour calculer l’adresse de la "
1852 "prochaine structure de métadonnées qui suit I<meta>. I<len> est le nombre "
1853 "d’octets de métadonnées qui restent actuellement dans le tampon. La macro "
1854 "renvoie un pointeur vers la prochaine structure de métadonnées qui suit "
1855 "I<meta> et réduit I<len> du nombre d’octets dans la structure de métadonnées "
1856 "qui a été sautée (c’est-à-dire qu’elle soustrait I<meta-E<gt>event_len> de "
1857 "I<len>)."
1858
1859 #. type: Plain text
1860 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1861 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1862 msgid "In addition, there is:"
1863 msgstr "De plus, il existe :"
1864
1865 #. type: TP
1866 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1867 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1868 #, no-wrap
1869 msgid "B<FAN_EVENT_METADATA_LEN>"
1870 msgstr "B<FAN_EVENT_METADATA_LEN>"
1871
1872 #. type: Plain text
1873 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1874 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1875 msgid ""
1876 "This macro returns the size (in bytes) of the structure "
1877 "I<fanotify_event_metadata>. This is the minimum size (and currently the "
1878 "only size) of any event metadata."
1879 msgstr ""
1880 "Cette macro renvoie la taille (en octet) de la structure "
1881 "I<fanotify_event_metadata>. C’est la taille minimale (et actuellement la "
1882 "seule taille) de métadonnées d’événements."
1883
1884 #. type: SS
1885 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1886 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1887 #, no-wrap
1888 msgid "Monitoring an fanotify file descriptor for events"
1889 msgstr "Surveiller un descripteur de fichier fanotify pour les événements"
1890
1891 #. type: Plain text
1892 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1893 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1894 msgid ""
1895 "When an fanotify event occurs, the fanotify file descriptor indicates as "
1896 "readable when passed to B<epoll>(7), B<poll>(2), or B<select>(2)."
1897 msgstr ""
1898 "Quand un événement fanotify survient, le descripteur de fichier fanotify est "
1899 "indiqué comme lisible lorsque passé à B<epoll>(7), B<poll>(2) ou "
1900 "B<select>(2)."
1901
1902 #. type: SS
1903 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1904 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1905 #, no-wrap
1906 msgid "Dealing with permission events"
1907 msgstr "Traitement des événements de permission"
1908
1909 #. type: Plain text
1910 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1911 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1912 msgid ""
1913 "For permission events, the application must B<write>(2) a structure of the "
1914 "following form to the fanotify file descriptor:"
1915 msgstr ""
1916 "Pour les événements de permission, l’application doit écrire (avec "
1917 "B<write>(2)) une structure de la forme suivante sur le descripteur de "
1918 "fichier fanotify :"
1919
1920 #. type: Plain text
1921 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1922 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1923 #, no-wrap
1924 msgid ""
1925 "struct fanotify_response {\n"
1926 " __s32 fd;\n"
1927 " __u32 response;\n"
1928 "};\n"
1929 msgstr ""
1930 "struct fanotify_response {\n"
1931 " __s32 fd;\n"
1932 " __u32 response;\n"
1933 "};\n"
1934
1935 #. type: Plain text
1936 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1937 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1938 msgid "The fields of this structure are as follows:"
1939 msgstr "Les membres de cette structure sont les suivants :"
1940
1941 #. type: Plain text
1942 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1943 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1944 msgid ""
1945 "This is the file descriptor from the structure I<fanotify_event_metadata>."
1946 msgstr ""
1947 "C’est le descripteur de fichier de la structure I<fanotify_event_metadata>."
1948
1949 #. type: TP
1950 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1951 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1952 #, no-wrap
1953 msgid "I<response>"
1954 msgstr "I<response>"
1955
1956 #. type: Plain text
1957 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1958 #: opensuse-tumbleweed
1959 #, fuzzy
1960 #| msgid ""
1961 #| "This field indicates whether or not the permission is to be granted. Its "
1962 #| "value must be either B<FAN_ALLOW> to allow the file operation or "
1963 #| "B<FAN_DENY> to deny the file operation."
1964 msgid ""
1965 "This field indicates whether or not the permission is to be granted. Its "
1966 "value must contain either the flag B<FAN_ALLOW> to allow the file operation "
1967 "or B<FAN_DENY> to deny the file operation."
1968 msgstr ""
1969 "Ce champ indique si les droits doivent être attribués ou non. Cette valeur "
1970 "doit être soit B<FAN_ALLOW> pour permettre l’opération de fichier, soit "
1971 "B<FAN_DENY> pour refuser l’opération de fichier."
1972
1973 #. commit b4b2ff4f61ded819bfa22e50fdec7693f51cbbee
1974 #. type: Plain text
1975 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1976 #: opensuse-tumbleweed
1977 msgid ""
1978 "If access is denied, the requesting application call will receive an "
1979 "B<EPERM> error. Since Linux 6.13, if a notification group is initialized "
1980 "with class B<FAN_CLASS_PRE_CONTENT>, the file operation can be denied with "
1981 "errors other than B<EPERM>. For example, for the requesting application to "
1982 "get the B<EIO> error, the event listener can write the response "
1983 "B<FAN_DENY_ERRNO>(B<EIO>). At the time of writing, only the following error "
1984 "values could be returned to the application with "
1985 "B<FAN_DENY_ERRNO>(\\f[I]e\\fR) macro: B<EPERM>, B<EIO>, B<EBUSY>, "
1986 "B<ETXTBSY>, B<EAGAIN>, B<ENOSPC>, B<EDQUOT>."
1987 msgstr ""
1988
1989 #. type: Plain text
1990 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1991 #: opensuse-tumbleweed
1992 #, fuzzy
1993 #| msgid ""
1994 #| "If access is denied, the requesting application call will receive an "
1995 #| "B<EPERM> error. Additionally, if the notification group has been created "
1996 #| "with the B<FAN_ENABLE_AUDIT> flag, then the B<FAN_AUDIT> flag can be set "
1997 #| "in the I<response> field. In that case, the audit subsystem will log "
1998 #| "information about the access decision to the audit logs."
1999 msgid ""
2000 "Additionally, if the notification group has been created with the "
2001 "B<FAN_ENABLE_AUDIT> flag, then the B<FAN_AUDIT> flag can be set in the "
2002 "I<response> field. In that case, the audit subsystem will log information "
2003 "about the access decision to the audit logs."
2004 msgstr ""
2005 "Si l’accès est refusé, l’appel de l’application requérante recevra une "
2006 "erreur B<EPERM>. De plus, si le groupe de notifications a été créé avec "
2007 "l’attribut B<FAN_ENABLE_AUDIT>, alors l’attribut B<FAN_AUDIT> peut être "
2008 "défini dans le champ I<response>. Dans ce cas, le sous-système d’audit "
2009 "journalisera l’information à propos de la décision d’accès aux journaux "
2010 "d’audit."
2011
2012 #. commit 70529a199574c15a40f46b14256633b02ba10ca2
2013 #. type: Plain text
2014 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2015 #: opensuse-tumbleweed
2016 msgid ""
2017 "Since Linux 6.3, the B<FAN_INFO> flag can be set in the I<.response> field. "
2018 "It indicates that an extra variable-length response record follows the "
2019 "I<fanotify_response> structure. Extra response records start with a common "
2020 "header:"
2021 msgstr ""
2022
2023 #. type: Plain text
2024 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2025 #: opensuse-tumbleweed
2026 #, fuzzy, no-wrap
2027 #| msgid ""
2028 #| "struct fanotify_event_info_header {\n"
2029 #| "\t__u8 info_type;\n"
2030 #| "\t__u8 pad;\n"
2031 #| "\t__u16 len;\n"
2032 #| "};\n"
2033 msgid ""
2034 "struct fanotify_response_info_header {\n"
2035 " __u8 type;\n"
2036 " __u8 pad;\n"
2037 " __u16 len;\n"
2038 "};\n"
2039 msgstr ""
2040 "struct fanotify_event_info_header {\n"
2041 "\t__u8 info_type;\n"
2042 "\t__u8 pad;\n"
2043 "\t__u16 len;\n"
2044 "};\n"
2045
2046 #. type: Plain text
2047 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2048 #: opensuse-tumbleweed
2049 msgid ""
2050 "The value of I<.type> determines the format of the extra response record."
2051 msgstr ""
2052
2053 #. type: TP
2054 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2055 #: opensuse-tumbleweed
2056 #, fuzzy, no-wrap
2057 #| msgid "B<FAN_CLOSE_NOWRITE>"
2058 msgid "B<FAN_RESPONSE_INFO_AUDIT_RULE>"
2059 msgstr "B<FAN_CLOSE_NOWRITE>"
2060
2061 #. type: Plain text
2062 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2063 #: opensuse-tumbleweed
2064 msgid ""
2065 "The following response record is expected with extra details for the audit "
2066 "log:"
2067 msgstr ""
2068
2069 #. type: Plain text
2070 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2071 #: opensuse-tumbleweed
2072 #, fuzzy, no-wrap
2073 #| msgid ""
2074 #| "struct fanotify_event_info_error {\n"
2075 #| " struct fanotify_event_info_header hdr;\n"
2076 #| " __s32 error;\n"
2077 #| " __u32 error_count;\n"
2078 #| "};\n"
2079 msgid ""
2080 "struct fanotify_response_info_audit_rule {\n"
2081 " struct fanotify_response_info_header hdr;\n"
2082 " __u32 rule_number;\n"
2083 " __u32 subj_trust;\n"
2084 " __u32 obj_trust;\n"
2085 "};\n"
2086 msgstr ""
2087 "struct fanotify_event_info_error {\n"
2088 " struct fanotify_event_info_header hdr;\n"
2089 " __s32 error;\n"
2090 " __u32 error_count;\n"
2091 "};\n"
2092
2093 #. type: SS
2094 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2095 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2096 #, no-wrap
2097 msgid "Monitoring filesystems for errors"
2098 msgstr "Supervision des erreurs des systèmes de fichiers"
2099
2100 #. type: Plain text
2101 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2102 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2103 msgid ""
2104 "A single B<FAN_FS_ERROR> event is stored per filesystem at once. Extra "
2105 "error messages are suppressed and accounted for in the I<error_count> field "
2106 "of the existing B<FAN_FS_ERROR> event record, but details about the errors "
2107 "are lost."
2108 msgstr ""
2109 "Un seul évènement B<FAN_FS_ERROR> à la fois est stocké par système de "
2110 "fichiers. Les messages d’erreur supplémentaires sont supprimés et comptés "
2111 "dans le champ I<error_count> dans l’enregistrement existant d’évènement "
2112 "B<FAN_FS_ERROR>, mais les détails à propos des erreurs sont perdus."
2113
2114 #. type: Plain text
2115 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2116 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2117 msgid ""
2118 "Errors reported by B<FAN_FS_ERROR> are generic I<errno> values, but not all "
2119 "kinds of error types are reported by all filesystems."
2120 msgstr ""
2121 "Les erreurs rapportées par B<FAN_FS_ERROR> sont des erreurs génériques "
2122 "I<errno>, mais tous les types d’erreur ne sont pas rapportés par tous les "
2123 "systèmes de fichiers."
2124
2125 #. type: Plain text
2126 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2127 #: opensuse-tumbleweed
2128 #, fuzzy
2129 #| msgid ""
2130 #| "Errors not directly related to a file (i.e. super block corruption) are "
2131 #| "reported with an invalid I<handle>. For these errors, the I<handle> will "
2132 #| "have the field I<handle_type> set to B<FILEID_INVALID>, and the handle "
2133 #| "buffer size set to B<0>."
2134 msgid ""
2135 "Errors not directly related to a file (i.e., super block corruption) are "
2136 "reported with an invalid I<handle>. For these errors, the I<handle> will "
2137 "have the field I<handle_type> set to B<FILEID_INVALID>, and the handle "
2138 "buffer size set to B<0>."
2139 msgstr ""
2140 "Les erreurs ne concernant pas directement un fichier (c’est-à-dire des "
2141 "corruptions de superbloc) sont rapportées avec un I<handle> non valable. "
2142 "Pour ces erreurs, le I<handle> aura le champ I<handle_type> défini à "
2143 "B<FILEID_INVALID> et la taille de tampon de I<handle> définie à B<0>."
2144
2145 #. type: SS
2146 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2147 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2148 #, no-wrap
2149 msgid "Closing the fanotify file descriptor"
2150 msgstr "Fermeture du descripteur de fichier fanotify"
2151
2152 #. type: Plain text
2153 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2154 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2155 msgid ""
2156 "When all file descriptors referring to the fanotify notification group are "
2157 "closed, the fanotify group is released and its resources are freed for reuse "
2158 "by the kernel. Upon B<close>(2), outstanding permission events will be set "
2159 "to allowed."
2160 msgstr ""
2161 "Quand tous les descripteurs de fichier se référant au groupe de "
2162 "notifications fanotify sont fermés, le groupe fanotify est libéré et ses "
2163 "ressources sont libérées pour être réutilisées par le noyau. Lors de l’appel "
2164 "de B<close>(2), les événements de permission restants seront définis à "
2165 "permis."
2166
2167 #. type: SS
2168 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2169 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2170 #, no-wrap
2171 msgid "/proc interfaces"
2172 msgstr "/proc interfaces"
2173
2174 #. type: Plain text
2175 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2176 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2177 msgid ""
2178 "The file I</proc/>pidI</fdinfo/>fd contains information about fanotify marks "
2179 "for file descriptor I<fd> of process I<pid>. See B<proc>(5) for details."
2180 msgstr ""
2181 "Le fichier I</proc/>pidI</fdinfo/>fd contient des renseignements sur les "
2182 "marques fanotify pour le descripteur de fichier I<fd> du processus I<pid>. "
2183 "Consulter B<proc>(5) pour plus de précisions."
2184
2185 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
2186 #. type: Plain text
2187 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2188 #: opensuse-leap-16-1 opensuse-tumbleweed
2189 #, fuzzy
2190 #| msgid ""
2191 #| "Since Linux 5.13, the following interfaces can be used to control the "
2192 #| "amount of kernel resources consumed by fanotify:"
2193 msgid ""
2194 "Since Linux 5.13 (and 5.10.220), the following interfaces can be used to "
2195 "control the amount of kernel resources consumed by fanotify:"
2196 msgstr ""
2197 "Depuis Linux 5.13, les interfaces suivantes peuvent être utilisées pour "
2198 "contrôler la quantité de ressources du noyau utilisées par B<fanotify> :"
2199
2200 #. type: TP
2201 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2202 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2203 #, no-wrap
2204 msgid "I</proc/sys/fs/fanotify/max_queued_events>"
2205 msgstr "I</proc/sys/fs/fanotify/max_queued_events>"
2206
2207 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
2208 #. type: Plain text
2209 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2210 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2211 msgid ""
2212 "The value in this file is used when an application calls "
2213 "B<fanotify_init>(2) to set an upper limit on the number of events that can "
2214 "be queued to the corresponding fanotify group. Events in excess of this "
2215 "limit are dropped, but an B<FAN_Q_OVERFLOW> event is always generated. "
2216 "Prior to Linux kernel 5.13, the hardcoded limit was 16384 events."
2217 msgstr ""
2218 "La valeur dans ce fichier est utilisée quand une application appelle "
2219 "B<fanotify_init>(2) pour définir la limite supérieure du nombre d’évènements "
2220 "qui peuvent être mis dans la file d’attente du groupe fanotify "
2221 "correspondant. Les évènements qui font que cette limite est dépassée sont "
2222 "abandonnés, mais un évènement B<FAN_Q_OVERFLOW> est toujours généré. Avant "
2223 "le noyau 5.13 de Linux, la limite codée en dur était de 16384 évènements."
2224
2225 #. type: TP
2226 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2227 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2228 #, no-wrap
2229 msgid "I</proc/sys/fs/fanotify/max_user_group>"
2230 msgstr "I</proc/sys/fs/fanotify/max_user_group>"
2231
2232 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
2233 #. type: Plain text
2234 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2235 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2236 msgid ""
2237 "This specifies an upper limit on the number of fanotify groups that can be "
2238 "created per real user ID. Prior to Linux kernel 5.13, the hardcoded limit "
2239 "was 128 groups per user."
2240 msgstr ""
2241 "La valeur dans ce fichier définit la limite supérieure du nombre de groupes "
2242 "fanotify pouvant être créés par ID réel d’utilisateur. Avant le noyau 5.13 "
2243 "de Linux, la limite codée en dur était de 128 groupes par utilisateur."
2244
2245 #. type: TP
2246 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2247 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2248 #, no-wrap
2249 msgid "I</proc/sys/fs/fanotify/max_user_marks>"
2250 msgstr "I</proc/sys/fs/fanotify/max_user_marks>"
2251
2252 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
2253 #. type: Plain text
2254 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2255 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2256 msgid ""
2257 "This specifies an upper limit on the number of fanotify marks that can be "
2258 "created per real user ID. Prior to Linux kernel 5.13, the hardcoded limit "
2259 "was 8192 marks per group (not per user)."
2260 msgstr ""
2261 "La valeur dans ce fichier définit la limite supérieure du nombre de marques "
2262 "fanotify pouvant être créées par ID réel d’utilisateur. Avant le noyau 5.13 "
2263 "de Linux, la limite codée en dur était de 8192 marques par groupe (pas par "
2264 "utilisateur)."
2265
2266 #. type: SH
2267 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2268 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2269 #, no-wrap
2270 msgid "ERRORS"
2271 msgstr "ERREURS"
2272
2273 #. type: Plain text
2274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2276 msgid ""
2277 "In addition to the usual errors for B<read>(2), the following errors can "
2278 "occur when reading from the fanotify file descriptor:"
2279 msgstr ""
2280 "En plus des erreurs habituelles de B<read>(2), les erreurs suivantes peuvent "
2281 "survenir lors de la lecture d’un descripteur de fichier fanotify."
2282
2283 #. type: TP
2284 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2285 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2286 #, no-wrap
2287 msgid "B<EINVAL>"
2288 msgstr "B<EINVAL>"
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 "The buffer is too small to hold the event."
2294 msgstr "Le tampon est trop petit pour contenir l’événement."
2295
2296 #. type: TP
2297 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2298 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2299 #, no-wrap
2300 msgid "B<EMFILE>"
2301 msgstr "B<EMFILE>"
2302
2303 #. type: Plain text
2304 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2305 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2306 msgid ""
2307 "The per-process limit on the number of open files has been reached. See the "
2308 "description of B<RLIMIT_NOFILE> in B<getrlimit>(2)."
2309 msgstr ""
2310 "La limite par processus du nombre de fichiers ouverts a été atteinte. "
2311 "Consultez la description de B<RLIMIT_NOFILE> dans B<getrlimit>(2)."
2312
2313 #. type: TP
2314 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2315 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2316 #, no-wrap
2317 msgid "B<ENFILE>"
2318 msgstr "B<ENFILE>"
2319
2320 #. type: Plain text
2321 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2322 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2323 msgid ""
2324 "The system-wide limit on the total number of open files has been reached. "
2325 "See I</proc/sys/fs/file-max> in B<proc>(5)."
2326 msgstr ""
2327 "La limite du nombre de fichiers ouverts sur le système a été atteinte. "
2328 "Consultez I</proc/sys/fs/file-max> dans B<proc>(5)."
2329
2330 #. type: TP
2331 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2332 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2333 #, no-wrap
2334 msgid "B<ETXTBSY>"
2335 msgstr "B<ETXTBSY>"
2336
2337 #. type: Plain text
2338 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2339 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2340 msgid ""
2341 "This error is returned by B<read>(2) if B<O_RDWR> or B<O_WRONLY> was "
2342 "specified in the I<event_f_flags> argument when calling B<fanotify_init>(2) "
2343 "and an event occurred for a monitored file that is currently being executed."
2344 msgstr ""
2345 "Cette erreur est renvoyée par B<read>(2) si B<O_RDWR> ou B<O_WRONLY> ont été "
2346 "indiqués dans l’argument I<event_f_flags> lors de l’appel "
2347 "B<fanotify_init>(2) et qu’un événement est survenu pour un fichier surveillé "
2348 "actuellement en cours d’exécution."
2349
2350 #. type: Plain text
2351 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2352 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2353 msgid ""
2354 "In addition to the usual errors for B<write>(2), the following errors can "
2355 "occur when writing to the fanotify file descriptor:"
2356 msgstr ""
2357 "En plus des erreurs habituelles de B<write>(2), les erreurs suivantes "
2358 "peuvent survenir lors de l’écriture sur un descripteur de fichier fanotify."
2359
2360 #. type: Plain text
2361 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2362 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2363 msgid ""
2364 "Fanotify access permissions are not enabled in the kernel configuration or "
2365 "the value of I<response> in the response structure is not valid."
2366 msgstr ""
2367 "Les droits d’accès fanotify ne sont pas activés dans la configuration du "
2368 "noyau ou la valeur de I<response> dans la structure de réponse n’est pas "
2369 "valable."
2370
2371 #. type: TP
2372 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2373 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2374 #, no-wrap
2375 msgid "B<ENOENT>"
2376 msgstr "B<ENOENT>"
2377
2378 #. type: Plain text
2379 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2380 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2381 msgid ""
2382 "The file descriptor I<fd> in the response structure is not valid. This may "
2383 "occur when a response for the permission event has already been written."
2384 msgstr ""
2385 "Le descripteur de fichier I<fd> dans la structure de réponse n’est pas "
2386 "valable. Cela pourrait survenir quand une réponse pour l’événement de "
2387 "permission a déjà été écrite."
2388
2389 #. type: SH
2390 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2391 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2392 #, no-wrap
2393 msgid "STANDARDS"
2394 msgstr "NORMES"
2395
2396 #. type: Plain text
2397 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2398 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2399 msgid "Linux."
2400 msgstr "Linux."
2401
2402 #. type: SH
2403 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2404 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2405 #, no-wrap
2406 msgid "HISTORY"
2407 msgstr "HISTORIQUE"
2408
2409 #. type: Plain text
2410 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2411 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2412 msgid ""
2413 "The fanotify API was introduced in Linux 2.6.36 and enabled in Linux "
2414 "2.6.37. fdinfo support was added in Linux 3.8."
2415 msgstr ""
2416 "L’interface de programmation fanotify a été introduite dans Linux 2.6.36 et "
2417 "activée dans Linux 2.6.37. La prise en charge de fdinfo a été ajoutée dans "
2418 "Linux 3.8."
2419
2420 #. type: SH
2421 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2422 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2423 #, no-wrap
2424 msgid "NOTES"
2425 msgstr "NOTES"
2426
2427 #. type: Plain text
2428 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2429 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2430 msgid ""
2431 "The fanotify API is available only if the kernel was built with the "
2432 "B<CONFIG_FANOTIFY> configuration option enabled. In addition, fanotify "
2433 "permission handling is available only if the "
2434 "B<CONFIG_FANOTIFY_ACCESS_PERMISSIONS> configuration option is enabled."
2435 msgstr ""
2436 "L’interface de programmation fanotify n’est disponible que si le noyau a été "
2437 "construit avec l’option de configuration B<CONFIG_FANOTIFY> activée. De "
2438 "plus, le traitement de permission fanotify n’est disponible que si l’option "
2439 "de configuration B<CONFIG_FANOTIFY_ACCESS_PERMISSIONS> est activée."
2440
2441 #. type: SS
2442 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2443 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2444 #, no-wrap
2445 msgid "Limitations and caveats"
2446 msgstr "Limites et réserves"
2447
2448 #. type: Plain text
2449 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2450 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2451 msgid ""
2452 "Fanotify reports only events that a user-space program triggers through the "
2453 "filesystem API. As a result, it does not catch remote events that occur on "
2454 "network filesystems."
2455 msgstr ""
2456 "Fanotify ne signale que les événements déclenchés par un programme en espace "
2457 "utilisateur à l’aide d’une interface de programmation de système de "
2458 "fichiers. Par conséquent, elle n’intercepte pas les événements qui "
2459 "surviennent sur les systèmes de fichiers en réseau."
2460
2461 #. type: Plain text
2462 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2463 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2464 msgid ""
2465 "The fanotify API does not report file accesses and modifications that may "
2466 "occur because of B<mmap>(2), B<msync>(2), and B<munmap>(2)."
2467 msgstr ""
2468 "L'interface fanotify ne signale pas les accès ni les modifications de "
2469 "fichier qui pourraient survenir à cause de B<mmap>(2), B<msync>(2) ou "
2470 "B<munmap>(2)."
2471
2472 #. type: Plain text
2473 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2474 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2475 msgid ""
2476 "Events for directories are created only if the directory itself is opened, "
2477 "read, and closed. Adding, removing, or changing children of a marked "
2478 "directory does not create events for the monitored directory itself."
2479 msgstr ""
2480 "Les événements pour répertoire ne sont créés que si le répertoire lui-même "
2481 "est ouvert, lu et fermé. Ajouter, supprimer ou modifier les enfants d’un "
2482 "répertoire marqué ne crée pas d’événement pour le répertoire surveillé lui-"
2483 "même."
2484
2485 #. type: Plain text
2486 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2487 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2488 msgid ""
2489 "Fanotify monitoring of directories is not recursive: to monitor "
2490 "subdirectories under a directory, additional marks must be created. The "
2491 "B<FAN_CREATE> event can be used for detecting when a subdirectory has been "
2492 "created under a marked directory. An additional mark must then be set on "
2493 "the newly created subdirectory. This approach is racy, because it can lose "
2494 "events that occurred inside the newly created subdirectory, before a mark is "
2495 "added on that subdirectory. Monitoring mounts offers the capability to "
2496 "monitor a whole directory tree in a race-free manner. Monitoring "
2497 "filesystems offers the capability to monitor changes made from any mount of "
2498 "a filesystem instance in a race-free manner."
2499 msgstr ""
2500 "La surveillance fanotify des répertoires n'est pas récursive : pour "
2501 "surveiller les sous-répertoires, des marques supplémentaires doivent être "
2502 "créées. L’évènement B<FAN_CREATE> peut être utilisé pour détecter quand un "
2503 "sous-répertoire a été créé dans un répertoire marqué. Une marque "
2504 "supplémentaire doit être définie dans le sous-répertoire nouvellement créé. "
2505 "Cette approche crée une situation de compétition, parce qu’elle peut perdre "
2506 "les évènements qui se produisent dans le nouveau sous-répertoire avant "
2507 "qu’une marque soit ajoutée dans ce sous-répertoire. La surveillance des "
2508 "montages offre la capacité de surveiller un arbre entier de répertoires sans "
2509 "ce problème de chronologie. La surveillance de système de fichiers offre la "
2510 "capacité de surveiller tout montage d’une instance de système de fichiers "
2511 "sans situation de compétition."
2512
2513 #. type: Plain text
2514 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2515 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2516 msgid "The event queue can overflow. In this case, events are lost."
2517 msgstr ""
2518 "La file d'événements peut déborder. Dans ce cas, les événements sont perdus."
2519
2520 #. type: SH
2521 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2522 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2523 #, no-wrap
2524 msgid "BUGS"
2525 msgstr "BOGUES"
2526
2527 #. commit 820c12d5d6c0890bc93dd63893924a13041fdc35
2528 #. type: Plain text
2529 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2530 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2531 msgid ""
2532 "Before Linux 3.19, B<fallocate>(2) did not generate fanotify events. Since "
2533 "Linux 3.19, calls to B<fallocate>(2) generate B<FAN_MODIFY> events."
2534 msgstr ""
2535 "Avant Linux 3.19, B<fallocate>(2) ne créait pas d'événement fanotify. Depuis "
2536 "Linux 3.19, les appels à B<fallocate>(2) créent des événements B<FAN_MODIFY>."
2537
2538 #. type: Plain text
2539 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2540 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2541 msgid "As of Linux 3.17, the following bugs exist:"
2542 msgstr "Dans Linux 3.17, les bogues suivants existent :"
2543
2544 #. type: IP
2545 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2546 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2547 #, no-wrap
2548 msgid "\\[bu]"
2549 msgstr "-"
2550
2551 #. type: Plain text
2552 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2553 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2554 msgid ""
2555 "On Linux, a filesystem object may be accessible through multiple paths, for "
2556 "example, a part of a filesystem may be remounted using the I<--bind> option "
2557 "of B<mount>(8). A listener that marked a mount will be notified only of "
2558 "events that were triggered for a filesystem object using the same mount. "
2559 "Any other event will pass unnoticed."
2560 msgstr ""
2561 "Dans Linux, un objet du système de fichiers pourrait être accessible par de "
2562 "multiples chemins. Par exemple, une partie d'un système de fichiers pourrait "
2563 "être remontée avec l'option I<--bind> de B<mount>(8). Un écoutant ayant "
2564 "marqué un montage ne sera notifié que des événements déclenchés pour un "
2565 "objet du système de fichiers utilisant le même montage. Tout autre événement "
2566 "passera inaperçu."
2567
2568 #. FIXME . A patch was proposed.
2569 #. type: Plain text
2570 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2571 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2572 msgid ""
2573 "When an event is generated, no check is made to see whether the user ID of "
2574 "the receiving process has authorization to read or write the file before "
2575 "passing a file descriptor for that file. This poses a security risk, when "
2576 "the B<CAP_SYS_ADMIN> capability is set for programs executed by unprivileged "
2577 "users."
2578 msgstr ""
2579 "Quand un événement est créé, aucune vérification n’est effectuée pour voir "
2580 "si l’identifiant utilisateur du processus recevant a le droit de lire ou "
2581 "écrire le fichier avant de passer un descripteur de fichier pour ce fichier. "
2582 "Cela pose un risque de sécurité quand la capacité B<CAP_SYS_ADMIN> est "
2583 "définie pour un programme exécuté par les utilisateurs ordinaires."
2584
2585 #. type: Plain text
2586 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2587 #: opensuse-leap-16-1 opensuse-tumbleweed
2588 #, fuzzy
2589 #| msgid ""
2590 #| "If a call to B<read>(2) processes multiple events from the fanotify "
2591 #| "queue and an error occurs, the return value will be the total length of "
2592 #| "the events successfully copied to the user-space buffer before the error "
2593 #| "occurred. The return value will not be -1, and I<errno> will not be "
2594 #| "set. Thus, the reading application has no way to detect the error."
2595 msgid ""
2596 "If a call to B<read>(2) processes multiple events from the fanotify queue "
2597 "and an error occurs, the return value will be the total size of the events "
2598 "successfully copied to the user-space buffer before the error occurred. The "
2599 "return value will not be -1, and I<errno> will not be set. Thus, the "
2600 "reading application has no way to detect the error."
2601 msgstr ""
2602 "Si un appel de B<read>(2) traite plusieurs événements de la file fanotify et "
2603 "qu’une erreur survient, la valeur de retour sera la taille totale des "
2604 "événements copiés correctement dans le tampon d’espace utilisateur avant que "
2605 "l’erreur ne survienne. La valeur de retour ne sera pas B<-1> et I<errno> ne "
2606 "sera pas définie. Ainsi, l’application lisant n’a aucun moyen de détecter "
2607 "l’erreur."
2608
2609 #. type: SH
2610 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2611 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2612 #, no-wrap
2613 msgid "EXAMPLES"
2614 msgstr "EXEMPLES"
2615
2616 #. type: Plain text
2617 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2618 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2619 msgid ""
2620 "The two example programs below demonstrate the usage of the fanotify API."
2621 msgstr ""
2622 "Les deux programmes ci-dessous montrent l’utilisation de l’API de fanotify."
2623
2624 #. type: SS
2625 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2626 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2627 #, no-wrap
2628 msgid "Example program: fanotify_example.c"
2629 msgstr "Exemple de programme : fanotify_example.c"
2630
2631 #. type: Plain text
2632 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2633 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2634 msgid ""
2635 "The first program is an example of fanotify being used with its event object "
2636 "information passed in the form of a file descriptor. The program marks the "
2637 "mount passed as a command-line argument and waits for events of type "
2638 "B<FAN_OPEN_PERM> and B<FAN_CLOSE_WRITE>. When a permission event occurs, a "
2639 "B<FAN_ALLOW> response is given."
2640 msgstr ""
2641 "Le programme suivant montre l’utilisation de l’interface de programmation "
2642 "fanotify avec les informations d’évènements d’objet passées sous la forme "
2643 "d’un descripteur de fichier. Il marque le point de montage passé en argument "
2644 "de ligne de commande et attend les événements de type B<FAN_OPEN_PERM> et "
2645 "B<FAN_CLOSE_WRITE>. Quand un événement de permission survient, une réponse "
2646 "B<FAN_ALLOW> est donnée."
2647
2648 #. type: Plain text
2649 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2650 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2651 msgid ""
2652 "The following shell session shows an example of running this program. This "
2653 "session involved editing the file I</home/user/temp/notes>. Before the file "
2654 "was opened, a B<FAN_OPEN_PERM> event occurred. After the file was closed, a "
2655 "B<FAN_CLOSE_WRITE> event occurred. Execution of the program ends when the "
2656 "user presses the ENTER key."
2657 msgstr ""
2658 "La sortie suivante de session d’interpréteur de commande montre un exemple "
2659 "de l’exécution de ce programme. Cette session concerne l’édition du fichier "
2660 "I</home/utilisateur/temp/notes>. Avant d’ouvrir le fichier, un événement "
2661 "B<FAN_OPEN_PERM> est survenu. Après la fermeture du fichier, un événement "
2662 "B<FAN_CLOSE_WRITE> est survenu. L’exécution du programme se termine quand "
2663 "l’utilisateur appuie sur la touche Entrée."
2664
2665 #. type: Plain text
2666 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
2667 #: opensuse-tumbleweed
2668 #, fuzzy, no-wrap
2669 #| msgid ""
2670 #| "# B<./fanotify_example /home>\n"
2671 #| "Press enter key to terminate.\n"
2672 #| "Listening for events.\n"
2673 #| "FAN_OPEN_PERM: File /home/user/temp/notes\n"
2674 #| "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
2675 #| "\\&\n"
2676 #| "Listening for events stopped.\n"
2677 msgid ""
2678 "#B< ./fanotify_example /home>;\n"
2679 "Press enter key to terminate.\n"
2680 "Listening for events.\n"
2681 "FAN_OPEN_PERM: File /home/user/temp/notes\n"
2682 "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
2683 "\\&\n"
2684 "Listening for events stopped.\n"
2685 msgstr ""
2686 "# B<./fanotify_exemple /home>\n"
2687 "Appuyer sur la touche Entrée pour quitter.\n"
2688 "En écoute d’événements.\n"
2689 "FAN_OPEN_PERM : Fichier /home/utilisateur/temp/notes\n"
2690 "FAN_CLOSE_WRITE : Fichier /home/utilisateur/temp/notes\n"
2691 "Écoute des évènements arrêtée.\n"
2692
2693 #. type: SS
2694 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2695 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2696 #, no-wrap
2697 msgid "Program source: fanotify_example.c"
2698 msgstr "Source du programme : fanotify_example.c"
2699
2700 #. type: Plain text
2701 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
2702 #, fuzzy, no-wrap
2703 #| msgid ""
2704 #| "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
2705 #| "#include E<lt>errno.hE<gt>\n"
2706 #| "#include E<lt>fcntl.hE<gt>\n"
2707 #| "#include E<lt>limits.hE<gt>\n"
2708 #| "#include E<lt>poll.hE<gt>\n"
2709 #| "#include E<lt>stdio.hE<gt>\n"
2710 #| "#include E<lt>stdlib.hE<gt>\n"
2711 #| "#include E<lt>sys/fanotify.hE<gt>\n"
2712 #| "#include E<lt>unistd.hE<gt>\n"
2713 #| "\\&\n"
2714 #| "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
2715 #| "\\&\n"
2716 #| "static void\n"
2717 #| "handle_events(int fd)\n"
2718 #| "{\n"
2719 #| " const struct fanotify_event_metadata *metadata;\n"
2720 #| " struct fanotify_event_metadata buf[200];\n"
2721 #| " ssize_t len;\n"
2722 #| " char path[PATH_MAX];\n"
2723 #| " ssize_t path_len;\n"
2724 #| " char procfd_path[PATH_MAX];\n"
2725 #| " struct fanotify_response response;\n"
2726 #| "\\&\n"
2727 #| " /* Loop while events can be read from fanotify file descriptor. */\n"
2728 #| "\\&\n"
2729 #| " for (;;) {\n"
2730 #| "\\&\n"
2731 #| " /* Read some events. */\n"
2732 #| "\\&\n"
2733 #| " len = read(fd, buf, sizeof(buf));\n"
2734 #| " if (len == -1 && errno != EAGAIN) {\n"
2735 #| " perror(\"read\");\n"
2736 #| " exit(EXIT_FAILURE);\n"
2737 #| " }\n"
2738 #| "\\&\n"
2739 #| " /* Check if end of available data reached. */\n"
2740 #| "\\&\n"
2741 #| " if (len E<lt>= 0)\n"
2742 #| " break;\n"
2743 #| "\\&\n"
2744 #| " /* Point to the first event in the buffer. */\n"
2745 #| "\\&\n"
2746 #| " metadata = buf;\n"
2747 #| "\\&\n"
2748 #| " /* Loop over all events in the buffer. */\n"
2749 #| "\\&\n"
2750 #| " while (FAN_EVENT_OK(metadata, len)) {\n"
2751 #| "\\&\n"
2752 #| " /* Check that run-time and compile-time structures match. */\n"
2753 #| "\\&\n"
2754 #| " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
2755 #| " fprintf(stderr,\n"
2756 #| " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
2757 #| " exit(EXIT_FAILURE);\n"
2758 #| " }\n"
2759 #| "\\&\n"
2760 #| " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
2761 #| " queue overflow, or a file descriptor (a nonnegative\n"
2762 #| " integer). Here, we simply ignore queue overflow. */\n"
2763 #| "\\&\n"
2764 #| " if (metadata-E<gt>fd E<gt>= 0) {\n"
2765 #| "\\&\n"
2766 #| " /* Handle open permission event. */\n"
2767 #| "\\&\n"
2768 #| " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
2769 #| " printf(\"FAN_OPEN_PERM: \");\n"
2770 #| "\\&\n"
2771 #| " /* Allow file to be opened. */\n"
2772 #| "\\&\n"
2773 #| " response.fd = metadata-E<gt>fd;\n"
2774 #| " response.response = FAN_ALLOW;\n"
2775 #| " write(fd, &response, sizeof(response));\n"
2776 #| " }\n"
2777 #| "\\&\n"
2778 #| " /* Handle closing of writable file event. */\n"
2779 #| "\\&\n"
2780 #| " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
2781 #| " printf(\"FAN_CLOSE_WRITE: \");\n"
2782 #| "\\&\n"
2783 #| " /* Retrieve and print pathname of the accessed file. */\n"
2784 #| "\\&\n"
2785 #| " snprintf(procfd_path, sizeof(procfd_path),\n"
2786 #| " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
2787 #| " path_len = readlink(procfd_path, path,\n"
2788 #| " sizeof(path) - 1);\n"
2789 #| " if (path_len == -1) {\n"
2790 #| " perror(\"readlink\");\n"
2791 #| " exit(EXIT_FAILURE);\n"
2792 #| " }\n"
2793 #| "\\&\n"
2794 #| " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
2795 #| " printf(\"File %s\\[rs]n\", path);\n"
2796 #| "\\&\n"
2797 #| " /* Close the file descriptor of the event. */\n"
2798 #| "\\&\n"
2799 #| " close(metadata-E<gt>fd);\n"
2800 #| " }\n"
2801 #| "\\&\n"
2802 #| " /* Advance to next event. */\n"
2803 #| "\\&\n"
2804 #| " metadata = FAN_EVENT_NEXT(metadata, len);\n"
2805 #| " }\n"
2806 #| " }\n"
2807 #| "}\n"
2808 #| "\\&\n"
2809 #| "int\n"
2810 #| "main(int argc, char *argv[])\n"
2811 #| "{\n"
2812 #| " char buf;\n"
2813 #| " int fd, poll_num;\n"
2814 #| " nfds_t nfds;\n"
2815 #| " struct pollfd fds[2];\n"
2816 #| "\\&\n"
2817 #| " /* Check mount point is supplied. */\n"
2818 #| "\\&\n"
2819 #| " if (argc != 2) {\n"
2820 #| " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
2821 #| " exit(EXIT_FAILURE);\n"
2822 #| " }\n"
2823 #| "\\&\n"
2824 #| " printf(\"Press enter key to terminate.\\[rs]n\");\n"
2825 #| "\\&\n"
2826 #| " /* Create the file descriptor for accessing the fanotify API. */\n"
2827 #| "\\&\n"
2828 #| " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
2829 #| " O_RDONLY | O_LARGEFILE);\n"
2830 #| " if (fd == -1) {\n"
2831 #| " perror(\"fanotify_init\");\n"
2832 #| " exit(EXIT_FAILURE);\n"
2833 #| " }\n"
2834 #| "\\&\n"
2835 #| " /* Mark the mount for:\n"
2836 #| " - permission events before opening files\n"
2837 #| " - notification events after closing a write-enabled\n"
2838 #| " file descriptor. */\n"
2839 #| "\\&\n"
2840 #| " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
2841 #| " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
2842 #| " argv[1]) == -1) {\n"
2843 #| " perror(\"fanotify_mark\");\n"
2844 #| " exit(EXIT_FAILURE);\n"
2845 #| " }\n"
2846 #| "\\&\n"
2847 #| " /* Prepare for polling. */\n"
2848 #| "\\&\n"
2849 #| " nfds = 2;\n"
2850 #| "\\&\n"
2851 #| " fds[0].fd = STDIN_FILENO; /* Console input */\n"
2852 #| " fds[0].events = POLLIN;\n"
2853 #| "\\&\n"
2854 #| " fds[1].fd = fd; /* Fanotify input */\n"
2855 #| " fds[1].events = POLLIN;\n"
2856 #| "\\&\n"
2857 #| " /* This is the loop to wait for incoming events. */\n"
2858 #| "\\&\n"
2859 #| " printf(\"Listening for events.\\[rs]n\");\n"
2860 #| "\\&\n"
2861 #| " while (1) {\n"
2862 #| " poll_num = poll(fds, nfds, -1);\n"
2863 #| " if (poll_num == -1) {\n"
2864 #| " if (errno == EINTR) /* Interrupted by a signal */\n"
2865 #| " continue; /* Restart poll() */\n"
2866 #| "\\&\n"
2867 #| " perror(\"poll\"); /* Unexpected error */\n"
2868 #| " exit(EXIT_FAILURE);\n"
2869 #| " }\n"
2870 #| "\\&\n"
2871 #| " if (poll_num E<gt> 0) {\n"
2872 #| " if (fds[0].revents & POLLIN) {\n"
2873 #| "\\&\n"
2874 #| " /* Console input is available: empty stdin and quit. */\n"
2875 #| "\\&\n"
2876 #| " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
2877 #| " continue;\n"
2878 #| " break;\n"
2879 #| " }\n"
2880 #| "\\&\n"
2881 #| " if (fds[1].revents & POLLIN) {\n"
2882 #| "\\&\n"
2883 #| " /* Fanotify events are available. */\n"
2884 #| "\\&\n"
2885 #| " handle_events(fd);\n"
2886 #| " }\n"
2887 #| " }\n"
2888 #| " }\n"
2889 #| "\\&\n"
2890 #| " printf(\"Listening for events stopped.\\[rs]n\");\n"
2891 #| " exit(EXIT_SUCCESS);\n"
2892 #| "}\n"
2893 msgid ""
2894 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
2895 "#include E<lt>errno.hE<gt>\n"
2896 "#include E<lt>fcntl.hE<gt>\n"
2897 "#include E<lt>limits.hE<gt>\n"
2898 "#include E<lt>poll.hE<gt>\n"
2899 "#include E<lt>stdio.hE<gt>\n"
2900 "#include E<lt>stdlib.hE<gt>\n"
2901 "#include E<lt>sys/fanotify.hE<gt>\n"
2902 "#include E<lt>unistd.hE<gt>\n"
2903 "\\&\n"
2904 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
2905 "\\&\n"
2906 "static void\n"
2907 "handle_events(int fd)\n"
2908 "{\n"
2909 " const struct fanotify_event_metadata *metadata;\n"
2910 " struct fanotify_event_metadata buf[200];\n"
2911 " ssize_t size;\n"
2912 " char path[PATH_MAX];\n"
2913 " ssize_t path_len;\n"
2914 " char procfd_path[PATH_MAX];\n"
2915 " struct fanotify_response response;\n"
2916 "\\&\n"
2917 " /* Loop while events can be read from fanotify file descriptor. */\n"
2918 "\\&\n"
2919 " for (;;) {\n"
2920 "\\&\n"
2921 " /* Read some events. */\n"
2922 "\\&\n"
2923 " size = read(fd, buf, sizeof(buf));\n"
2924 " if (size == -1 && errno != EAGAIN) {\n"
2925 " perror(\"read\");\n"
2926 " exit(EXIT_FAILURE);\n"
2927 " }\n"
2928 "\\&\n"
2929 " /* Check if end of available data reached. */\n"
2930 "\\&\n"
2931 " if (size E<lt>= 0)\n"
2932 " break;\n"
2933 "\\&\n"
2934 " /* Point to the first event in the buffer. */\n"
2935 "\\&\n"
2936 " metadata = buf;\n"
2937 "\\&\n"
2938 " /* Loop over all events in the buffer. */\n"
2939 "\\&\n"
2940 " while (FAN_EVENT_OK(metadata, size)) {\n"
2941 "\\&\n"
2942 " /* Check that run-time and compile-time structures match. */\n"
2943 "\\&\n"
2944 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
2945 " fprintf(stderr,\n"
2946 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
2947 " exit(EXIT_FAILURE);\n"
2948 " }\n"
2949 "\\&\n"
2950 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
2951 " queue overflow, or a file descriptor (a nonnegative\n"
2952 " integer). Here, we simply ignore queue overflow. */\n"
2953 "\\&\n"
2954 " if (metadata-E<gt>fd E<gt>= 0) {\n"
2955 "\\&\n"
2956 " /* Handle open permission event. */\n"
2957 "\\&\n"
2958 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
2959 " printf(\"FAN_OPEN_PERM: \");\n"
2960 "\\&\n"
2961 " /* Allow file to be opened. */\n"
2962 "\\&\n"
2963 " response.fd = metadata-E<gt>fd;\n"
2964 " response.response = FAN_ALLOW;\n"
2965 " write(fd, &response, sizeof(response));\n"
2966 " }\n"
2967 "\\&\n"
2968 " /* Handle closing of writable file event. */\n"
2969 "\\&\n"
2970 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
2971 " printf(\"FAN_CLOSE_WRITE: \");\n"
2972 "\\&\n"
2973 " /* Retrieve and print pathname of the accessed file. */\n"
2974 "\\&\n"
2975 " snprintf(procfd_path, sizeof(procfd_path),\n"
2976 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
2977 " path_len = readlink(procfd_path, path,\n"
2978 " sizeof(path) - 1);\n"
2979 " if (path_len == -1) {\n"
2980 " perror(\"readlink\");\n"
2981 " exit(EXIT_FAILURE);\n"
2982 " }\n"
2983 "\\&\n"
2984 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
2985 " printf(\"File %s\\[rs]n\", path);\n"
2986 "\\&\n"
2987 " /* Close the file descriptor of the event. */\n"
2988 "\\&\n"
2989 " close(metadata-E<gt>fd);\n"
2990 " }\n"
2991 "\\&\n"
2992 " /* Advance to next event. */\n"
2993 "\\&\n"
2994 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
2995 " }\n"
2996 " }\n"
2997 "}\n"
2998 "\\&\n"
2999 "int\n"
3000 "main(int argc, char *argv[])\n"
3001 "{\n"
3002 " char buf;\n"
3003 " int fd, poll_num;\n"
3004 " nfds_t nfds;\n"
3005 " struct pollfd fds[2];\n"
3006 "\\&\n"
3007 " /* Check mount point is supplied. */\n"
3008 "\\&\n"
3009 " if (argc != 2) {\n"
3010 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
3011 " exit(EXIT_FAILURE);\n"
3012 " }\n"
3013 "\\&\n"
3014 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
3015 "\\&\n"
3016 " /* Create the file descriptor for accessing the fanotify API. */\n"
3017 "\\&\n"
3018 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
3019 " O_RDONLY | O_LARGEFILE);\n"
3020 " if (fd == -1) {\n"
3021 " perror(\"fanotify_init\");\n"
3022 " exit(EXIT_FAILURE);\n"
3023 " }\n"
3024 "\\&\n"
3025 " /* Mark the mount for:\n"
3026 " - permission events before opening files\n"
3027 " - notification events after closing a write-enabled\n"
3028 " file descriptor. */\n"
3029 "\\&\n"
3030 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
3031 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
3032 " argv[1]) == -1) {\n"
3033 " perror(\"fanotify_mark\");\n"
3034 " exit(EXIT_FAILURE);\n"
3035 " }\n"
3036 "\\&\n"
3037 " /* Prepare for polling. */\n"
3038 "\\&\n"
3039 " nfds = 2;\n"
3040 "\\&\n"
3041 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
3042 " fds[0].events = POLLIN;\n"
3043 "\\&\n"
3044 " fds[1].fd = fd; /* Fanotify input */\n"
3045 " fds[1].events = POLLIN;\n"
3046 "\\&\n"
3047 " /* This is the loop to wait for incoming events. */\n"
3048 "\\&\n"
3049 " printf(\"Listening for events.\\[rs]n\");\n"
3050 "\\&\n"
3051 " for (;;) {\n"
3052 " poll_num = poll(fds, nfds, -1);\n"
3053 " if (poll_num == -1) {\n"
3054 " if (errno == EINTR) /* Interrupted by a signal */\n"
3055 " continue; /* Restart poll() */\n"
3056 "\\&\n"
3057 " perror(\"poll\"); /* Unexpected error */\n"
3058 " exit(EXIT_FAILURE);\n"
3059 " }\n"
3060 "\\&\n"
3061 " if (poll_num E<gt> 0) {\n"
3062 " if (fds[0].revents & POLLIN) {\n"
3063 "\\&\n"
3064 " /* Console input is available: empty stdin and quit. */\n"
3065 "\\&\n"
3066 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
3067 " continue;\n"
3068 " break;\n"
3069 " }\n"
3070 "\\&\n"
3071 " if (fds[1].revents & POLLIN) {\n"
3072 "\\&\n"
3073 " /* Fanotify events are available. */\n"
3074 "\\&\n"
3075 " handle_events(fd);\n"
3076 " }\n"
3077 " }\n"
3078 " }\n"
3079 "\\&\n"
3080 " printf(\"Listening for events stopped.\\[rs]n\");\n"
3081 " exit(EXIT_SUCCESS);\n"
3082 "}\n"
3083 msgstr ""
3084 "#define _GNU_SOURCE /* Nécessaire pour obtenir la définition de O_LARGEFILE */\n"
3085 "#include E<lt>errno.hE<gt>\n"
3086 "#include E<lt>fcntl.hE<gt>\n"
3087 "#include E<lt>limits.hE<gt>\n"
3088 "#include E<lt>poll.hE<gt>\n"
3089 "#include E<lt>stdio.hE<gt>\n"
3090 "#include E<lt>stdlib.hE<gt>\n"
3091 "#include E<lt>sys/fanotify.hE<gt>\n"
3092 "#include E<lt>unistd.hE<gt>\n"
3093 "\\&\n"
3094 "/* Lire tous les évènements fanotify disponibles du descripteur de fichier « fd ». */\n"
3095 "\\&\n"
3096 "static void\n"
3097 "handle_events(int fd)\n"
3098 "{\n"
3099 " const struct fanotify_event_metadata *metadata;\n"
3100 " struct fanotify_event_metadata buf[200];\n"
3101 " ssize_t len;\n"
3102 " char path[PATH_MAX];\n"
3103 " ssize_t path_len;\n"
3104 " char procfd_path[PATH_MAX];\n"
3105 " struct fanotify_response response;\n"
3106 "\\&\n"
3107 " /* Bouclage tant que des évènements peuvent être lus du descripteur de fichier. */\n"
3108 "\\&\n"
3109 " for (;;) {\n"
3110 "\\&\n"
3111 " /* Lecture de quelques évènements. */\n"
3112 "\\&\n"
3113 " len = read(fd, buf, sizeof(buf));\n"
3114 " if (len == -1 && errno != EAGAIN) {\n"
3115 " perror(\"read\");\n"
3116 " exit(EXIT_FAILURE);\n"
3117 " }\n"
3118 "\\&\n"
3119 " /* Vérification que la fin des données disponibles soit atteinte. */\n"
3120 "\\&\n"
3121 " if (len E<lt>= 0)\n"
3122 " break;\n"
3123 "\\&\n"
3124 " /* Pointage vers le premier évènement dans le tampon. */\n"
3125 "\\&\n"
3126 " metadata = buf;\n"
3127 "\\&\n"
3128 " /* Bouclage sur tous les évènements du tampon. */\n"
3129 "\\&\n"
3130 " while (FAN_EVENT_OK(metadata, len)) {\n"
3131 "\\&\n"
3132 " /* Vérification que les structures d’exécution et de compilation correspondent. */\n"
3133 "\\&\n"
3134 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
3135 " fprintf(stderr,\n"
3136 " \"Mauvaise correspondance des versions de métadonnées de fanotify.\\[rs]en\");\n"
3137 " exit(EXIT_FAILURE);\n"
3138 " }\n"
3139 "\\&\n"
3140 " /* metadata-E<gt>fd contient soit FAN_NOFD, indiquant un\n"
3141 " débordement de file ou un descripteur de fichier (un entier\n"
3142 " non négatif). Ici, le débordement est simplement ignoré. */\n"
3143 "\\&\n"
3144 " if (metadata-E<gt>fd E<gt>= 0) {\n"
3145 "\\&\n"
3146 " /* Gestion de la permission d’ouvrir. */\n"
3147 "\\&\n"
3148 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
3149 " printf(\"FAN_OPEN_PERM: \");\n"
3150 "\\&\n"
3151 " /* Autorisation d’ouvrir le fichier. */\n"
3152 "\\&\n"
3153 " response.fd = metadata-E<gt>fd;\n"
3154 " response.response = FAN_ALLOW;\n"
3155 " write(fd, &response, sizeof(response));\n"
3156 " }\n"
3157 "\\&\n"
3158 " /* Gestion de la fermeture d’évènement de fichier éditable. */\n"
3159 "\\&\n"
3160 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
3161 " printf(\"FAN_CLOSE_WRITE: \");\n"
3162 "\\&\n"
3163 " /* Récupération et affichage du chemin du fichier accédé. */\n"
3164 "\\&\n"
3165 " snprintf(procfd_path, sizeof(procfd_path),\n"
3166 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
3167 " path_len = readlink(procfd_path, path,\n"
3168 " sizeof(path) - 1);\n"
3169 " if (path_len == -1) {\n"
3170 " perror(\"readlink\");\n"
3171 " exit(EXIT_FAILURE);\n"
3172 " }\n"
3173 "\\&\n"
3174 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
3175 " printf(\"File %s\\[rs]n\", path);\n"
3176 "\\&\n"
3177 " /* Fermeture du descripteur de fichier de l’évènement. */\n"
3178 "\\&\n"
3179 " close(metadata-E<gt>fd);\n"
3180 " }\n"
3181 "\\&\n"
3182 " /* Avance jusqu’au prochain évènement. */\n"
3183 "\\&\n"
3184 " metadata = FAN_EVENT_NEXT(metadata, len);\n"
3185 " }\n"
3186 " }\n"
3187 "}\n"
3188 "\\&\n"
3189 "int\n"
3190 "main(int argc, char *argv[])\n"
3191 "{\n"
3192 " char buf;\n"
3193 " int fd, poll_num;\n"
3194 " nfds_t nfds;\n"
3195 " struct pollfd fds[2];\n"
3196 "\\&\n"
3197 " /* Vérification que le point de montage soit fourni. */\n"
3198 "\\&\n"
3199 " if (argc != 2) {\n"
3200 " fprintf(stderr, \"Utilisation : %s MOUNT\\[rs]n\", argv[0]);\n"
3201 " exit(EXIT_FAILURE);\n"
3202 " }\n"
3203 "\\&\n"
3204 " printf(\"Presser la touche Entrée pour terminer.\\[rs]n\");\n"
3205 "\\&\n"
3206 " /* Création d’un descripteur de fichier pour accéder à l’API de fanotify. */\n"
3207 "\\&\n"
3208 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
3209 " O_RDONLY | O_LARGEFILE);\n"
3210 " if (fd == -1) {\n"
3211 " perror(\"fanotify_init\");\n"
3212 " exit(EXIT_FAILURE);\n"
3213 " }\n"
3214 "\\&\n"
3215 " /* Marque du montage pour :\n"
3216 " – évènements de permission avant ouvertures de fichier\n"
3217 " – évènements de notification après la fermeture\n"
3218 " d’un descripteur de fichier éditable. */\n"
3219 "\\&\n"
3220 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
3221 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
3222 " argv[1]) == -1) {\n"
3223 " perror(\"fanotify_mark\");\n"
3224 " exit(EXIT_FAILURE);\n"
3225 " }\n"
3226 "\\&\n"
3227 " /* Préparation pour sondage. */\n"
3228 "\\&\n"
3229 " nfds = 2;\n"
3230 "\\&\n"
3231 " fds[0].fd = STDIN_FILENO; /* Entrée de console */\n"
3232 " fds[0].events = POLLIN;\n"
3233 "\\&\n"
3234 " fds[1].fd = fd; /* Entrée de fanotify */\n"
3235 " fds[1].events = POLLIN;\n"
3236 "\\&\n"
3237 " /* Ceci est une boucle pour attendre de futurs évènements. */\n"
3238 "\\&\n"
3239 " printf(\"Écoute d’évènements.\\[rs]n\");\n"
3240 "\\&\n"
3241 " while (1) {\n"
3242 " poll_num = poll(fds, nfds, -1);\n"
3243 " if (poll_num == -1) {\n"
3244 " if (errno == EINTR) /* Interruption par un signal */\n"
3245 " continue; /* Redémarrage de poll() */\n"
3246 "\\&\n"
3247 " perror(\"poll\"); /* Erreur inattendue */\n"
3248 " exit(EXIT_FAILURE);\n"
3249 " }\n"
3250 "\\&\n"
3251 " if (poll_num E<gt> 0) {\n"
3252 " if (fds[0].revents & POLLIN) {\n"
3253 "\\&\n"
3254 " /* Entrée de console disponible : stdin vide et quitter. */\n"
3255 "\\&\n"
3256 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
3257 " continue;\n"
3258 " break;\n"
3259 " }\n"
3260 "\\&\n"
3261 " if (fds[1].revents & POLLIN) {\n"
3262 "\\&\n"
3263 " /* Évènements de fanotify disponibles. */\n"
3264 "\\&\n"
3265 " handle_events(fd);\n"
3266 " }\n"
3267 " }\n"
3268 " }\n"
3269 "\\&\n"
3270 " printf(\"Écoute d’évènements arrêtée.\\[rs]n\");\n"
3271 " exit(EXIT_SUCCESS);\n"
3272 "}\n"
3273
3274 #. type: SS
3275 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3276 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3277 #, no-wrap
3278 msgid "Example program: fanotify_fid.c"
3279 msgstr "Exemple de programme : fanotify_fid.c"
3280
3281 #. type: Plain text
3282 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3283 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3284 msgid ""
3285 "The second program is an example of fanotify being used with a group that "
3286 "identifies objects by file handles. The program marks the filesystem object "
3287 "that is passed as a command-line argument and waits until an event of type "
3288 "B<FAN_CREATE> has occurred. The event mask indicates which type of "
3289 "filesystem object\\[em]either a file or a directory\\[em]was created. Once "
3290 "all events have been read from the buffer and processed accordingly, the "
3291 "program simply terminates."
3292 msgstr ""
3293 "Le second programme est un exemple d’utilisation de fanotify avec un groupe "
3294 "qui identifie des objets avec des gestionnaires de fichier. Le programme "
3295 "marque l’objet de système de fichiers qui est passé comme argument de ligne "
3296 "de commande et attend jusqu’à ce qu’un évènement de type B<FAN_CREATE> se "
3297 "produise. Le masque d’évènement indique quel type d’objet de système de "
3298 "fichiers, soit un fichier ou un répertoire, est créé. Une fois que tous les "
3299 "évènements du tampon ont été lus et traités de la manière appropriée, le "
3300 "programme se termine."
3301
3302 #. type: Plain text
3303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3305 msgid ""
3306 "The following shell sessions show two different invocations of this program, "
3307 "with different actions performed on a watched object."
3308 msgstr ""
3309 "Les sessions d’interpréteur de commande suivantes montrent deux invocations "
3310 "différentes avec des actions différentes réalisées sur l’objet désiré."
3311
3312 #. type: Plain text
3313 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3314 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3315 msgid ""
3316 "The first session shows a mark being placed on I</home/user>. This is "
3317 "followed by the creation of a regular file, I</home/user/testfile.txt>. "
3318 "This results in a B<FAN_CREATE> event being generated and reported against "
3319 "the file's parent watched directory object and with the created file name. "
3320 "Program execution ends once all events captured within the buffer have been "
3321 "processed."
3322 msgstr ""
3323 "La première session montre une marque placée sur I</home/utilisateur>. Cela "
3324 "est suivi par la création d’un fichier normal, I</home/utilisateur/"
3325 "fichiertest.txt>. Cela aboutit à un évènement B<FAN_CREATE> généré et "
3326 "rapporté à l’objet de répertoire surveillé parent du fichier et à la "
3327 "création du nom de fichier. L’exécution du programme se termine une fois que "
3328 "tous les évènements capturés du tampon ont été traités."
3329
3330 #. type: Plain text
3331 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
3332 #: opensuse-tumbleweed
3333 #, fuzzy, no-wrap
3334 #| msgid ""
3335 #| "# B<./fanotify_fid /home/user>\n"
3336 #| "Listening for events.\n"
3337 #| "FAN_CREATE (file created):\n"
3338 #| " Directory /home/user has been modified.\n"
3339 #| " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n"
3340 #| "All events processed successfully. Program exiting.\n"
3341 #| "\\&\n"
3342 #| "$ B<touch /home/user/testfile.txt> # In another terminal\n"
3343 msgid ""
3344 "#B< ./fanotify_fid /home/user>;\n"
3345 "Listening for events.\n"
3346 "FAN_CREATE (file created):\n"
3347 " Directory /home/user has been modified.\n"
3348 " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n"
3349 "All events processed successfully. Program exiting.\n"
3350 "\\&\n"
3351 "$B< touch /home/user/testfile.txt>; # In another terminal\n"
3352 msgstr ""
3353 "# B<./fanotify_fid /home/user>\n"
3354 "Écoute de tous les évènements.\n"
3355 "FAN_CREATE (fichier créé) :\n"
3356 " Répertoire /home/utilisateur a été modifié.\n"
3357 " Entrée « fichiertest.txt » n’est pas un sous-répertoire.\n"
3358 "Tous les évènements ont été traités avec succès. Fin du programme.\n"
3359 "\\&\n"
3360 "$ B<touch /home/user/fichiertest.txt> # Dans un autre terminal\n"
3361
3362 #. type: Plain text
3363 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3364 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3365 msgid ""
3366 "The second session shows a mark being placed on I</home/user>. This is "
3367 "followed by the creation of a directory, I</home/user/testdir>. This "
3368 "specific action results in a B<FAN_CREATE> event being generated and is "
3369 "reported with the B<FAN_ONDIR> flag set and with the created directory name."
3370 msgstr ""
3371 "La première session montre une marque placée sur I</home/utilisateur>. C’est "
3372 "suivi par la création d’un répertoire, I</home/utilisateur/réptest>. Cette "
3373 "action spécifique aboutit à la génération d’un évènement B<FAN_CREATE> et "
3374 "est rapporté avec l’attribut B<FAN_ONDIR> défini et avec la création du nom "
3375 "de répertoire."
3376
3377 #. type: Plain text
3378 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
3379 #: opensuse-tumbleweed
3380 #, fuzzy, no-wrap
3381 #| msgid ""
3382 #| "# B<./fanotify_fid /home/user>\n"
3383 #| "Listening for events.\n"
3384 #| "FAN_CREATE | FAN_ONDIR (subdirectory created):\n"
3385 #| " Directory /home/user has been modified.\n"
3386 #| " Entry \\[aq]testdir\\[aq] is a subdirectory.\n"
3387 #| "All events processed successfully. Program exiting.\n"
3388 #| "\\&\n"
3389 #| "$ B<mkdir -p /home/user/testdir> # In another terminal\n"
3390 msgid ""
3391 "#B< ./fanotify_fid /home/user>;\n"
3392 "Listening for events.\n"
3393 "FAN_CREATE | FAN_ONDIR (subdirectory created):\n"
3394 " Directory /home/user has been modified.\n"
3395 " Entry \\[aq]testdir\\[aq] is a subdirectory.\n"
3396 "All events processed successfully. Program exiting.\n"
3397 "\\&\n"
3398 "$B< mkdir -p /home/user/testdir>; # In another terminal\n"
3399 msgstr ""
3400 "# B<./fanotify_fid /home/user>\n"
3401 "Écoute de tous les évènements.\n"
3402 "FAN_CREATE | FAN_ONDIR (sous_répertoire créé) :\n"
3403 " Répertoire /home/utilisateur a été modifié.\n"
3404 " Entrée « réptest » est un sous-répertoire.\n"
3405 "Tous les évènements ont été traités avec succès. Fin du programme.\n"
3406 "\\&\n"
3407 "$ B<mkdir -p /home/user/réptest> # Dans un autre terminal\n"
3408
3409 #. type: SS
3410 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3411 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3412 #, no-wrap
3413 msgid "Program source: fanotify_fid.c"
3414 msgstr "Source du programme : fanotify_fid.c"
3415
3416 #. type: Plain text
3417 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
3418 #: opensuse-tumbleweed
3419 #, fuzzy, no-wrap
3420 #| msgid ""
3421 #| "#define _GNU_SOURCE\n"
3422 #| "#include E<lt>errno.hE<gt>\n"
3423 #| "#include E<lt>fcntl.hE<gt>\n"
3424 #| "#include E<lt>limits.hE<gt>\n"
3425 #| "#include E<lt>stdio.hE<gt>\n"
3426 #| "#include E<lt>stdlib.hE<gt>\n"
3427 #| "#include E<lt>sys/types.hE<gt>\n"
3428 #| "#include E<lt>sys/stat.hE<gt>\n"
3429 #| "#include E<lt>sys/fanotify.hE<gt>\n"
3430 #| "#include E<lt>unistd.hE<gt>\n"
3431 #| "\\&\n"
3432 #| "#define BUF_SIZE 256\n"
3433 #| "\\&\n"
3434 #| "int\n"
3435 #| "main(int argc, char *argv[])\n"
3436 #| "{\n"
3437 #| " int fd, ret, event_fd, mount_fd;\n"
3438 #| " ssize_t len, path_len;\n"
3439 #| " char path[PATH_MAX];\n"
3440 #| " char procfd_path[PATH_MAX];\n"
3441 #| " char events_buf[BUF_SIZE];\n"
3442 #| " struct file_handle *file_handle;\n"
3443 #| " struct fanotify_event_metadata *metadata;\n"
3444 #| " struct fanotify_event_info_fid *fid;\n"
3445 #| " const char *file_name;\n"
3446 #| " struct stat sb;\n"
3447 #| "\\&\n"
3448 #| " if (argc != 2) {\n"
3449 #| " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
3450 #| " exit(EXIT_FAILURE);\n"
3451 #| " }\n"
3452 #| "\\&\n"
3453 #| " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
3454 #| " if (mount_fd == -1) {\n"
3455 #| " perror(argv[1]);\n"
3456 #| " exit(EXIT_FAILURE);\n"
3457 #| " }\n"
3458 #| "\\&\n"
3459 #| " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
3460 #| " a flag so that program can receive fid events with directory\n"
3461 #| " entry name. */\n"
3462 #| "\\&\n"
3463 #| " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
3464 #| " if (fd == -1) {\n"
3465 #| " perror(\"fanotify_init\");\n"
3466 #| " exit(EXIT_FAILURE);\n"
3467 #| " }\n"
3468 #| "\\&\n"
3469 #| " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
3470 #| "\\&\n"
3471 #| " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
3472 #| " FAN_CREATE | FAN_ONDIR,\n"
3473 #| " AT_FDCWD, argv[1]);\n"
3474 #| " if (ret == -1) {\n"
3475 #| " perror(\"fanotify_mark\");\n"
3476 #| " exit(EXIT_FAILURE);\n"
3477 #| " }\n"
3478 #| "\\&\n"
3479 #| " printf(\"Listening for events.\\[rs]n\");\n"
3480 #| "\\&\n"
3481 #| " /* Read events from the event queue into a buffer. */\n"
3482 #| "\\&\n"
3483 #| " len = read(fd, events_buf, sizeof(events_buf));\n"
3484 #| " if (len == -1 && errno != EAGAIN) {\n"
3485 #| " perror(\"read\");\n"
3486 #| " exit(EXIT_FAILURE);\n"
3487 #| " }\n"
3488 #| "\\&\n"
3489 #| " /* Process all events within the buffer. */\n"
3490 #| "\\&\n"
3491 #| " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
3492 #| " FAN_EVENT_OK(metadata, len);\n"
3493 #| " metadata = FAN_EVENT_NEXT(metadata, len)) {\n"
3494 #| " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
3495 #| " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
3496 #| "\\&\n"
3497 #| " /* Ensure that the event info is of the correct type. */\n"
3498 #| "\\&\n"
3499 #| " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
3500 #| " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
3501 #| " file_name = NULL;\n"
3502 #| " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
3503 #| " file_name = file_handle-E<gt>f_handle +\n"
3504 #| " file_handle-E<gt>handle_bytes;\n"
3505 #| " } else {\n"
3506 #| " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
3507 #| " exit(EXIT_FAILURE);\n"
3508 #| " }\n"
3509 #| "\\&\n"
3510 #| " if (metadata-E<gt>mask == FAN_CREATE)\n"
3511 #| " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
3512 #| "\\&\n"
3513 #| " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
3514 #| " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
3515 #| "\\&\n"
3516 #| "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
3517 #| "\t objects by file handles. To obtain a file descriptor for\n"
3518 #| "\t the file object corresponding to an event you can use the\n"
3519 #| "\t struct file_handle that\\[aq]s provided within the\n"
3520 #| "\t fanotify_event_info_fid in conjunction with the\n"
3521 #| "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
3522 #| "\t done to accommodate for the situation where the file handle\n"
3523 #| "\t for the object was deleted prior to this system call. */\n"
3524 #| "\\&\n"
3525 #| " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
3526 #| " if (event_fd == -1) {\n"
3527 #| " if (errno == ESTALE) {\n"
3528 #| " printf(\"File handle is no longer valid. \"\n"
3529 #| " \"File has been deleted\\[rs]n\");\n"
3530 #| " continue;\n"
3531 #| " } else {\n"
3532 #| " perror(\"open_by_handle_at\");\n"
3533 #| " exit(EXIT_FAILURE);\n"
3534 #| " }\n"
3535 #| " }\n"
3536 #| "\\&\n"
3537 #| " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
3538 #| " event_fd);\n"
3539 #| "\\&\n"
3540 #| " /* Retrieve and print the path of the modified dentry. */\n"
3541 #| "\\&\n"
3542 #| " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
3543 #| " if (path_len == -1) {\n"
3544 #| " perror(\"readlink\");\n"
3545 #| " exit(EXIT_FAILURE);\n"
3546 #| " }\n"
3547 #| "\\&\n"
3548 #| " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
3549 #| " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
3550 #| "\\&\n"
3551 #| " if (file_name) {\n"
3552 #| " ret = fstatat(event_fd, file_name, &sb, 0);\n"
3553 #| " if (ret == -1) {\n"
3554 #| " if (errno != ENOENT) {\n"
3555 #| " perror(\"fstatat\");\n"
3556 #| " exit(EXIT_FAILURE);\n"
3557 #| " }\n"
3558 #| " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
3559 #| " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
3560 #| " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
3561 #| " } else {\n"
3562 #| " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
3563 #| " file_name);\n"
3564 #| " }\n"
3565 #| " }\n"
3566 #| "\\&\n"
3567 #| " /* Close associated file descriptor for this event. */\n"
3568 #| "\\&\n"
3569 #| " close(event_fd);\n"
3570 #| " }\n"
3571 #| "\\&\n"
3572 #| " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
3573 #| " exit(EXIT_SUCCESS);\n"
3574 #| "}\n"
3575 msgid ""
3576 "#define _GNU_SOURCE\n"
3577 "#include E<lt>errno.hE<gt>\n"
3578 "#include E<lt>fcntl.hE<gt>\n"
3579 "#include E<lt>limits.hE<gt>\n"
3580 "#include E<lt>stdio.hE<gt>\n"
3581 "#include E<lt>stdlib.hE<gt>\n"
3582 "#include E<lt>sys/types.hE<gt>\n"
3583 "#include E<lt>sys/stat.hE<gt>\n"
3584 "#include E<lt>sys/fanotify.hE<gt>\n"
3585 "#include E<lt>unistd.hE<gt>\n"
3586 "\\&\n"
3587 "#define BUF_SIZE 256\n"
3588 "\\&\n"
3589 "int\n"
3590 "main(int argc, char *argv[])\n"
3591 "{\n"
3592 " int fd, ret, event_fd, mount_fd;\n"
3593 " ssize_t size, path_len;\n"
3594 " char path[PATH_MAX];\n"
3595 " char procfd_path[PATH_MAX];\n"
3596 " char events_buf[BUF_SIZE];\n"
3597 " struct file_handle *file_handle;\n"
3598 " struct fanotify_event_metadata *metadata;\n"
3599 " struct fanotify_event_info_fid *fid;\n"
3600 " const char *file_name;\n"
3601 " struct stat sb;\n"
3602 "\\&\n"
3603 " if (argc != 2) {\n"
3604 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
3605 " exit(EXIT_FAILURE);\n"
3606 " }\n"
3607 "\\&\n"
3608 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
3609 " if (mount_fd == -1) {\n"
3610 " perror(argv[1]);\n"
3611 " exit(EXIT_FAILURE);\n"
3612 " }\n"
3613 "\\&\n"
3614 " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
3615 " a flag so that program can receive fid events with directory\n"
3616 " entry name. */\n"
3617 "\\&\n"
3618 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
3619 " if (fd == -1) {\n"
3620 " perror(\"fanotify_init\");\n"
3621 " exit(EXIT_FAILURE);\n"
3622 " }\n"
3623 "\\&\n"
3624 " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
3625 "\\&\n"
3626 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
3627 " FAN_CREATE | FAN_ONDIR,\n"
3628 " AT_FDCWD, argv[1]);\n"
3629 " if (ret == -1) {\n"
3630 " perror(\"fanotify_mark\");\n"
3631 " exit(EXIT_FAILURE);\n"
3632 " }\n"
3633 "\\&\n"
3634 " printf(\"Listening for events.\\[rs]n\");\n"
3635 "\\&\n"
3636 " /* Read events from the event queue into a buffer. */\n"
3637 "\\&\n"
3638 " size = read(fd, events_buf, sizeof(events_buf));\n"
3639 " if (size == -1 && errno != EAGAIN) {\n"
3640 " perror(\"read\");\n"
3641 " exit(EXIT_FAILURE);\n"
3642 " }\n"
3643 "\\&\n"
3644 " /* Process all events within the buffer. */\n"
3645 "\\&\n"
3646 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
3647 " FAN_EVENT_OK(metadata, size);\n"
3648 " metadata = FAN_EVENT_NEXT(metadata, size)) {\n"
3649 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
3650 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
3651 "\\&\n"
3652 " /* Ensure that the event info is of the correct type. */\n"
3653 "\\&\n"
3654 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
3655 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
3656 " file_name = NULL;\n"
3657 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
3658 " file_name = file_handle-E<gt>f_handle +\n"
3659 " file_handle-E<gt>handle_bytes;\n"
3660 " } else {\n"
3661 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
3662 " exit(EXIT_FAILURE);\n"
3663 " }\n"
3664 "\\&\n"
3665 " if (metadata-E<gt>mask == FAN_CREATE)\n"
3666 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
3667 "\\&\n"
3668 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
3669 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
3670 "\\&\n"
3671 "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
3672 "\t objects by file handles. To obtain a file descriptor for\n"
3673 "\t the file object corresponding to an event you can use the\n"
3674 "\t struct file_handle that\\[aq]s provided within the\n"
3675 "\t fanotify_event_info_fid in conjunction with the\n"
3676 "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
3677 "\t done to accommodate for the situation where the file handle\n"
3678 "\t for the object was deleted prior to this system call. */\n"
3679 "\\&\n"
3680 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
3681 " if (event_fd == -1) {\n"
3682 " if (errno == ESTALE) {\n"
3683 " printf(\"File handle is no longer valid. \"\n"
3684 " \"File has been deleted\\[rs]n\");\n"
3685 " continue;\n"
3686 " } else {\n"
3687 " perror(\"open_by_handle_at\");\n"
3688 " exit(EXIT_FAILURE);\n"
3689 " }\n"
3690 " }\n"
3691 "\\&\n"
3692 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
3693 " event_fd);\n"
3694 "\\&\n"
3695 " /* Retrieve and print the path of the modified dentry. */\n"
3696 "\\&\n"
3697 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
3698 " if (path_len == -1) {\n"
3699 " perror(\"readlink\");\n"
3700 " exit(EXIT_FAILURE);\n"
3701 " }\n"
3702 "\\&\n"
3703 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
3704 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
3705 "\\&\n"
3706 " if (file_name) {\n"
3707 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
3708 " if (ret == -1) {\n"
3709 " if (errno != ENOENT) {\n"
3710 " perror(\"fstatat\");\n"
3711 " exit(EXIT_FAILURE);\n"
3712 " }\n"
3713 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
3714 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
3715 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
3716 " } else {\n"
3717 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
3718 " file_name);\n"
3719 " }\n"
3720 " }\n"
3721 "\\&\n"
3722 " /* Close associated file descriptor for this event. */\n"
3723 "\\&\n"
3724 " close(event_fd);\n"
3725 " }\n"
3726 "\\&\n"
3727 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
3728 " exit(EXIT_SUCCESS);\n"
3729 "}\n"
3730 msgstr ""
3731 "#define _GNU_SOURCE\n"
3732 "#include E<lt>errno.hE<gt>\n"
3733 "#include E<lt>fcntl.hE<gt>\n"
3734 "#include E<lt>limits.hE<gt>\n"
3735 "#include E<lt>stdio.hE<gt>\n"
3736 "#include E<lt>stdlib.hE<gt>\n"
3737 "#include E<lt>sys/types.hE<gt>\n"
3738 "#include E<lt>sys/stat.hE<gt>\n"
3739 "#include E<lt>sys/fanotify.hE<gt>\n"
3740 "#include E<lt>unistd.hE<gt>\n"
3741 "\\&\n"
3742 "#define BUF_SIZE 256\n"
3743 "\\&\n"
3744 "int\n"
3745 "main(int argc, char *argv[])\n"
3746 "{\n"
3747 " int fd, ret, event_fd, mount_fd;\n"
3748 " ssize_t len, path_len;\n"
3749 " char path[PATH_MAX];\n"
3750 " char procfd_path[PATH_MAX];\n"
3751 " char events_buf[BUF_SIZE];\n"
3752 " struct file_handle *file_handle;\n"
3753 " struct fanotify_event_metadata *metadata;\n"
3754 " struct fanotify_event_info_fid *fid;\n"
3755 " const char *file_name;\n"
3756 " struct stat sb;\n"
3757 "\\&\n"
3758 " if (argc != 2) {\n"
3759 " fprintf(stderr, \"nombre d’arguments de ligne de commande non valable.\\[rs]n\");\n"
3760 " exit(EXIT_FAILURE);\n"
3761 " }\n"
3762 "\\&\n"
3763 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
3764 " if (mount_fd == -1) {\n"
3765 " perror(argv[1]);\n"
3766 " exit(EXIT_FAILURE);\n"
3767 " }\n"
3768 "\\&\n"
3769 " /* Création d’un descripteur de fichier avec FAN_REPORT_DFID_NAME\n"
3770 " comme drapeau pour que le programme puisse recevoir des évènements\n"
3771 " fid avec un nom d’entrée de répertoire. */\n"
3772 "\\&\n"
3773 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
3774 " if (fd == -1) {\n"
3775 " perror(\"fanotify_init\");\n"
3776 " exit(EXIT_FAILURE);\n"
3777 " }\n"
3778 "\\&\n"
3779 " /* Placement d’une marque sur l’objet de système de fichiers fourni dans argv[1]. */\n"
3780 "\\&\n"
3781 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
3782 " FAN_CREATE | FAN_ONDIR,\n"
3783 " AT_FDCWD, argv[1]);\n"
3784 " if (ret == -1) {\n"
3785 " perror(\"fanotify_mark\");\n"
3786 " exit(EXIT_FAILURE);\n"
3787 " }\n"
3788 "\\&\n"
3789 " printf(\"Écoute d’évènements.\\[rs]n\");\n"
3790 "\\&\n"
3791 " /* Lecture d’évènements de la file d’évènements d’un tampon. */\n"
3792 "\\&\n"
3793 " len = read(fd, events_buf, sizeof(events_buf));\n"
3794 " if (len == -1 && errno != EAGAIN) {\n"
3795 " perror(\"read\");\n"
3796 " exit(EXIT_FAILURE);\n"
3797 " }\n"
3798 "\\&\n"
3799 " /* Traitement de tous les évènements du tampon. */\n"
3800 "\\&\n"
3801 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
3802 " FAN_EVENT_OK(metadata, len);\n"
3803 " metadata = FAN_EVENT_NEXT(metadata, len)) {\n"
3804 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
3805 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
3806 "\\&\n"
3807 " /* Vérification que l’information d’évènement soit du bon type. */\n"
3808 "\\&\n"
3809 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
3810 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
3811 " file_name = NULL;\n"
3812 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
3813 " file_name = file_handle-E<gt>f_handle +\n"
3814 " file_handle-E<gt>handle_bytes;\n"
3815 " } else {\n"
3816 " fprintf(stderr, \"Type inattendu d’information d’évènement.\\[rs]n\");\n"
3817 " exit(EXIT_FAILURE);\n"
3818 " }\n"
3819 "\\&\n"
3820 " if (metadata-E<gt>mask == FAN_CREATE)\n"
3821 " printf(\"FAN_CREATE (fichier créé :\\[rs]n\");\n"
3822 "\\&\n"
3823 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
3824 " printf(\"FAN_CREATE | FAN_ONDIR (sous-répertoire créé) :\\[rs]n\");\n"
3825 "\\&\n"
3826 "\t/* metadata-E<gt>fd est défini à FAN_NOFD quand le groupe identifie\n"
3827 "\t des objets par des gestionnaires de fichier. Pour obtenir un descripteur\n"
3828 "\t de fichier pour l’objet de fichier correspondant à un évènement, la structure\n"
3829 "\t file_handle qui est fournie dans fanotify_event_info_fid peut être utilisée\n"
3830 "\t en conjonction avec l’appel système open_by_handle_at(2). Une vérification\n"
3831 "\t pour ESTALE est faite pour répondre à la situation où le gestionnaire de\n"
3832 "\t l’objet a été supprimé avant cet appel système. */\n"
3833 "\\&\n"
3834 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
3835 " if (event_fd == -1) {\n"
3836 " if (errno == ESTALE) {\n"
3837 " printf(\"Gestionnaire de fichier plus valable. \"\n"
3838 " \"Le fichier a été supprimé\\[rs]n\");\n"
3839 " continuation;\n"
3840 " } else {\n"
3841 " perror(\"open_by_handle_at\");\n"
3842 " exit(EXIT_FAILURE);\n"
3843 " }\n"
3844 " }\n"
3845 "\\&\n"
3846 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
3847 " event_fd);\n"
3848 "\\&\n"
3849 " /* Récupération et affichage du chemin d’entrée de répertoire modifiée. */\n"
3850 "\\&\n"
3851 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
3852 " if (path_len == -1) {\n"
3853 " perror(\"readlink\");\n"
3854 " exit(EXIT_FAILURE);\n"
3855 " }\n"
3856 "\\&\n"
3857 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
3858 " printf(\"\\[rs]tRépertoire « %s » a été modifié.\\[rs]n\", chemin);\n"
3859 "\\&\n"
3860 " if (file_name) {\n"
3861 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
3862 " if (ret == -1) {\n"
3863 " if (errno != ENOENT) {\n"
3864 " perror(\"fstatat\");\n"
3865 " exit(EXIT_FAILURE);\n"
3866 " }\n"
3867 " printf(\"\\[rs]tEntée « %s » n’existe pas.\\[rs]n\", fichier);\n"
3868 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
3869 " printf(\"\\[rs]tEntrée « %s » est un sous-répertoire.\\[rs]n\", fichier);\n"
3870 " } else {\n"
3871 " printf(\"\\[rs]tEntrée « %s » n’est pas un répertoire.\\[rs]n\",\n"
3872 " fichier);\n"
3873 " }\n"
3874 " }\n"
3875 "\\&\n"
3876 " /* Fermeture du descripteur de fichier associé à cet évènement. */\n"
3877 "\\&\n"
3878 " close(event_fd);\n"
3879 " }\n"
3880 "\\&\n"
3881 " printf(\"Tous les évènements ont été traités avec succès. Fin du programme.\\[rs]n\");\n"
3882 " exit(EXIT_SUCCESS);\n"
3883 "}\n"
3884
3885 #. type: SH
3886 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3887 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3888 #, no-wrap
3889 msgid "SEE ALSO"
3890 msgstr "VOIR AUSSI"
3891
3892 #. type: Plain text
3893 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
3894 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
3895 msgid "B<fanotify_init>(2), B<fanotify_mark>(2), B<inotify>(7)"
3896 msgstr "B<fanotify_init>(2), B<fanotify_mark>(2), B<inotify>(7)"
3897
3898 #. type: TH
3899 #: debian-trixie
3900 #, no-wrap
3901 msgid "2024-06-15"
3902 msgstr "15 juin 2024"
3903
3904 #. type: TH
3905 #: debian-trixie
3906 #, no-wrap
3907 msgid "Linux man-pages 6.9.1"
3908 msgstr "Pages du manuel de Linux 6.9.1"
3909
3910 #. type: Plain text
3911 #: debian-trixie
3912 msgid ""
3913 "This is the length of the data for the current event and the offset to the "
3914 "next event in the buffer. Unless the group identifies filesystem objects by "
3915 "file handles, the value of I<event_len> is always "
3916 "B<FAN_EVENT_METADATA_LEN>. For a group that identifies filesystem objects "
3917 "by file handles, I<event_len> also includes the variable length file "
3918 "identifier records."
3919 msgstr ""
3920 "C’est la taille des données pour l’événement actuel et la position du "
3921 "prochain événement dans le tampon. À moins que le groupe identifie des "
3922 "objets du système de fichiers par des gestionnaires de fichiers, la valeur "
3923 "d’I<event_len> est toujours B<FAN_EVENT_METADATA_LEN>. Pour un groupe qui "
3924 "identifie les objets du système de fichiers par des gestionnaires de "
3925 "fichiers, I<event_len> inclut aussi des enregistrements d’identificateur de "
3926 "fichier de taille variable."
3927
3928 #. type: Plain text
3929 #: debian-trixie
3930 msgid ""
3931 "This is the length of the structure. The field was introduced to facilitate "
3932 "the implementation of optional headers per event type. No such optional "
3933 "headers exist in the current implementation."
3934 msgstr ""
3935 "C’est la taille de la structure. Le champ a été introduit pour faciliter "
3936 "l’implémentation d’en-têtes facultatifs par type d’événement. Aucun en-tête "
3937 "facultatif n’existe dans l’implémentation actuelle."
3938
3939 #. type: Plain text
3940 #: debian-trixie fedora-44 fedora-rawhide
3941 msgid ""
3942 "A unique integer value representing the type of information record object "
3943 "received for an event. The value of this field can be set to one of the "
3944 "following: B<FAN_EVENT_INFO_TYPE_FID>, B<FAN_EVENT_INFO_TYPE_DFID>, "
3945 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, or B<FAN_EVENT_INFO_TYPE_PIDFD>. The "
3946 "value set for this field is dependent on the flags that have been supplied "
3947 "to B<fanotify_init>(2). Refer to the field details of each information "
3948 "record object type below to understand the different cases in which the "
3949 "I<info_type> values can be set."
3950 msgstr ""
3951 "Valeur entière unique représentant le type d’objet d’enregistrement "
3952 "d’information reçu pour un évènement. Ce champ peut être défini à une des "
3953 "valeurs suivantes : B<FAN_EVENT_INFO_TYPE_FID>, B<FAN_EVENT_INFO_TYPE_DFID>, "
3954 "B<FAN_EVENT_INFO_TYPE_DFID_NAME> ou B<FAN_EVENT_INFO_TYPE_PIDFD>. L’ensemble "
3955 "des valeurs pour ce champ est dépendant des drapeaux qui ont été fournis à "
3956 "B<fanotify_init>(2). Se référer aux détails des champs pour chaque type "
3957 "d’objet d’enregistrement d’information ci-dessous pour appréhender les "
3958 "différents cas dans lesquels les valeurs I<info_type> peuvent être définies."
3959
3960 #. type: Plain text
3961 #: debian-trixie
3962 msgid ""
3963 "This is a unique identifier of the filesystem containing the object "
3964 "associated with the event. It is a structure of type I<__kernel_fsid_t> and "
3965 "contains the same value as I<f_fsid> when calling B<statfs>(2)."
3966 msgstr ""
3967 "C’est un identifiant unique du système de fichiers contenant l’objet associé "
3968 "avec l’évènement. C’est une structure de type I<__kernel_fsid_t> et elle "
3969 "contient la même valeur que I<f_fsid> lors de l’appel B<statfs>(2)."
3970
3971 #. type: Plain text
3972 #: debian-trixie
3973 msgid ""
3974 "This field contains a variable-length structure of type I<struct "
3975 "file_handle>. It is an opaque handle that corresponds to a specified object "
3976 "on a filesystem as returned by B<name_to_handle_at>(2). It can be used to "
3977 "uniquely identify a file on a filesystem and can be passed as an argument to "
3978 "B<open_by_handle_at>(2). If the value of I<info_type> field is "
3979 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the file handle is followed by a null "
3980 "terminated string that identifies the created/deleted/moved directory entry "
3981 "name. For other events such as B<FAN_OPEN>, B<FAN_ATTRIB>, "
3982 "B<FAN_DELETE_SELF>, and B<FAN_MOVE_SELF>, if the value of I<info_type> field "
3983 "is B<FAN_EVENT_INFO_TYPE_FID>, the I<handle> identifies the object "
3984 "correlated to the event. If the value of I<info_type> field is "
3985 "B<FAN_EVENT_INFO_TYPE_DFID>, the I<handle> identifies the directory object "
3986 "correlated to the event or the parent directory of a non-directory object "
3987 "correlated to the event. If the value of I<info_type> field is "
3988 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, the I<handle> identifies the same "
3989 "directory object that would be reported with B<FAN_EVENT_INFO_TYPE_DFID> and "
3990 "the file handle is followed by a null terminated string that identifies the "
3991 "name of a directory entry in that directory, or '.' to identify the "
3992 "directory object itself."
3993 msgstr ""
3994 "Ce champ contient une structure de taille variable de type I<struct "
3995 "file_handle>. C’est un gestionnaire opaque qui correspond à un objet précis "
3996 "de système de fichiers comme renvoyé par B<name_to_handle_at>(2). Il peut "
3997 "être utilisé uniquement pour identifier un fichier d’un système de fichiers "
3998 "et peut être passé comme argument à B<open_by_handle_at>(2). Si la valeur du "
3999 "champ I<info_type> est B<FAN_EVENT_INFO_TYPE_DFID_NAME>, le gestionnaire de "
4000 "fichiers est suivi d’un octet NULL final qui identifie le nom d’entrée de "
4001 "répertoire créée/supprimée/déplacée. Pour les autres évènements tels que "
4002 "B<FAN_OPEN>, B<FAN_ATTRIB>, B<FAN_DELETE_SELF> et B<FAN_MOVE_SELF>, si la "
4003 "valeur du champ I<info_type> est B<FAN_EVENT_INFO_TYPE_FID>, le I<handle> "
4004 "identifie l’objet corrélé à l’évènement. Si la valeur du champ I<info_type> "
4005 "est B<FAN_EVENT_INFO_TYPE_DFID>, le I<handle> identifie l’objet de "
4006 "répertoire corrélé à l’évènement ou le répertoire parent d’un objet non-"
4007 "répertoire corrélé à l’évènement. Si la valeur du champ I<info_type> est "
4008 "B<FAN_EVENT_INFO_TYPE_DFID_NAME>, le I<handle> identifie le même objet de "
4009 "répertoire qui aurait été rapporté avec B<FAN_EVENT_INFO_TYPE_DFID> et le "
4010 "gestionnaire de fichier est suivi d’un octet NULL final qui identifie le nom "
4011 "de l’entrée de répertoire dans ce répertoire ou « . » pour identifier "
4012 "l’objet du répertoire."
4013
4014 #. type: TP
4015 #: debian-trixie
4016 #, no-wrap
4017 msgid "B<FAN_EVENT_OK(meta, len)>"
4018 msgstr "B<FAN_EVENT_OK(meta, len)>"
4019
4020 #. type: Plain text
4021 #: debian-trixie
4022 msgid ""
4023 "This macro checks the remaining length I<len> of the buffer I<meta> against "
4024 "the length of the metadata structure and the I<event_len> field of the first "
4025 "metadata structure in the buffer."
4026 msgstr ""
4027 "Cette macro compare la taille restante I<len> du tampon I<meta> à la taille "
4028 "de la structure de métadonnées et au champ I<event_len> de la première "
4029 "structure de métadonnées du tampon."
4030
4031 #. type: TP
4032 #: debian-trixie
4033 #, no-wrap
4034 msgid "B<FAN_EVENT_NEXT(meta, len)>"
4035 msgstr "B<FAN_EVENT_NEXT(meta, len)>"
4036
4037 #. type: Plain text
4038 #: debian-trixie
4039 msgid ""
4040 "This macro uses the length indicated in the I<event_len> field of the "
4041 "metadata structure pointed to by I<meta> to calculate the address of the "
4042 "next metadata structure that follows I<meta>. I<len> is the number of bytes "
4043 "of metadata that currently remain in the buffer. The macro returns a "
4044 "pointer to the next metadata structure that follows I<meta>, and reduces "
4045 "I<len> by the number of bytes in the metadata structure that has been "
4046 "skipped over (i.e., it subtracts I<meta-E<gt>event_len> from I<len>)."
4047 msgstr ""
4048 "Cette macro utilise la taille indiquée dans le champ I<event_len> de la "
4049 "structure de métadonnées pointée par I<meta> pour calculer l’adresse de la "
4050 "prochaine structure de métadonnées qui suit I<meta>. I<len> est le nombre "
4051 "d’octets de métadonnées qui restent actuellement dans le tampon. La macro "
4052 "renvoie un pointeur vers la prochaine structure de métadonnées qui suit "
4053 "I<meta> et réduit I<len> du nombre d’octets dans la structure de métadonnées "
4054 "qui a été sautée (c’est-à-dire qu’elle soustrait I<meta-E<gt>event_len> de "
4055 "I<len>)."
4056
4057 #. type: Plain text
4058 #: debian-trixie fedora-44 fedora-rawhide
4059 msgid ""
4060 "This field indicates whether or not the permission is to be granted. Its "
4061 "value must be either B<FAN_ALLOW> to allow the file operation or B<FAN_DENY> "
4062 "to deny the file operation."
4063 msgstr ""
4064 "Ce champ indique si les droits doivent être attribués ou non. Cette valeur "
4065 "doit être soit B<FAN_ALLOW> pour permettre l’opération de fichier, soit "
4066 "B<FAN_DENY> pour refuser l’opération de fichier."
4067
4068 #. type: Plain text
4069 #: debian-trixie fedora-44 fedora-rawhide
4070 msgid ""
4071 "If access is denied, the requesting application call will receive an "
4072 "B<EPERM> error. Additionally, if the notification group has been created "
4073 "with the B<FAN_ENABLE_AUDIT> flag, then the B<FAN_AUDIT> flag can be set in "
4074 "the I<response> field. In that case, the audit subsystem will log "
4075 "information about the access decision to the audit logs."
4076 msgstr ""
4077 "Si l’accès est refusé, l’appel de l’application requérante recevra une "
4078 "erreur B<EPERM>. De plus, si le groupe de notifications a été créé avec "
4079 "l’attribut B<FAN_ENABLE_AUDIT>, alors l’attribut B<FAN_AUDIT> peut être "
4080 "défini dans le champ I<response>. Dans ce cas, le sous-système d’audit "
4081 "journalisera l’information à propos de la décision d’accès aux journaux "
4082 "d’audit."
4083
4084 #. type: Plain text
4085 #: debian-trixie fedora-44 fedora-rawhide
4086 msgid ""
4087 "Errors not directly related to a file (i.e. super block corruption) are "
4088 "reported with an invalid I<handle>. For these errors, the I<handle> will "
4089 "have the field I<handle_type> set to B<FILEID_INVALID>, and the handle "
4090 "buffer size set to B<0>."
4091 msgstr ""
4092 "Les erreurs ne concernant pas directement un fichier (c’est-à-dire des "
4093 "corruptions de superbloc) sont rapportées avec un I<handle> non valable. "
4094 "Pour ces erreurs, le I<handle> aura le champ I<handle_type> défini à "
4095 "B<FILEID_INVALID> et la taille de tampon de I<handle> définie à B<0>."
4096
4097 #. commit 5b8fea65d197f408bb00b251c70d842826d6b70b
4098 #. type: Plain text
4099 #: debian-trixie
4100 msgid ""
4101 "Since Linux 5.13, the following interfaces can be used to control the amount "
4102 "of kernel resources consumed by fanotify:"
4103 msgstr ""
4104 "Depuis Linux 5.13, les interfaces suivantes peuvent être utilisées pour "
4105 "contrôler la quantité de ressources du noyau utilisées par B<fanotify> :"
4106
4107 #. type: Plain text
4108 #: debian-trixie
4109 msgid ""
4110 "If a call to B<read>(2) processes multiple events from the fanotify queue "
4111 "and an error occurs, the return value will be the total length of the events "
4112 "successfully copied to the user-space buffer before the error occurred. The "
4113 "return value will not be -1, and I<errno> will not be set. Thus, the "
4114 "reading application has no way to detect the error."
4115 msgstr ""
4116 "Si un appel de B<read>(2) traite plusieurs événements de la file fanotify et "
4117 "qu’une erreur survient, la valeur de retour sera la taille totale des "
4118 "événements copiés correctement dans le tampon d’espace utilisateur avant que "
4119 "l’erreur ne survienne. La valeur de retour ne sera pas B<-1> et I<errno> ne "
4120 "sera pas définie. Ainsi, l’application lisant n’a aucun moyen de détecter "
4121 "l’erreur."
4122
4123 #. type: Plain text
4124 #: debian-trixie fedora-44 fedora-rawhide
4125 #, no-wrap
4126 msgid ""
4127 "# B<./fanotify_example /home>\n"
4128 "Press enter key to terminate.\n"
4129 "Listening for events.\n"
4130 "FAN_OPEN_PERM: File /home/user/temp/notes\n"
4131 "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
4132 "\\&\n"
4133 "Listening for events stopped.\n"
4134 msgstr ""
4135 "# B<./fanotify_exemple /home>\n"
4136 "Appuyer sur la touche Entrée pour quitter.\n"
4137 "En écoute d’événements.\n"
4138 "FAN_OPEN_PERM : Fichier /home/utilisateur/temp/notes\n"
4139 "FAN_CLOSE_WRITE : Fichier /home/utilisateur/temp/notes\n"
4140 "Écoute des évènements arrêtée.\n"
4141
4142 #. type: Plain text
4143 #: debian-trixie
4144 #, no-wrap
4145 msgid ""
4146 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
4147 "#include E<lt>errno.hE<gt>\n"
4148 "#include E<lt>fcntl.hE<gt>\n"
4149 "#include E<lt>limits.hE<gt>\n"
4150 "#include E<lt>poll.hE<gt>\n"
4151 "#include E<lt>stdio.hE<gt>\n"
4152 "#include E<lt>stdlib.hE<gt>\n"
4153 "#include E<lt>sys/fanotify.hE<gt>\n"
4154 "#include E<lt>unistd.hE<gt>\n"
4155 "\\&\n"
4156 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
4157 "\\&\n"
4158 "static void\n"
4159 "handle_events(int fd)\n"
4160 "{\n"
4161 " const struct fanotify_event_metadata *metadata;\n"
4162 " struct fanotify_event_metadata buf[200];\n"
4163 " ssize_t len;\n"
4164 " char path[PATH_MAX];\n"
4165 " ssize_t path_len;\n"
4166 " char procfd_path[PATH_MAX];\n"
4167 " struct fanotify_response response;\n"
4168 "\\&\n"
4169 " /* Loop while events can be read from fanotify file descriptor. */\n"
4170 "\\&\n"
4171 " for (;;) {\n"
4172 "\\&\n"
4173 " /* Read some events. */\n"
4174 "\\&\n"
4175 " len = read(fd, buf, sizeof(buf));\n"
4176 " if (len == -1 && errno != EAGAIN) {\n"
4177 " perror(\"read\");\n"
4178 " exit(EXIT_FAILURE);\n"
4179 " }\n"
4180 "\\&\n"
4181 " /* Check if end of available data reached. */\n"
4182 "\\&\n"
4183 " if (len E<lt>= 0)\n"
4184 " break;\n"
4185 "\\&\n"
4186 " /* Point to the first event in the buffer. */\n"
4187 "\\&\n"
4188 " metadata = buf;\n"
4189 "\\&\n"
4190 " /* Loop over all events in the buffer. */\n"
4191 "\\&\n"
4192 " while (FAN_EVENT_OK(metadata, len)) {\n"
4193 "\\&\n"
4194 " /* Check that run-time and compile-time structures match. */\n"
4195 "\\&\n"
4196 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
4197 " fprintf(stderr,\n"
4198 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
4199 " exit(EXIT_FAILURE);\n"
4200 " }\n"
4201 "\\&\n"
4202 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
4203 " queue overflow, or a file descriptor (a nonnegative\n"
4204 " integer). Here, we simply ignore queue overflow. */\n"
4205 "\\&\n"
4206 " if (metadata-E<gt>fd E<gt>= 0) {\n"
4207 "\\&\n"
4208 " /* Handle open permission event. */\n"
4209 "\\&\n"
4210 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
4211 " printf(\"FAN_OPEN_PERM: \");\n"
4212 "\\&\n"
4213 " /* Allow file to be opened. */\n"
4214 "\\&\n"
4215 " response.fd = metadata-E<gt>fd;\n"
4216 " response.response = FAN_ALLOW;\n"
4217 " write(fd, &response, sizeof(response));\n"
4218 " }\n"
4219 "\\&\n"
4220 " /* Handle closing of writable file event. */\n"
4221 "\\&\n"
4222 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
4223 " printf(\"FAN_CLOSE_WRITE: \");\n"
4224 "\\&\n"
4225 " /* Retrieve and print pathname of the accessed file. */\n"
4226 "\\&\n"
4227 " snprintf(procfd_path, sizeof(procfd_path),\n"
4228 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
4229 " path_len = readlink(procfd_path, path,\n"
4230 " sizeof(path) - 1);\n"
4231 " if (path_len == -1) {\n"
4232 " perror(\"readlink\");\n"
4233 " exit(EXIT_FAILURE);\n"
4234 " }\n"
4235 "\\&\n"
4236 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4237 " printf(\"File %s\\[rs]n\", path);\n"
4238 "\\&\n"
4239 " /* Close the file descriptor of the event. */\n"
4240 "\\&\n"
4241 " close(metadata-E<gt>fd);\n"
4242 " }\n"
4243 "\\&\n"
4244 " /* Advance to next event. */\n"
4245 "\\&\n"
4246 " metadata = FAN_EVENT_NEXT(metadata, len);\n"
4247 " }\n"
4248 " }\n"
4249 "}\n"
4250 "\\&\n"
4251 "int\n"
4252 "main(int argc, char *argv[])\n"
4253 "{\n"
4254 " char buf;\n"
4255 " int fd, poll_num;\n"
4256 " nfds_t nfds;\n"
4257 " struct pollfd fds[2];\n"
4258 "\\&\n"
4259 " /* Check mount point is supplied. */\n"
4260 "\\&\n"
4261 " if (argc != 2) {\n"
4262 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
4263 " exit(EXIT_FAILURE);\n"
4264 " }\n"
4265 "\\&\n"
4266 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
4267 "\\&\n"
4268 " /* Create the file descriptor for accessing the fanotify API. */\n"
4269 "\\&\n"
4270 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
4271 " O_RDONLY | O_LARGEFILE);\n"
4272 " if (fd == -1) {\n"
4273 " perror(\"fanotify_init\");\n"
4274 " exit(EXIT_FAILURE);\n"
4275 " }\n"
4276 "\\&\n"
4277 " /* Mark the mount for:\n"
4278 " - permission events before opening files\n"
4279 " - notification events after closing a write-enabled\n"
4280 " file descriptor. */\n"
4281 "\\&\n"
4282 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
4283 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
4284 " argv[1]) == -1) {\n"
4285 " perror(\"fanotify_mark\");\n"
4286 " exit(EXIT_FAILURE);\n"
4287 " }\n"
4288 "\\&\n"
4289 " /* Prepare for polling. */\n"
4290 "\\&\n"
4291 " nfds = 2;\n"
4292 "\\&\n"
4293 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
4294 " fds[0].events = POLLIN;\n"
4295 "\\&\n"
4296 " fds[1].fd = fd; /* Fanotify input */\n"
4297 " fds[1].events = POLLIN;\n"
4298 "\\&\n"
4299 " /* This is the loop to wait for incoming events. */\n"
4300 "\\&\n"
4301 " printf(\"Listening for events.\\[rs]n\");\n"
4302 "\\&\n"
4303 " while (1) {\n"
4304 " poll_num = poll(fds, nfds, -1);\n"
4305 " if (poll_num == -1) {\n"
4306 " if (errno == EINTR) /* Interrupted by a signal */\n"
4307 " continue; /* Restart poll() */\n"
4308 "\\&\n"
4309 " perror(\"poll\"); /* Unexpected error */\n"
4310 " exit(EXIT_FAILURE);\n"
4311 " }\n"
4312 "\\&\n"
4313 " if (poll_num E<gt> 0) {\n"
4314 " if (fds[0].revents & POLLIN) {\n"
4315 "\\&\n"
4316 " /* Console input is available: empty stdin and quit. */\n"
4317 "\\&\n"
4318 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
4319 " continue;\n"
4320 " break;\n"
4321 " }\n"
4322 "\\&\n"
4323 " if (fds[1].revents & POLLIN) {\n"
4324 "\\&\n"
4325 " /* Fanotify events are available. */\n"
4326 "\\&\n"
4327 " handle_events(fd);\n"
4328 " }\n"
4329 " }\n"
4330 " }\n"
4331 "\\&\n"
4332 " printf(\"Listening for events stopped.\\[rs]n\");\n"
4333 " exit(EXIT_SUCCESS);\n"
4334 "}\n"
4335 msgstr ""
4336 "#define _GNU_SOURCE /* Nécessaire pour obtenir la définition de O_LARGEFILE */\n"
4337 "#include E<lt>errno.hE<gt>\n"
4338 "#include E<lt>fcntl.hE<gt>\n"
4339 "#include E<lt>limits.hE<gt>\n"
4340 "#include E<lt>poll.hE<gt>\n"
4341 "#include E<lt>stdio.hE<gt>\n"
4342 "#include E<lt>stdlib.hE<gt>\n"
4343 "#include E<lt>sys/fanotify.hE<gt>\n"
4344 "#include E<lt>unistd.hE<gt>\n"
4345 "\\&\n"
4346 "/* Lire tous les évènements fanotify disponibles du descripteur de fichier « fd ». */\n"
4347 "\\&\n"
4348 "static void\n"
4349 "handle_events(int fd)\n"
4350 "{\n"
4351 " const struct fanotify_event_metadata *metadata;\n"
4352 " struct fanotify_event_metadata buf[200];\n"
4353 " ssize_t len;\n"
4354 " char path[PATH_MAX];\n"
4355 " ssize_t path_len;\n"
4356 " char procfd_path[PATH_MAX];\n"
4357 " struct fanotify_response response;\n"
4358 "\\&\n"
4359 " /* Bouclage tant que des évènements peuvent être lus du descripteur de fichier. */\n"
4360 "\\&\n"
4361 " for (;;) {\n"
4362 "\\&\n"
4363 " /* Lecture de quelques évènements. */\n"
4364 "\\&\n"
4365 " len = read(fd, buf, sizeof(buf));\n"
4366 " if (len == -1 && errno != EAGAIN) {\n"
4367 " perror(\"read\");\n"
4368 " exit(EXIT_FAILURE);\n"
4369 " }\n"
4370 "\\&\n"
4371 " /* Vérification que la fin des données disponibles soit atteinte. */\n"
4372 "\\&\n"
4373 " if (len E<lt>= 0)\n"
4374 " break;\n"
4375 "\\&\n"
4376 " /* Pointage vers le premier évènement dans le tampon. */\n"
4377 "\\&\n"
4378 " metadata = buf;\n"
4379 "\\&\n"
4380 " /* Bouclage sur tous les évènements du tampon. */\n"
4381 "\\&\n"
4382 " while (FAN_EVENT_OK(metadata, len)) {\n"
4383 "\\&\n"
4384 " /* Vérification que les structures d’exécution et de compilation correspondent. */\n"
4385 "\\&\n"
4386 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
4387 " fprintf(stderr,\n"
4388 " \"Mauvaise correspondance des versions de métadonnées de fanotify.\\[rs]en\");\n"
4389 " exit(EXIT_FAILURE);\n"
4390 " }\n"
4391 "\\&\n"
4392 " /* metadata-E<gt>fd contient soit FAN_NOFD, indiquant un\n"
4393 " débordement de file ou un descripteur de fichier (un entier\n"
4394 " non négatif). Ici, le débordement est simplement ignoré. */\n"
4395 "\\&\n"
4396 " if (metadata-E<gt>fd E<gt>= 0) {\n"
4397 "\\&\n"
4398 " /* Gestion de la permission d’ouvrir. */\n"
4399 "\\&\n"
4400 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
4401 " printf(\"FAN_OPEN_PERM: \");\n"
4402 "\\&\n"
4403 " /* Autorisation d’ouvrir le fichier. */\n"
4404 "\\&\n"
4405 " response.fd = metadata-E<gt>fd;\n"
4406 " response.response = FAN_ALLOW;\n"
4407 " write(fd, &response, sizeof(response));\n"
4408 " }\n"
4409 "\\&\n"
4410 " /* Gestion de la fermeture d’évènement de fichier éditable. */\n"
4411 "\\&\n"
4412 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
4413 " printf(\"FAN_CLOSE_WRITE: \");\n"
4414 "\\&\n"
4415 " /* Récupération et affichage du chemin du fichier accédé. */\n"
4416 "\\&\n"
4417 " snprintf(procfd_path, sizeof(procfd_path),\n"
4418 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
4419 " path_len = readlink(procfd_path, path,\n"
4420 " sizeof(path) - 1);\n"
4421 " if (path_len == -1) {\n"
4422 " perror(\"readlink\");\n"
4423 " exit(EXIT_FAILURE);\n"
4424 " }\n"
4425 "\\&\n"
4426 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4427 " printf(\"File %s\\[rs]n\", path);\n"
4428 "\\&\n"
4429 " /* Fermeture du descripteur de fichier de l’évènement. */\n"
4430 "\\&\n"
4431 " close(metadata-E<gt>fd);\n"
4432 " }\n"
4433 "\\&\n"
4434 " /* Avance jusqu’au prochain évènement. */\n"
4435 "\\&\n"
4436 " metadata = FAN_EVENT_NEXT(metadata, len);\n"
4437 " }\n"
4438 " }\n"
4439 "}\n"
4440 "\\&\n"
4441 "int\n"
4442 "main(int argc, char *argv[])\n"
4443 "{\n"
4444 " char buf;\n"
4445 " int fd, poll_num;\n"
4446 " nfds_t nfds;\n"
4447 " struct pollfd fds[2];\n"
4448 "\\&\n"
4449 " /* Vérification que le point de montage soit fourni. */\n"
4450 "\\&\n"
4451 " if (argc != 2) {\n"
4452 " fprintf(stderr, \"Utilisation : %s MOUNT\\[rs]n\", argv[0]);\n"
4453 " exit(EXIT_FAILURE);\n"
4454 " }\n"
4455 "\\&\n"
4456 " printf(\"Presser la touche Entrée pour terminer.\\[rs]n\");\n"
4457 "\\&\n"
4458 " /* Création d’un descripteur de fichier pour accéder à l’API de fanotify. */\n"
4459 "\\&\n"
4460 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
4461 " O_RDONLY | O_LARGEFILE);\n"
4462 " if (fd == -1) {\n"
4463 " perror(\"fanotify_init\");\n"
4464 " exit(EXIT_FAILURE);\n"
4465 " }\n"
4466 "\\&\n"
4467 " /* Marque du montage pour :\n"
4468 " – évènements de permission avant ouvertures de fichier\n"
4469 " – évènements de notification après la fermeture\n"
4470 " d’un descripteur de fichier éditable. */\n"
4471 "\\&\n"
4472 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
4473 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
4474 " argv[1]) == -1) {\n"
4475 " perror(\"fanotify_mark\");\n"
4476 " exit(EXIT_FAILURE);\n"
4477 " }\n"
4478 "\\&\n"
4479 " /* Préparation pour sondage. */\n"
4480 "\\&\n"
4481 " nfds = 2;\n"
4482 "\\&\n"
4483 " fds[0].fd = STDIN_FILENO; /* Entrée de console */\n"
4484 " fds[0].events = POLLIN;\n"
4485 "\\&\n"
4486 " fds[1].fd = fd; /* Entrée de fanotify */\n"
4487 " fds[1].events = POLLIN;\n"
4488 "\\&\n"
4489 " /* Ceci est une boucle pour attendre de futurs évènements. */\n"
4490 "\\&\n"
4491 " printf(\"Écoute d’évènements.\\[rs]n\");\n"
4492 "\\&\n"
4493 " while (1) {\n"
4494 " poll_num = poll(fds, nfds, -1);\n"
4495 " if (poll_num == -1) {\n"
4496 " if (errno == EINTR) /* Interruption par un signal */\n"
4497 " continue; /* Redémarrage de poll() */\n"
4498 "\\&\n"
4499 " perror(\"poll\"); /* Erreur inattendue */\n"
4500 " exit(EXIT_FAILURE);\n"
4501 " }\n"
4502 "\\&\n"
4503 " if (poll_num E<gt> 0) {\n"
4504 " if (fds[0].revents & POLLIN) {\n"
4505 "\\&\n"
4506 " /* Entrée de console disponible : stdin vide et quitter. */\n"
4507 "\\&\n"
4508 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
4509 " continue;\n"
4510 " break;\n"
4511 " }\n"
4512 "\\&\n"
4513 " if (fds[1].revents & POLLIN) {\n"
4514 "\\&\n"
4515 " /* Évènements de fanotify disponibles. */\n"
4516 "\\&\n"
4517 " handle_events(fd);\n"
4518 " }\n"
4519 " }\n"
4520 " }\n"
4521 "\\&\n"
4522 " printf(\"Écoute d’évènements arrêtée.\\[rs]n\");\n"
4523 " exit(EXIT_SUCCESS);\n"
4524 "}\n"
4525
4526 #. type: Plain text
4527 #: debian-trixie fedora-44 fedora-rawhide
4528 #, no-wrap
4529 msgid ""
4530 "# B<./fanotify_fid /home/user>\n"
4531 "Listening for events.\n"
4532 "FAN_CREATE (file created):\n"
4533 " Directory /home/user has been modified.\n"
4534 " Entry \\[aq]testfile.txt\\[aq] is not a subdirectory.\n"
4535 "All events processed successfully. Program exiting.\n"
4536 "\\&\n"
4537 "$ B<touch /home/user/testfile.txt> # In another terminal\n"
4538 msgstr ""
4539 "# B<./fanotify_fid /home/user>\n"
4540 "Écoute de tous les évènements.\n"
4541 "FAN_CREATE (fichier créé) :\n"
4542 " Répertoire /home/utilisateur a été modifié.\n"
4543 " Entrée « fichiertest.txt » n’est pas un sous-répertoire.\n"
4544 "Tous les évènements ont été traités avec succès. Fin du programme.\n"
4545 "\\&\n"
4546 "$ B<touch /home/user/fichiertest.txt> # Dans un autre terminal\n"
4547
4548 #. type: Plain text
4549 #: debian-trixie fedora-44 fedora-rawhide
4550 #, no-wrap
4551 msgid ""
4552 "# B<./fanotify_fid /home/user>\n"
4553 "Listening for events.\n"
4554 "FAN_CREATE | FAN_ONDIR (subdirectory created):\n"
4555 " Directory /home/user has been modified.\n"
4556 " Entry \\[aq]testdir\\[aq] is a subdirectory.\n"
4557 "All events processed successfully. Program exiting.\n"
4558 "\\&\n"
4559 "$ B<mkdir -p /home/user/testdir> # In another terminal\n"
4560 msgstr ""
4561 "# B<./fanotify_fid /home/user>\n"
4562 "Écoute de tous les évènements.\n"
4563 "FAN_CREATE | FAN_ONDIR (sous_répertoire créé) :\n"
4564 " Répertoire /home/utilisateur a été modifié.\n"
4565 " Entrée « réptest » est un sous-répertoire.\n"
4566 "Tous les évènements ont été traités avec succès. Fin du programme.\n"
4567 "\\&\n"
4568 "$ B<mkdir -p /home/user/réptest> # Dans un autre terminal\n"
4569
4570 #. type: Plain text
4571 #: debian-trixie
4572 #, no-wrap
4573 msgid ""
4574 "#define _GNU_SOURCE\n"
4575 "#include E<lt>errno.hE<gt>\n"
4576 "#include E<lt>fcntl.hE<gt>\n"
4577 "#include E<lt>limits.hE<gt>\n"
4578 "#include E<lt>stdio.hE<gt>\n"
4579 "#include E<lt>stdlib.hE<gt>\n"
4580 "#include E<lt>sys/types.hE<gt>\n"
4581 "#include E<lt>sys/stat.hE<gt>\n"
4582 "#include E<lt>sys/fanotify.hE<gt>\n"
4583 "#include E<lt>unistd.hE<gt>\n"
4584 "\\&\n"
4585 "#define BUF_SIZE 256\n"
4586 "\\&\n"
4587 "int\n"
4588 "main(int argc, char *argv[])\n"
4589 "{\n"
4590 " int fd, ret, event_fd, mount_fd;\n"
4591 " ssize_t len, path_len;\n"
4592 " char path[PATH_MAX];\n"
4593 " char procfd_path[PATH_MAX];\n"
4594 " char events_buf[BUF_SIZE];\n"
4595 " struct file_handle *file_handle;\n"
4596 " struct fanotify_event_metadata *metadata;\n"
4597 " struct fanotify_event_info_fid *fid;\n"
4598 " const char *file_name;\n"
4599 " struct stat sb;\n"
4600 "\\&\n"
4601 " if (argc != 2) {\n"
4602 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
4603 " exit(EXIT_FAILURE);\n"
4604 " }\n"
4605 "\\&\n"
4606 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
4607 " if (mount_fd == -1) {\n"
4608 " perror(argv[1]);\n"
4609 " exit(EXIT_FAILURE);\n"
4610 " }\n"
4611 "\\&\n"
4612 " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
4613 " a flag so that program can receive fid events with directory\n"
4614 " entry name. */\n"
4615 "\\&\n"
4616 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
4617 " if (fd == -1) {\n"
4618 " perror(\"fanotify_init\");\n"
4619 " exit(EXIT_FAILURE);\n"
4620 " }\n"
4621 "\\&\n"
4622 " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
4623 "\\&\n"
4624 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
4625 " FAN_CREATE | FAN_ONDIR,\n"
4626 " AT_FDCWD, argv[1]);\n"
4627 " if (ret == -1) {\n"
4628 " perror(\"fanotify_mark\");\n"
4629 " exit(EXIT_FAILURE);\n"
4630 " }\n"
4631 "\\&\n"
4632 " printf(\"Listening for events.\\[rs]n\");\n"
4633 "\\&\n"
4634 " /* Read events from the event queue into a buffer. */\n"
4635 "\\&\n"
4636 " len = read(fd, events_buf, sizeof(events_buf));\n"
4637 " if (len == -1 && errno != EAGAIN) {\n"
4638 " perror(\"read\");\n"
4639 " exit(EXIT_FAILURE);\n"
4640 " }\n"
4641 "\\&\n"
4642 " /* Process all events within the buffer. */\n"
4643 "\\&\n"
4644 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
4645 " FAN_EVENT_OK(metadata, len);\n"
4646 " metadata = FAN_EVENT_NEXT(metadata, len)) {\n"
4647 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
4648 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
4649 "\\&\n"
4650 " /* Ensure that the event info is of the correct type. */\n"
4651 "\\&\n"
4652 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
4653 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
4654 " file_name = NULL;\n"
4655 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
4656 " file_name = file_handle-E<gt>f_handle +\n"
4657 " file_handle-E<gt>handle_bytes;\n"
4658 " } else {\n"
4659 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
4660 " exit(EXIT_FAILURE);\n"
4661 " }\n"
4662 "\\&\n"
4663 " if (metadata-E<gt>mask == FAN_CREATE)\n"
4664 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
4665 "\\&\n"
4666 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
4667 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
4668 "\\&\n"
4669 "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
4670 "\t objects by file handles. To obtain a file descriptor for\n"
4671 "\t the file object corresponding to an event you can use the\n"
4672 "\t struct file_handle that\\[aq]s provided within the\n"
4673 "\t fanotify_event_info_fid in conjunction with the\n"
4674 "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
4675 "\t done to accommodate for the situation where the file handle\n"
4676 "\t for the object was deleted prior to this system call. */\n"
4677 "\\&\n"
4678 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
4679 " if (event_fd == -1) {\n"
4680 " if (errno == ESTALE) {\n"
4681 " printf(\"File handle is no longer valid. \"\n"
4682 " \"File has been deleted\\[rs]n\");\n"
4683 " continue;\n"
4684 " } else {\n"
4685 " perror(\"open_by_handle_at\");\n"
4686 " exit(EXIT_FAILURE);\n"
4687 " }\n"
4688 " }\n"
4689 "\\&\n"
4690 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
4691 " event_fd);\n"
4692 "\\&\n"
4693 " /* Retrieve and print the path of the modified dentry. */\n"
4694 "\\&\n"
4695 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
4696 " if (path_len == -1) {\n"
4697 " perror(\"readlink\");\n"
4698 " exit(EXIT_FAILURE);\n"
4699 " }\n"
4700 "\\&\n"
4701 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4702 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
4703 "\\&\n"
4704 " if (file_name) {\n"
4705 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
4706 " if (ret == -1) {\n"
4707 " if (errno != ENOENT) {\n"
4708 " perror(\"fstatat\");\n"
4709 " exit(EXIT_FAILURE);\n"
4710 " }\n"
4711 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
4712 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
4713 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
4714 " } else {\n"
4715 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
4716 " file_name);\n"
4717 " }\n"
4718 " }\n"
4719 "\\&\n"
4720 " /* Close associated file descriptor for this event. */\n"
4721 "\\&\n"
4722 " close(event_fd);\n"
4723 " }\n"
4724 "\\&\n"
4725 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
4726 " exit(EXIT_SUCCESS);\n"
4727 "}\n"
4728 msgstr ""
4729 "#define _GNU_SOURCE\n"
4730 "#include E<lt>errno.hE<gt>\n"
4731 "#include E<lt>fcntl.hE<gt>\n"
4732 "#include E<lt>limits.hE<gt>\n"
4733 "#include E<lt>stdio.hE<gt>\n"
4734 "#include E<lt>stdlib.hE<gt>\n"
4735 "#include E<lt>sys/types.hE<gt>\n"
4736 "#include E<lt>sys/stat.hE<gt>\n"
4737 "#include E<lt>sys/fanotify.hE<gt>\n"
4738 "#include E<lt>unistd.hE<gt>\n"
4739 "\\&\n"
4740 "#define BUF_SIZE 256\n"
4741 "\\&\n"
4742 "int\n"
4743 "main(int argc, char *argv[])\n"
4744 "{\n"
4745 " int fd, ret, event_fd, mount_fd;\n"
4746 " ssize_t len, path_len;\n"
4747 " char path[PATH_MAX];\n"
4748 " char procfd_path[PATH_MAX];\n"
4749 " char events_buf[BUF_SIZE];\n"
4750 " struct file_handle *file_handle;\n"
4751 " struct fanotify_event_metadata *metadata;\n"
4752 " struct fanotify_event_info_fid *fid;\n"
4753 " const char *file_name;\n"
4754 " struct stat sb;\n"
4755 "\\&\n"
4756 " if (argc != 2) {\n"
4757 " fprintf(stderr, \"nombre d’arguments de ligne de commande non valable.\\[rs]n\");\n"
4758 " exit(EXIT_FAILURE);\n"
4759 " }\n"
4760 "\\&\n"
4761 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
4762 " if (mount_fd == -1) {\n"
4763 " perror(argv[1]);\n"
4764 " exit(EXIT_FAILURE);\n"
4765 " }\n"
4766 "\\&\n"
4767 " /* Création d’un descripteur de fichier avec FAN_REPORT_DFID_NAME\n"
4768 " comme drapeau pour que le programme puisse recevoir des évènements\n"
4769 " fid avec un nom d’entrée de répertoire. */\n"
4770 "\\&\n"
4771 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
4772 " if (fd == -1) {\n"
4773 " perror(\"fanotify_init\");\n"
4774 " exit(EXIT_FAILURE);\n"
4775 " }\n"
4776 "\\&\n"
4777 " /* Placement d’une marque sur l’objet de système de fichiers fourni dans argv[1]. */\n"
4778 "\\&\n"
4779 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
4780 " FAN_CREATE | FAN_ONDIR,\n"
4781 " AT_FDCWD, argv[1]);\n"
4782 " if (ret == -1) {\n"
4783 " perror(\"fanotify_mark\");\n"
4784 " exit(EXIT_FAILURE);\n"
4785 " }\n"
4786 "\\&\n"
4787 " printf(\"Écoute d’évènements.\\[rs]n\");\n"
4788 "\\&\n"
4789 " /* Lecture d’évènements de la file d’évènements d’un tampon. */\n"
4790 "\\&\n"
4791 " len = read(fd, events_buf, sizeof(events_buf));\n"
4792 " if (len == -1 && errno != EAGAIN) {\n"
4793 " perror(\"read\");\n"
4794 " exit(EXIT_FAILURE);\n"
4795 " }\n"
4796 "\\&\n"
4797 " /* Traitement de tous les évènements du tampon. */\n"
4798 "\\&\n"
4799 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
4800 " FAN_EVENT_OK(metadata, len);\n"
4801 " metadata = FAN_EVENT_NEXT(metadata, len)) {\n"
4802 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
4803 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
4804 "\\&\n"
4805 " /* Vérification que l’information d’évènement soit du bon type. */\n"
4806 "\\&\n"
4807 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
4808 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
4809 " file_name = NULL;\n"
4810 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
4811 " file_name = file_handle-E<gt>f_handle +\n"
4812 " file_handle-E<gt>handle_bytes;\n"
4813 " } else {\n"
4814 " fprintf(stderr, \"Type inattendu d’information d’évènement.\\[rs]n\");\n"
4815 " exit(EXIT_FAILURE);\n"
4816 " }\n"
4817 "\\&\n"
4818 " if (metadata-E<gt>mask == FAN_CREATE)\n"
4819 " printf(\"FAN_CREATE (fichier créé :\\[rs]n\");\n"
4820 "\\&\n"
4821 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
4822 " printf(\"FAN_CREATE | FAN_ONDIR (sous-répertoire créé) :\\[rs]n\");\n"
4823 "\\&\n"
4824 "\t/* metadata-E<gt>fd est défini à FAN_NOFD quand le groupe identifie\n"
4825 "\t des objets par des gestionnaires de fichier. Pour obtenir un descripteur\n"
4826 "\t de fichier pour l’objet de fichier correspondant à un évènement, la structure\n"
4827 "\t file_handle qui est fournie dans fanotify_event_info_fid peut être utilisée\n"
4828 "\t en conjonction avec l’appel système open_by_handle_at(2). Une vérification\n"
4829 "\t pour ESTALE est faite pour répondre à la situation où le gestionnaire de\n"
4830 "\t l’objet a été supprimé avant cet appel système. */\n"
4831 "\\&\n"
4832 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
4833 " if (event_fd == -1) {\n"
4834 " if (errno == ESTALE) {\n"
4835 " printf(\"Gestionnaire de fichier plus valable. \"\n"
4836 " \"Le fichier a été supprimé\\[rs]n\");\n"
4837 " continuation;\n"
4838 " } else {\n"
4839 " perror(\"open_by_handle_at\");\n"
4840 " exit(EXIT_FAILURE);\n"
4841 " }\n"
4842 " }\n"
4843 "\\&\n"
4844 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
4845 " event_fd);\n"
4846 "\\&\n"
4847 " /* Récupération et affichage du chemin d’entrée de répertoire modifiée. */\n"
4848 "\\&\n"
4849 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
4850 " if (path_len == -1) {\n"
4851 " perror(\"readlink\");\n"
4852 " exit(EXIT_FAILURE);\n"
4853 " }\n"
4854 "\\&\n"
4855 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4856 " printf(\"\\[rs]tRépertoire « %s » a été modifié.\\[rs]n\", chemin);\n"
4857 "\\&\n"
4858 " if (file_name) {\n"
4859 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
4860 " if (ret == -1) {\n"
4861 " if (errno != ENOENT) {\n"
4862 " perror(\"fstatat\");\n"
4863 " exit(EXIT_FAILURE);\n"
4864 " }\n"
4865 " printf(\"\\[rs]tEntée « %s » n’existe pas.\\[rs]n\", fichier);\n"
4866 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
4867 " printf(\"\\[rs]tEntrée « %s » est un sous-répertoire.\\[rs]n\", fichier);\n"
4868 " } else {\n"
4869 " printf(\"\\[rs]tEntrée « %s » n’est pas un répertoire.\\[rs]n\",\n"
4870 " fichier);\n"
4871 " }\n"
4872 " }\n"
4873 "\\&\n"
4874 " /* Fermeture du descripteur de fichier associé à cet évènement. */\n"
4875 "\\&\n"
4876 " close(event_fd);\n"
4877 " }\n"
4878 "\\&\n"
4879 " printf(\"Tous les évènements ont été traités avec succès. Fin du programme.\\[rs]n\");\n"
4880 " exit(EXIT_SUCCESS);\n"
4881 "}\n"
4882
4883 #. type: TH
4884 #: fedora-44 fedora-rawhide
4885 #, no-wrap
4886 msgid "2024-11-17"
4887 msgstr "17 novembre 2024"
4888
4889 #. type: TH
4890 #: fedora-44 fedora-rawhide
4891 #, no-wrap
4892 msgid "Linux man-pages 6.13"
4893 msgstr "Pages du manuel de Linux 6.13"
4894
4895 #. type: Plain text
4896 #: fedora-44 fedora-rawhide
4897 #, fuzzy, no-wrap
4898 #| msgid ""
4899 #| "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
4900 #| "#include E<lt>errno.hE<gt>\n"
4901 #| "#include E<lt>fcntl.hE<gt>\n"
4902 #| "#include E<lt>limits.hE<gt>\n"
4903 #| "#include E<lt>poll.hE<gt>\n"
4904 #| "#include E<lt>stdio.hE<gt>\n"
4905 #| "#include E<lt>stdlib.hE<gt>\n"
4906 #| "#include E<lt>sys/fanotify.hE<gt>\n"
4907 #| "#include E<lt>unistd.hE<gt>\n"
4908 #| "\\&\n"
4909 #| "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
4910 #| "\\&\n"
4911 #| "static void\n"
4912 #| "handle_events(int fd)\n"
4913 #| "{\n"
4914 #| " const struct fanotify_event_metadata *metadata;\n"
4915 #| " struct fanotify_event_metadata buf[200];\n"
4916 #| " ssize_t len;\n"
4917 #| " char path[PATH_MAX];\n"
4918 #| " ssize_t path_len;\n"
4919 #| " char procfd_path[PATH_MAX];\n"
4920 #| " struct fanotify_response response;\n"
4921 #| "\\&\n"
4922 #| " /* Loop while events can be read from fanotify file descriptor. */\n"
4923 #| "\\&\n"
4924 #| " for (;;) {\n"
4925 #| "\\&\n"
4926 #| " /* Read some events. */\n"
4927 #| "\\&\n"
4928 #| " len = read(fd, buf, sizeof(buf));\n"
4929 #| " if (len == -1 && errno != EAGAIN) {\n"
4930 #| " perror(\"read\");\n"
4931 #| " exit(EXIT_FAILURE);\n"
4932 #| " }\n"
4933 #| "\\&\n"
4934 #| " /* Check if end of available data reached. */\n"
4935 #| "\\&\n"
4936 #| " if (len E<lt>= 0)\n"
4937 #| " break;\n"
4938 #| "\\&\n"
4939 #| " /* Point to the first event in the buffer. */\n"
4940 #| "\\&\n"
4941 #| " metadata = buf;\n"
4942 #| "\\&\n"
4943 #| " /* Loop over all events in the buffer. */\n"
4944 #| "\\&\n"
4945 #| " while (FAN_EVENT_OK(metadata, len)) {\n"
4946 #| "\\&\n"
4947 #| " /* Check that run-time and compile-time structures match. */\n"
4948 #| "\\&\n"
4949 #| " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
4950 #| " fprintf(stderr,\n"
4951 #| " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
4952 #| " exit(EXIT_FAILURE);\n"
4953 #| " }\n"
4954 #| "\\&\n"
4955 #| " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
4956 #| " queue overflow, or a file descriptor (a nonnegative\n"
4957 #| " integer). Here, we simply ignore queue overflow. */\n"
4958 #| "\\&\n"
4959 #| " if (metadata-E<gt>fd E<gt>= 0) {\n"
4960 #| "\\&\n"
4961 #| " /* Handle open permission event. */\n"
4962 #| "\\&\n"
4963 #| " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
4964 #| " printf(\"FAN_OPEN_PERM: \");\n"
4965 #| "\\&\n"
4966 #| " /* Allow file to be opened. */\n"
4967 #| "\\&\n"
4968 #| " response.fd = metadata-E<gt>fd;\n"
4969 #| " response.response = FAN_ALLOW;\n"
4970 #| " write(fd, &response, sizeof(response));\n"
4971 #| " }\n"
4972 #| "\\&\n"
4973 #| " /* Handle closing of writable file event. */\n"
4974 #| "\\&\n"
4975 #| " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
4976 #| " printf(\"FAN_CLOSE_WRITE: \");\n"
4977 #| "\\&\n"
4978 #| " /* Retrieve and print pathname of the accessed file. */\n"
4979 #| "\\&\n"
4980 #| " snprintf(procfd_path, sizeof(procfd_path),\n"
4981 #| " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
4982 #| " path_len = readlink(procfd_path, path,\n"
4983 #| " sizeof(path) - 1);\n"
4984 #| " if (path_len == -1) {\n"
4985 #| " perror(\"readlink\");\n"
4986 #| " exit(EXIT_FAILURE);\n"
4987 #| " }\n"
4988 #| "\\&\n"
4989 #| " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
4990 #| " printf(\"File %s\\[rs]n\", path);\n"
4991 #| "\\&\n"
4992 #| " /* Close the file descriptor of the event. */\n"
4993 #| "\\&\n"
4994 #| " close(metadata-E<gt>fd);\n"
4995 #| " }\n"
4996 #| "\\&\n"
4997 #| " /* Advance to next event. */\n"
4998 #| "\\&\n"
4999 #| " metadata = FAN_EVENT_NEXT(metadata, len);\n"
5000 #| " }\n"
5001 #| " }\n"
5002 #| "}\n"
5003 #| "\\&\n"
5004 #| "int\n"
5005 #| "main(int argc, char *argv[])\n"
5006 #| "{\n"
5007 #| " char buf;\n"
5008 #| " int fd, poll_num;\n"
5009 #| " nfds_t nfds;\n"
5010 #| " struct pollfd fds[2];\n"
5011 #| "\\&\n"
5012 #| " /* Check mount point is supplied. */\n"
5013 #| "\\&\n"
5014 #| " if (argc != 2) {\n"
5015 #| " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
5016 #| " exit(EXIT_FAILURE);\n"
5017 #| " }\n"
5018 #| "\\&\n"
5019 #| " printf(\"Press enter key to terminate.\\[rs]n\");\n"
5020 #| "\\&\n"
5021 #| " /* Create the file descriptor for accessing the fanotify API. */\n"
5022 #| "\\&\n"
5023 #| " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
5024 #| " O_RDONLY | O_LARGEFILE);\n"
5025 #| " if (fd == -1) {\n"
5026 #| " perror(\"fanotify_init\");\n"
5027 #| " exit(EXIT_FAILURE);\n"
5028 #| " }\n"
5029 #| "\\&\n"
5030 #| " /* Mark the mount for:\n"
5031 #| " - permission events before opening files\n"
5032 #| " - notification events after closing a write-enabled\n"
5033 #| " file descriptor. */\n"
5034 #| "\\&\n"
5035 #| " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
5036 #| " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
5037 #| " argv[1]) == -1) {\n"
5038 #| " perror(\"fanotify_mark\");\n"
5039 #| " exit(EXIT_FAILURE);\n"
5040 #| " }\n"
5041 #| "\\&\n"
5042 #| " /* Prepare for polling. */\n"
5043 #| "\\&\n"
5044 #| " nfds = 2;\n"
5045 #| "\\&\n"
5046 #| " fds[0].fd = STDIN_FILENO; /* Console input */\n"
5047 #| " fds[0].events = POLLIN;\n"
5048 #| "\\&\n"
5049 #| " fds[1].fd = fd; /* Fanotify input */\n"
5050 #| " fds[1].events = POLLIN;\n"
5051 #| "\\&\n"
5052 #| " /* This is the loop to wait for incoming events. */\n"
5053 #| "\\&\n"
5054 #| " printf(\"Listening for events.\\[rs]n\");\n"
5055 #| "\\&\n"
5056 #| " while (1) {\n"
5057 #| " poll_num = poll(fds, nfds, -1);\n"
5058 #| " if (poll_num == -1) {\n"
5059 #| " if (errno == EINTR) /* Interrupted by a signal */\n"
5060 #| " continue; /* Restart poll() */\n"
5061 #| "\\&\n"
5062 #| " perror(\"poll\"); /* Unexpected error */\n"
5063 #| " exit(EXIT_FAILURE);\n"
5064 #| " }\n"
5065 #| "\\&\n"
5066 #| " if (poll_num E<gt> 0) {\n"
5067 #| " if (fds[0].revents & POLLIN) {\n"
5068 #| "\\&\n"
5069 #| " /* Console input is available: empty stdin and quit. */\n"
5070 #| "\\&\n"
5071 #| " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
5072 #| " continue;\n"
5073 #| " break;\n"
5074 #| " }\n"
5075 #| "\\&\n"
5076 #| " if (fds[1].revents & POLLIN) {\n"
5077 #| "\\&\n"
5078 #| " /* Fanotify events are available. */\n"
5079 #| "\\&\n"
5080 #| " handle_events(fd);\n"
5081 #| " }\n"
5082 #| " }\n"
5083 #| " }\n"
5084 #| "\\&\n"
5085 #| " printf(\"Listening for events stopped.\\[rs]n\");\n"
5086 #| " exit(EXIT_SUCCESS);\n"
5087 #| "}\n"
5088 msgid ""
5089 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
5090 "#include E<lt>errno.hE<gt>\n"
5091 "#include E<lt>fcntl.hE<gt>\n"
5092 "#include E<lt>limits.hE<gt>\n"
5093 "#include E<lt>poll.hE<gt>\n"
5094 "#include E<lt>stdio.hE<gt>\n"
5095 "#include E<lt>stdlib.hE<gt>\n"
5096 "#include E<lt>sys/fanotify.hE<gt>\n"
5097 "#include E<lt>unistd.hE<gt>\n"
5098 "\\&\n"
5099 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
5100 "\\&\n"
5101 "static void\n"
5102 "handle_events(int fd)\n"
5103 "{\n"
5104 " const struct fanotify_event_metadata *metadata;\n"
5105 " struct fanotify_event_metadata buf[200];\n"
5106 " ssize_t size;\n"
5107 " char path[PATH_MAX];\n"
5108 " ssize_t path_len;\n"
5109 " char procfd_path[PATH_MAX];\n"
5110 " struct fanotify_response response;\n"
5111 "\\&\n"
5112 " /* Loop while events can be read from fanotify file descriptor. */\n"
5113 "\\&\n"
5114 " for (;;) {\n"
5115 "\\&\n"
5116 " /* Read some events. */\n"
5117 "\\&\n"
5118 " size = read(fd, buf, sizeof(buf));\n"
5119 " if (size == -1 && errno != EAGAIN) {\n"
5120 " perror(\"read\");\n"
5121 " exit(EXIT_FAILURE);\n"
5122 " }\n"
5123 "\\&\n"
5124 " /* Check if end of available data reached. */\n"
5125 "\\&\n"
5126 " if (size E<lt>= 0)\n"
5127 " break;\n"
5128 "\\&\n"
5129 " /* Point to the first event in the buffer. */\n"
5130 "\\&\n"
5131 " metadata = buf;\n"
5132 "\\&\n"
5133 " /* Loop over all events in the buffer. */\n"
5134 "\\&\n"
5135 " while (FAN_EVENT_OK(metadata, size)) {\n"
5136 "\\&\n"
5137 " /* Check that run-time and compile-time structures match. */\n"
5138 "\\&\n"
5139 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
5140 " fprintf(stderr,\n"
5141 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
5142 " exit(EXIT_FAILURE);\n"
5143 " }\n"
5144 "\\&\n"
5145 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
5146 " queue overflow, or a file descriptor (a nonnegative\n"
5147 " integer). Here, we simply ignore queue overflow. */\n"
5148 "\\&\n"
5149 " if (metadata-E<gt>fd E<gt>= 0) {\n"
5150 "\\&\n"
5151 " /* Handle open permission event. */\n"
5152 "\\&\n"
5153 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
5154 " printf(\"FAN_OPEN_PERM: \");\n"
5155 "\\&\n"
5156 " /* Allow file to be opened. */\n"
5157 "\\&\n"
5158 " response.fd = metadata-E<gt>fd;\n"
5159 " response.response = FAN_ALLOW;\n"
5160 " write(fd, &response, sizeof(response));\n"
5161 " }\n"
5162 "\\&\n"
5163 " /* Handle closing of writable file event. */\n"
5164 "\\&\n"
5165 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
5166 " printf(\"FAN_CLOSE_WRITE: \");\n"
5167 "\\&\n"
5168 " /* Retrieve and print pathname of the accessed file. */\n"
5169 "\\&\n"
5170 " snprintf(procfd_path, sizeof(procfd_path),\n"
5171 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
5172 " path_len = readlink(procfd_path, path,\n"
5173 " sizeof(path) - 1);\n"
5174 " if (path_len == -1) {\n"
5175 " perror(\"readlink\");\n"
5176 " exit(EXIT_FAILURE);\n"
5177 " }\n"
5178 "\\&\n"
5179 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
5180 " printf(\"File %s\\[rs]n\", path);\n"
5181 "\\&\n"
5182 " /* Close the file descriptor of the event. */\n"
5183 "\\&\n"
5184 " close(metadata-E<gt>fd);\n"
5185 " }\n"
5186 "\\&\n"
5187 " /* Advance to next event. */\n"
5188 "\\&\n"
5189 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
5190 " }\n"
5191 " }\n"
5192 "}\n"
5193 "\\&\n"
5194 "int\n"
5195 "main(int argc, char *argv[])\n"
5196 "{\n"
5197 " char buf;\n"
5198 " int fd, poll_num;\n"
5199 " nfds_t nfds;\n"
5200 " struct pollfd fds[2];\n"
5201 "\\&\n"
5202 " /* Check mount point is supplied. */\n"
5203 "\\&\n"
5204 " if (argc != 2) {\n"
5205 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
5206 " exit(EXIT_FAILURE);\n"
5207 " }\n"
5208 "\\&\n"
5209 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
5210 "\\&\n"
5211 " /* Create the file descriptor for accessing the fanotify API. */\n"
5212 "\\&\n"
5213 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
5214 " O_RDONLY | O_LARGEFILE);\n"
5215 " if (fd == -1) {\n"
5216 " perror(\"fanotify_init\");\n"
5217 " exit(EXIT_FAILURE);\n"
5218 " }\n"
5219 "\\&\n"
5220 " /* Mark the mount for:\n"
5221 " - permission events before opening files\n"
5222 " - notification events after closing a write-enabled\n"
5223 " file descriptor. */\n"
5224 "\\&\n"
5225 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
5226 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
5227 " argv[1]) == -1) {\n"
5228 " perror(\"fanotify_mark\");\n"
5229 " exit(EXIT_FAILURE);\n"
5230 " }\n"
5231 "\\&\n"
5232 " /* Prepare for polling. */\n"
5233 "\\&\n"
5234 " nfds = 2;\n"
5235 "\\&\n"
5236 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
5237 " fds[0].events = POLLIN;\n"
5238 "\\&\n"
5239 " fds[1].fd = fd; /* Fanotify input */\n"
5240 " fds[1].events = POLLIN;\n"
5241 "\\&\n"
5242 " /* This is the loop to wait for incoming events. */\n"
5243 "\\&\n"
5244 " printf(\"Listening for events.\\[rs]n\");\n"
5245 "\\&\n"
5246 " while (1) {\n"
5247 " poll_num = poll(fds, nfds, -1);\n"
5248 " if (poll_num == -1) {\n"
5249 " if (errno == EINTR) /* Interrupted by a signal */\n"
5250 " continue; /* Restart poll() */\n"
5251 "\\&\n"
5252 " perror(\"poll\"); /* Unexpected error */\n"
5253 " exit(EXIT_FAILURE);\n"
5254 " }\n"
5255 "\\&\n"
5256 " if (poll_num E<gt> 0) {\n"
5257 " if (fds[0].revents & POLLIN) {\n"
5258 "\\&\n"
5259 " /* Console input is available: empty stdin and quit. */\n"
5260 "\\&\n"
5261 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
5262 " continue;\n"
5263 " break;\n"
5264 " }\n"
5265 "\\&\n"
5266 " if (fds[1].revents & POLLIN) {\n"
5267 "\\&\n"
5268 " /* Fanotify events are available. */\n"
5269 "\\&\n"
5270 " handle_events(fd);\n"
5271 " }\n"
5272 " }\n"
5273 " }\n"
5274 "\\&\n"
5275 " printf(\"Listening for events stopped.\\[rs]n\");\n"
5276 " exit(EXIT_SUCCESS);\n"
5277 "}\n"
5278 msgstr ""
5279 "#define _GNU_SOURCE /* Nécessaire pour obtenir la définition de O_LARGEFILE */\n"
5280 "#include E<lt>errno.hE<gt>\n"
5281 "#include E<lt>fcntl.hE<gt>\n"
5282 "#include E<lt>limits.hE<gt>\n"
5283 "#include E<lt>poll.hE<gt>\n"
5284 "#include E<lt>stdio.hE<gt>\n"
5285 "#include E<lt>stdlib.hE<gt>\n"
5286 "#include E<lt>sys/fanotify.hE<gt>\n"
5287 "#include E<lt>unistd.hE<gt>\n"
5288 "\\&\n"
5289 "/* Lire tous les évènements fanotify disponibles du descripteur de fichier « fd ». */\n"
5290 "\\&\n"
5291 "static void\n"
5292 "handle_events(int fd)\n"
5293 "{\n"
5294 " const struct fanotify_event_metadata *metadata;\n"
5295 " struct fanotify_event_metadata buf[200];\n"
5296 " ssize_t len;\n"
5297 " char path[PATH_MAX];\n"
5298 " ssize_t path_len;\n"
5299 " char procfd_path[PATH_MAX];\n"
5300 " struct fanotify_response response;\n"
5301 "\\&\n"
5302 " /* Bouclage tant que des évènements peuvent être lus du descripteur de fichier. */\n"
5303 "\\&\n"
5304 " for (;;) {\n"
5305 "\\&\n"
5306 " /* Lecture de quelques évènements. */\n"
5307 "\\&\n"
5308 " len = read(fd, buf, sizeof(buf));\n"
5309 " if (len == -1 && errno != EAGAIN) {\n"
5310 " perror(\"read\");\n"
5311 " exit(EXIT_FAILURE);\n"
5312 " }\n"
5313 "\\&\n"
5314 " /* Vérification que la fin des données disponibles soit atteinte. */\n"
5315 "\\&\n"
5316 " if (len E<lt>= 0)\n"
5317 " break;\n"
5318 "\\&\n"
5319 " /* Pointage vers le premier évènement dans le tampon. */\n"
5320 "\\&\n"
5321 " metadata = buf;\n"
5322 "\\&\n"
5323 " /* Bouclage sur tous les évènements du tampon. */\n"
5324 "\\&\n"
5325 " while (FAN_EVENT_OK(metadata, len)) {\n"
5326 "\\&\n"
5327 " /* Vérification que les structures d’exécution et de compilation correspondent. */\n"
5328 "\\&\n"
5329 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
5330 " fprintf(stderr,\n"
5331 " \"Mauvaise correspondance des versions de métadonnées de fanotify.\\[rs]en\");\n"
5332 " exit(EXIT_FAILURE);\n"
5333 " }\n"
5334 "\\&\n"
5335 " /* metadata-E<gt>fd contient soit FAN_NOFD, indiquant un\n"
5336 " débordement de file ou un descripteur de fichier (un entier\n"
5337 " non négatif). Ici, le débordement est simplement ignoré. */\n"
5338 "\\&\n"
5339 " if (metadata-E<gt>fd E<gt>= 0) {\n"
5340 "\\&\n"
5341 " /* Gestion de la permission d’ouvrir. */\n"
5342 "\\&\n"
5343 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
5344 " printf(\"FAN_OPEN_PERM: \");\n"
5345 "\\&\n"
5346 " /* Autorisation d’ouvrir le fichier. */\n"
5347 "\\&\n"
5348 " response.fd = metadata-E<gt>fd;\n"
5349 " response.response = FAN_ALLOW;\n"
5350 " write(fd, &response, sizeof(response));\n"
5351 " }\n"
5352 "\\&\n"
5353 " /* Gestion de la fermeture d’évènement de fichier éditable. */\n"
5354 "\\&\n"
5355 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
5356 " printf(\"FAN_CLOSE_WRITE: \");\n"
5357 "\\&\n"
5358 " /* Récupération et affichage du chemin du fichier accédé. */\n"
5359 "\\&\n"
5360 " snprintf(procfd_path, sizeof(procfd_path),\n"
5361 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
5362 " path_len = readlink(procfd_path, path,\n"
5363 " sizeof(path) - 1);\n"
5364 " if (path_len == -1) {\n"
5365 " perror(\"readlink\");\n"
5366 " exit(EXIT_FAILURE);\n"
5367 " }\n"
5368 "\\&\n"
5369 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
5370 " printf(\"File %s\\[rs]n\", path);\n"
5371 "\\&\n"
5372 " /* Fermeture du descripteur de fichier de l’évènement. */\n"
5373 "\\&\n"
5374 " close(metadata-E<gt>fd);\n"
5375 " }\n"
5376 "\\&\n"
5377 " /* Avance jusqu’au prochain évènement. */\n"
5378 "\\&\n"
5379 " metadata = FAN_EVENT_NEXT(metadata, len);\n"
5380 " }\n"
5381 " }\n"
5382 "}\n"
5383 "\\&\n"
5384 "int\n"
5385 "main(int argc, char *argv[])\n"
5386 "{\n"
5387 " char buf;\n"
5388 " int fd, poll_num;\n"
5389 " nfds_t nfds;\n"
5390 " struct pollfd fds[2];\n"
5391 "\\&\n"
5392 " /* Vérification que le point de montage soit fourni. */\n"
5393 "\\&\n"
5394 " if (argc != 2) {\n"
5395 " fprintf(stderr, \"Utilisation : %s MOUNT\\[rs]n\", argv[0]);\n"
5396 " exit(EXIT_FAILURE);\n"
5397 " }\n"
5398 "\\&\n"
5399 " printf(\"Presser la touche Entrée pour terminer.\\[rs]n\");\n"
5400 "\\&\n"
5401 " /* Création d’un descripteur de fichier pour accéder à l’API de fanotify. */\n"
5402 "\\&\n"
5403 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
5404 " O_RDONLY | O_LARGEFILE);\n"
5405 " if (fd == -1) {\n"
5406 " perror(\"fanotify_init\");\n"
5407 " exit(EXIT_FAILURE);\n"
5408 " }\n"
5409 "\\&\n"
5410 " /* Marque du montage pour :\n"
5411 " – évènements de permission avant ouvertures de fichier\n"
5412 " – évènements de notification après la fermeture\n"
5413 " d’un descripteur de fichier éditable. */\n"
5414 "\\&\n"
5415 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
5416 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
5417 " argv[1]) == -1) {\n"
5418 " perror(\"fanotify_mark\");\n"
5419 " exit(EXIT_FAILURE);\n"
5420 " }\n"
5421 "\\&\n"
5422 " /* Préparation pour sondage. */\n"
5423 "\\&\n"
5424 " nfds = 2;\n"
5425 "\\&\n"
5426 " fds[0].fd = STDIN_FILENO; /* Entrée de console */\n"
5427 " fds[0].events = POLLIN;\n"
5428 "\\&\n"
5429 " fds[1].fd = fd; /* Entrée de fanotify */\n"
5430 " fds[1].events = POLLIN;\n"
5431 "\\&\n"
5432 " /* Ceci est une boucle pour attendre de futurs évènements. */\n"
5433 "\\&\n"
5434 " printf(\"Écoute d’évènements.\\[rs]n\");\n"
5435 "\\&\n"
5436 " while (1) {\n"
5437 " poll_num = poll(fds, nfds, -1);\n"
5438 " if (poll_num == -1) {\n"
5439 " if (errno == EINTR) /* Interruption par un signal */\n"
5440 " continue; /* Redémarrage de poll() */\n"
5441 "\\&\n"
5442 " perror(\"poll\"); /* Erreur inattendue */\n"
5443 " exit(EXIT_FAILURE);\n"
5444 " }\n"
5445 "\\&\n"
5446 " if (poll_num E<gt> 0) {\n"
5447 " if (fds[0].revents & POLLIN) {\n"
5448 "\\&\n"
5449 " /* Entrée de console disponible : stdin vide et quitter. */\n"
5450 "\\&\n"
5451 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
5452 " continue;\n"
5453 " break;\n"
5454 " }\n"
5455 "\\&\n"
5456 " if (fds[1].revents & POLLIN) {\n"
5457 "\\&\n"
5458 " /* Évènements de fanotify disponibles. */\n"
5459 "\\&\n"
5460 " handle_events(fd);\n"
5461 " }\n"
5462 " }\n"
5463 " }\n"
5464 "\\&\n"
5465 " printf(\"Écoute d’évènements arrêtée.\\[rs]n\");\n"
5466 " exit(EXIT_SUCCESS);\n"
5467 "}\n"
5468
5469 #. type: Plain text
5470 #: fedora-44 fedora-rawhide
5471 #, fuzzy, no-wrap
5472 #| msgid ""
5473 #| "#define _GNU_SOURCE\n"
5474 #| "#include E<lt>errno.hE<gt>\n"
5475 #| "#include E<lt>fcntl.hE<gt>\n"
5476 #| "#include E<lt>limits.hE<gt>\n"
5477 #| "#include E<lt>stdio.hE<gt>\n"
5478 #| "#include E<lt>stdlib.hE<gt>\n"
5479 #| "#include E<lt>sys/types.hE<gt>\n"
5480 #| "#include E<lt>sys/stat.hE<gt>\n"
5481 #| "#include E<lt>sys/fanotify.hE<gt>\n"
5482 #| "#include E<lt>unistd.hE<gt>\n"
5483 #| "\\&\n"
5484 #| "#define BUF_SIZE 256\n"
5485 #| "\\&\n"
5486 #| "int\n"
5487 #| "main(int argc, char *argv[])\n"
5488 #| "{\n"
5489 #| " int fd, ret, event_fd, mount_fd;\n"
5490 #| " ssize_t len, path_len;\n"
5491 #| " char path[PATH_MAX];\n"
5492 #| " char procfd_path[PATH_MAX];\n"
5493 #| " char events_buf[BUF_SIZE];\n"
5494 #| " struct file_handle *file_handle;\n"
5495 #| " struct fanotify_event_metadata *metadata;\n"
5496 #| " struct fanotify_event_info_fid *fid;\n"
5497 #| " const char *file_name;\n"
5498 #| " struct stat sb;\n"
5499 #| "\\&\n"
5500 #| " if (argc != 2) {\n"
5501 #| " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
5502 #| " exit(EXIT_FAILURE);\n"
5503 #| " }\n"
5504 #| "\\&\n"
5505 #| " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
5506 #| " if (mount_fd == -1) {\n"
5507 #| " perror(argv[1]);\n"
5508 #| " exit(EXIT_FAILURE);\n"
5509 #| " }\n"
5510 #| "\\&\n"
5511 #| " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
5512 #| " a flag so that program can receive fid events with directory\n"
5513 #| " entry name. */\n"
5514 #| "\\&\n"
5515 #| " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
5516 #| " if (fd == -1) {\n"
5517 #| " perror(\"fanotify_init\");\n"
5518 #| " exit(EXIT_FAILURE);\n"
5519 #| " }\n"
5520 #| "\\&\n"
5521 #| " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
5522 #| "\\&\n"
5523 #| " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
5524 #| " FAN_CREATE | FAN_ONDIR,\n"
5525 #| " AT_FDCWD, argv[1]);\n"
5526 #| " if (ret == -1) {\n"
5527 #| " perror(\"fanotify_mark\");\n"
5528 #| " exit(EXIT_FAILURE);\n"
5529 #| " }\n"
5530 #| "\\&\n"
5531 #| " printf(\"Listening for events.\\[rs]n\");\n"
5532 #| "\\&\n"
5533 #| " /* Read events from the event queue into a buffer. */\n"
5534 #| "\\&\n"
5535 #| " len = read(fd, events_buf, sizeof(events_buf));\n"
5536 #| " if (len == -1 && errno != EAGAIN) {\n"
5537 #| " perror(\"read\");\n"
5538 #| " exit(EXIT_FAILURE);\n"
5539 #| " }\n"
5540 #| "\\&\n"
5541 #| " /* Process all events within the buffer. */\n"
5542 #| "\\&\n"
5543 #| " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
5544 #| " FAN_EVENT_OK(metadata, len);\n"
5545 #| " metadata = FAN_EVENT_NEXT(metadata, len)) {\n"
5546 #| " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
5547 #| " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
5548 #| "\\&\n"
5549 #| " /* Ensure that the event info is of the correct type. */\n"
5550 #| "\\&\n"
5551 #| " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
5552 #| " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
5553 #| " file_name = NULL;\n"
5554 #| " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
5555 #| " file_name = file_handle-E<gt>f_handle +\n"
5556 #| " file_handle-E<gt>handle_bytes;\n"
5557 #| " } else {\n"
5558 #| " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
5559 #| " exit(EXIT_FAILURE);\n"
5560 #| " }\n"
5561 #| "\\&\n"
5562 #| " if (metadata-E<gt>mask == FAN_CREATE)\n"
5563 #| " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
5564 #| "\\&\n"
5565 #| " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
5566 #| " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
5567 #| "\\&\n"
5568 #| "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
5569 #| "\t objects by file handles. To obtain a file descriptor for\n"
5570 #| "\t the file object corresponding to an event you can use the\n"
5571 #| "\t struct file_handle that\\[aq]s provided within the\n"
5572 #| "\t fanotify_event_info_fid in conjunction with the\n"
5573 #| "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
5574 #| "\t done to accommodate for the situation where the file handle\n"
5575 #| "\t for the object was deleted prior to this system call. */\n"
5576 #| "\\&\n"
5577 #| " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
5578 #| " if (event_fd == -1) {\n"
5579 #| " if (errno == ESTALE) {\n"
5580 #| " printf(\"File handle is no longer valid. \"\n"
5581 #| " \"File has been deleted\\[rs]n\");\n"
5582 #| " continue;\n"
5583 #| " } else {\n"
5584 #| " perror(\"open_by_handle_at\");\n"
5585 #| " exit(EXIT_FAILURE);\n"
5586 #| " }\n"
5587 #| " }\n"
5588 #| "\\&\n"
5589 #| " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
5590 #| " event_fd);\n"
5591 #| "\\&\n"
5592 #| " /* Retrieve and print the path of the modified dentry. */\n"
5593 #| "\\&\n"
5594 #| " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
5595 #| " if (path_len == -1) {\n"
5596 #| " perror(\"readlink\");\n"
5597 #| " exit(EXIT_FAILURE);\n"
5598 #| " }\n"
5599 #| "\\&\n"
5600 #| " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
5601 #| " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
5602 #| "\\&\n"
5603 #| " if (file_name) {\n"
5604 #| " ret = fstatat(event_fd, file_name, &sb, 0);\n"
5605 #| " if (ret == -1) {\n"
5606 #| " if (errno != ENOENT) {\n"
5607 #| " perror(\"fstatat\");\n"
5608 #| " exit(EXIT_FAILURE);\n"
5609 #| " }\n"
5610 #| " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
5611 #| " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
5612 #| " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
5613 #| " } else {\n"
5614 #| " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
5615 #| " file_name);\n"
5616 #| " }\n"
5617 #| " }\n"
5618 #| "\\&\n"
5619 #| " /* Close associated file descriptor for this event. */\n"
5620 #| "\\&\n"
5621 #| " close(event_fd);\n"
5622 #| " }\n"
5623 #| "\\&\n"
5624 #| " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
5625 #| " exit(EXIT_SUCCESS);\n"
5626 #| "}\n"
5627 msgid ""
5628 "#define _GNU_SOURCE\n"
5629 "#include E<lt>errno.hE<gt>\n"
5630 "#include E<lt>fcntl.hE<gt>\n"
5631 "#include E<lt>limits.hE<gt>\n"
5632 "#include E<lt>stdio.hE<gt>\n"
5633 "#include E<lt>stdlib.hE<gt>\n"
5634 "#include E<lt>sys/types.hE<gt>\n"
5635 "#include E<lt>sys/stat.hE<gt>\n"
5636 "#include E<lt>sys/fanotify.hE<gt>\n"
5637 "#include E<lt>unistd.hE<gt>\n"
5638 "\\&\n"
5639 "#define BUF_SIZE 256\n"
5640 "\\&\n"
5641 "int\n"
5642 "main(int argc, char *argv[])\n"
5643 "{\n"
5644 " int fd, ret, event_fd, mount_fd;\n"
5645 " ssize_t size, path_len;\n"
5646 " char path[PATH_MAX];\n"
5647 " char procfd_path[PATH_MAX];\n"
5648 " char events_buf[BUF_SIZE];\n"
5649 " struct file_handle *file_handle;\n"
5650 " struct fanotify_event_metadata *metadata;\n"
5651 " struct fanotify_event_info_fid *fid;\n"
5652 " const char *file_name;\n"
5653 " struct stat sb;\n"
5654 "\\&\n"
5655 " if (argc != 2) {\n"
5656 " fprintf(stderr, \"Invalid number of command line arguments.\\[rs]n\");\n"
5657 " exit(EXIT_FAILURE);\n"
5658 " }\n"
5659 "\\&\n"
5660 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
5661 " if (mount_fd == -1) {\n"
5662 " perror(argv[1]);\n"
5663 " exit(EXIT_FAILURE);\n"
5664 " }\n"
5665 "\\&\n"
5666 " /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as\n"
5667 " a flag so that program can receive fid events with directory\n"
5668 " entry name. */\n"
5669 "\\&\n"
5670 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
5671 " if (fd == -1) {\n"
5672 " perror(\"fanotify_init\");\n"
5673 " exit(EXIT_FAILURE);\n"
5674 " }\n"
5675 "\\&\n"
5676 " /* Place a mark on the filesystem object supplied in argv[1]. */\n"
5677 "\\&\n"
5678 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
5679 " FAN_CREATE | FAN_ONDIR,\n"
5680 " AT_FDCWD, argv[1]);\n"
5681 " if (ret == -1) {\n"
5682 " perror(\"fanotify_mark\");\n"
5683 " exit(EXIT_FAILURE);\n"
5684 " }\n"
5685 "\\&\n"
5686 " printf(\"Listening for events.\\[rs]n\");\n"
5687 "\\&\n"
5688 " /* Read events from the event queue into a buffer. */\n"
5689 "\\&\n"
5690 " size = read(fd, events_buf, sizeof(events_buf));\n"
5691 " if (size == -1 && errno != EAGAIN) {\n"
5692 " perror(\"read\");\n"
5693 " exit(EXIT_FAILURE);\n"
5694 " }\n"
5695 "\\&\n"
5696 " /* Process all events within the buffer. */\n"
5697 "\\&\n"
5698 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
5699 " FAN_EVENT_OK(metadata, size);\n"
5700 " metadata = FAN_EVENT_NEXT(metadata, size)) {\n"
5701 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
5702 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
5703 "\\&\n"
5704 " /* Ensure that the event info is of the correct type. */\n"
5705 "\\&\n"
5706 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
5707 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
5708 " file_name = NULL;\n"
5709 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
5710 " file_name = file_handle-E<gt>f_handle +\n"
5711 " file_handle-E<gt>handle_bytes;\n"
5712 " } else {\n"
5713 " fprintf(stderr, \"Received unexpected event info type.\\[rs]n\");\n"
5714 " exit(EXIT_FAILURE);\n"
5715 " }\n"
5716 "\\&\n"
5717 " if (metadata-E<gt>mask == FAN_CREATE)\n"
5718 " printf(\"FAN_CREATE (file created):\\[rs]n\");\n"
5719 "\\&\n"
5720 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
5721 " printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\[rs]n\");\n"
5722 "\\&\n"
5723 "\t/* metadata-E<gt>fd is set to FAN_NOFD when the group identifies\n"
5724 "\t objects by file handles. To obtain a file descriptor for\n"
5725 "\t the file object corresponding to an event you can use the\n"
5726 "\t struct file_handle that\\[aq]s provided within the\n"
5727 "\t fanotify_event_info_fid in conjunction with the\n"
5728 "\t open_by_handle_at(2) system call. A check for ESTALE is\n"
5729 "\t done to accommodate for the situation where the file handle\n"
5730 "\t for the object was deleted prior to this system call. */\n"
5731 "\\&\n"
5732 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
5733 " if (event_fd == -1) {\n"
5734 " if (errno == ESTALE) {\n"
5735 " printf(\"File handle is no longer valid. \"\n"
5736 " \"File has been deleted\\[rs]n\");\n"
5737 " continue;\n"
5738 " } else {\n"
5739 " perror(\"open_by_handle_at\");\n"
5740 " exit(EXIT_FAILURE);\n"
5741 " }\n"
5742 " }\n"
5743 "\\&\n"
5744 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
5745 " event_fd);\n"
5746 "\\&\n"
5747 " /* Retrieve and print the path of the modified dentry. */\n"
5748 "\\&\n"
5749 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
5750 " if (path_len == -1) {\n"
5751 " perror(\"readlink\");\n"
5752 " exit(EXIT_FAILURE);\n"
5753 " }\n"
5754 "\\&\n"
5755 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
5756 " printf(\"\\[rs]tDirectory \\[aq]%s\\[aq] has been modified.\\[rs]n\", path);\n"
5757 "\\&\n"
5758 " if (file_name) {\n"
5759 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
5760 " if (ret == -1) {\n"
5761 " if (errno != ENOENT) {\n"
5762 " perror(\"fstatat\");\n"
5763 " exit(EXIT_FAILURE);\n"
5764 " }\n"
5765 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] does not exist.\\[rs]n\", file_name);\n"
5766 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
5767 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is a subdirectory.\\[rs]n\", file_name);\n"
5768 " } else {\n"
5769 " printf(\"\\[rs]tEntry \\[aq]%s\\[aq] is not a subdirectory.\\[rs]n\",\n"
5770 " file_name);\n"
5771 " }\n"
5772 " }\n"
5773 "\\&\n"
5774 " /* Close associated file descriptor for this event. */\n"
5775 "\\&\n"
5776 " close(event_fd);\n"
5777 " }\n"
5778 "\\&\n"
5779 " printf(\"All events processed successfully. Program exiting.\\[rs]n\");\n"
5780 " exit(EXIT_SUCCESS);\n"
5781 "}\n"
5782 msgstr ""
5783 "#define _GNU_SOURCE\n"
5784 "#include E<lt>errno.hE<gt>\n"
5785 "#include E<lt>fcntl.hE<gt>\n"
5786 "#include E<lt>limits.hE<gt>\n"
5787 "#include E<lt>stdio.hE<gt>\n"
5788 "#include E<lt>stdlib.hE<gt>\n"
5789 "#include E<lt>sys/types.hE<gt>\n"
5790 "#include E<lt>sys/stat.hE<gt>\n"
5791 "#include E<lt>sys/fanotify.hE<gt>\n"
5792 "#include E<lt>unistd.hE<gt>\n"
5793 "\\&\n"
5794 "#define BUF_SIZE 256\n"
5795 "\\&\n"
5796 "int\n"
5797 "main(int argc, char *argv[])\n"
5798 "{\n"
5799 " int fd, ret, event_fd, mount_fd;\n"
5800 " ssize_t len, path_len;\n"
5801 " char path[PATH_MAX];\n"
5802 " char procfd_path[PATH_MAX];\n"
5803 " char events_buf[BUF_SIZE];\n"
5804 " struct file_handle *file_handle;\n"
5805 " struct fanotify_event_metadata *metadata;\n"
5806 " struct fanotify_event_info_fid *fid;\n"
5807 " const char *file_name;\n"
5808 " struct stat sb;\n"
5809 "\\&\n"
5810 " if (argc != 2) {\n"
5811 " fprintf(stderr, \"nombre d’arguments de ligne de commande non valable.\\[rs]n\");\n"
5812 " exit(EXIT_FAILURE);\n"
5813 " }\n"
5814 "\\&\n"
5815 " mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
5816 " if (mount_fd == -1) {\n"
5817 " perror(argv[1]);\n"
5818 " exit(EXIT_FAILURE);\n"
5819 " }\n"
5820 "\\&\n"
5821 " /* Création d’un descripteur de fichier avec FAN_REPORT_DFID_NAME\n"
5822 " comme drapeau pour que le programme puisse recevoir des évènements\n"
5823 " fid avec un nom d’entrée de répertoire. */\n"
5824 "\\&\n"
5825 " fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
5826 " if (fd == -1) {\n"
5827 " perror(\"fanotify_init\");\n"
5828 " exit(EXIT_FAILURE);\n"
5829 " }\n"
5830 "\\&\n"
5831 " /* Placement d’une marque sur l’objet de système de fichiers fourni dans argv[1]. */\n"
5832 "\\&\n"
5833 " ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
5834 " FAN_CREATE | FAN_ONDIR,\n"
5835 " AT_FDCWD, argv[1]);\n"
5836 " if (ret == -1) {\n"
5837 " perror(\"fanotify_mark\");\n"
5838 " exit(EXIT_FAILURE);\n"
5839 " }\n"
5840 "\\&\n"
5841 " printf(\"Écoute d’évènements.\\[rs]n\");\n"
5842 "\\&\n"
5843 " /* Lecture d’évènements de la file d’évènements d’un tampon. */\n"
5844 "\\&\n"
5845 " len = read(fd, events_buf, sizeof(events_buf));\n"
5846 " if (len == -1 && errno != EAGAIN) {\n"
5847 " perror(\"read\");\n"
5848 " exit(EXIT_FAILURE);\n"
5849 " }\n"
5850 "\\&\n"
5851 " /* Traitement de tous les évènements du tampon. */\n"
5852 "\\&\n"
5853 " for (metadata = (struct fanotify_event_metadata *) events_buf;\n"
5854 " FAN_EVENT_OK(metadata, len);\n"
5855 " metadata = FAN_EVENT_NEXT(metadata, len)) {\n"
5856 " fid = (struct fanotify_event_info_fid *) (metadata + 1);\n"
5857 " file_handle = (struct file_handle *) fid-E<gt>handle;\n"
5858 "\\&\n"
5859 " /* Vérification que l’information d’évènement soit du bon type. */\n"
5860 "\\&\n"
5861 " if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||\n"
5862 " fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {\n"
5863 " file_name = NULL;\n"
5864 " } else if (fid-E<gt>hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {\n"
5865 " file_name = file_handle-E<gt>f_handle +\n"
5866 " file_handle-E<gt>handle_bytes;\n"
5867 " } else {\n"
5868 " fprintf(stderr, \"Type inattendu d’information d’évènement.\\[rs]n\");\n"
5869 " exit(EXIT_FAILURE);\n"
5870 " }\n"
5871 "\\&\n"
5872 " if (metadata-E<gt>mask == FAN_CREATE)\n"
5873 " printf(\"FAN_CREATE (fichier créé :\\[rs]n\");\n"
5874 "\\&\n"
5875 " if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
5876 " printf(\"FAN_CREATE | FAN_ONDIR (sous-répertoire créé) :\\[rs]n\");\n"
5877 "\\&\n"
5878 "\t/* metadata-E<gt>fd est défini à FAN_NOFD quand le groupe identifie\n"
5879 "\t des objets par des gestionnaires de fichier. Pour obtenir un descripteur\n"
5880 "\t de fichier pour l’objet de fichier correspondant à un évènement, la structure\n"
5881 "\t file_handle qui est fournie dans fanotify_event_info_fid peut être utilisée\n"
5882 "\t en conjonction avec l’appel système open_by_handle_at(2). Une vérification\n"
5883 "\t pour ESTALE est faite pour répondre à la situation où le gestionnaire de\n"
5884 "\t l’objet a été supprimé avant cet appel système. */\n"
5885 "\\&\n"
5886 " event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
5887 " if (event_fd == -1) {\n"
5888 " if (errno == ESTALE) {\n"
5889 " printf(\"Gestionnaire de fichier plus valable. \"\n"
5890 " \"Le fichier a été supprimé\\[rs]n\");\n"
5891 " continuation;\n"
5892 " } else {\n"
5893 " perror(\"open_by_handle_at\");\n"
5894 " exit(EXIT_FAILURE);\n"
5895 " }\n"
5896 " }\n"
5897 "\\&\n"
5898 " snprintf(procfd_path, sizeof(procfd_path), \"/proc/self/fd/%d\",\n"
5899 " event_fd);\n"
5900 "\\&\n"
5901 " /* Récupération et affichage du chemin d’entrée de répertoire modifiée. */\n"
5902 "\\&\n"
5903 " path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
5904 " if (path_len == -1) {\n"
5905 " perror(\"readlink\");\n"
5906 " exit(EXIT_FAILURE);\n"
5907 " }\n"
5908 "\\&\n"
5909 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
5910 " printf(\"\\[rs]tRépertoire « %s » a été modifié.\\[rs]n\", chemin);\n"
5911 "\\&\n"
5912 " if (file_name) {\n"
5913 " ret = fstatat(event_fd, file_name, &sb, 0);\n"
5914 " if (ret == -1) {\n"
5915 " if (errno != ENOENT) {\n"
5916 " perror(\"fstatat\");\n"
5917 " exit(EXIT_FAILURE);\n"
5918 " }\n"
5919 " printf(\"\\[rs]tEntée « %s » n’existe pas.\\[rs]n\", fichier);\n"
5920 " } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {\n"
5921 " printf(\"\\[rs]tEntrée « %s » est un sous-répertoire.\\[rs]n\", fichier);\n"
5922 " } else {\n"
5923 " printf(\"\\[rs]tEntrée « %s » n’est pas un répertoire.\\[rs]n\",\n"
5924 " fichier);\n"
5925 " }\n"
5926 " }\n"
5927 "\\&\n"
5928 " /* Fermeture du descripteur de fichier associé à cet évènement. */\n"
5929 "\\&\n"
5930 " close(event_fd);\n"
5931 " }\n"
5932 "\\&\n"
5933 " printf(\"Tous les évènements ont été traités avec succès. Fin du programme.\\[rs]n\");\n"
5934 " exit(EXIT_SUCCESS);\n"
5935 "}\n"
5936
5937 #. type: TH
5938 #: mageia-cauldron
5939 #, no-wrap
5940 msgid "2026-02-08"
5941 msgstr "8 février 2026"
5942
5943 #. type: TH
5944 #: mageia-cauldron
5945 #, no-wrap
5946 msgid "Linux man-pages 6.17"
5947 msgstr "Pages du manuel de Linux 6.17"
5948
5949 #. type: Plain text
5950 #: mageia-cauldron
5951 #, fuzzy, no-wrap
5952 #| msgid ""
5953 #| "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
5954 #| "#include E<lt>errno.hE<gt>\n"
5955 #| "#include E<lt>fcntl.hE<gt>\n"
5956 #| "#include E<lt>limits.hE<gt>\n"
5957 #| "#include E<lt>poll.hE<gt>\n"
5958 #| "#include E<lt>stdio.hE<gt>\n"
5959 #| "#include E<lt>stdlib.hE<gt>\n"
5960 #| "#include E<lt>sys/fanotify.hE<gt>\n"
5961 #| "#include E<lt>unistd.hE<gt>\n"
5962 #| "\\&\n"
5963 #| "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
5964 #| "\\&\n"
5965 #| "static void\n"
5966 #| "handle_events(int fd)\n"
5967 #| "{\n"
5968 #| " const struct fanotify_event_metadata *metadata;\n"
5969 #| " struct fanotify_event_metadata buf[200];\n"
5970 #| " ssize_t len;\n"
5971 #| " char path[PATH_MAX];\n"
5972 #| " ssize_t path_len;\n"
5973 #| " char procfd_path[PATH_MAX];\n"
5974 #| " struct fanotify_response response;\n"
5975 #| "\\&\n"
5976 #| " /* Loop while events can be read from fanotify file descriptor. */\n"
5977 #| "\\&\n"
5978 #| " for (;;) {\n"
5979 #| "\\&\n"
5980 #| " /* Read some events. */\n"
5981 #| "\\&\n"
5982 #| " len = read(fd, buf, sizeof(buf));\n"
5983 #| " if (len == -1 && errno != EAGAIN) {\n"
5984 #| " perror(\"read\");\n"
5985 #| " exit(EXIT_FAILURE);\n"
5986 #| " }\n"
5987 #| "\\&\n"
5988 #| " /* Check if end of available data reached. */\n"
5989 #| "\\&\n"
5990 #| " if (len E<lt>= 0)\n"
5991 #| " break;\n"
5992 #| "\\&\n"
5993 #| " /* Point to the first event in the buffer. */\n"
5994 #| "\\&\n"
5995 #| " metadata = buf;\n"
5996 #| "\\&\n"
5997 #| " /* Loop over all events in the buffer. */\n"
5998 #| "\\&\n"
5999 #| " while (FAN_EVENT_OK(metadata, len)) {\n"
6000 #| "\\&\n"
6001 #| " /* Check that run-time and compile-time structures match. */\n"
6002 #| "\\&\n"
6003 #| " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
6004 #| " fprintf(stderr,\n"
6005 #| " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
6006 #| " exit(EXIT_FAILURE);\n"
6007 #| " }\n"
6008 #| "\\&\n"
6009 #| " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
6010 #| " queue overflow, or a file descriptor (a nonnegative\n"
6011 #| " integer). Here, we simply ignore queue overflow. */\n"
6012 #| "\\&\n"
6013 #| " if (metadata-E<gt>fd E<gt>= 0) {\n"
6014 #| "\\&\n"
6015 #| " /* Handle open permission event. */\n"
6016 #| "\\&\n"
6017 #| " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
6018 #| " printf(\"FAN_OPEN_PERM: \");\n"
6019 #| "\\&\n"
6020 #| " /* Allow file to be opened. */\n"
6021 #| "\\&\n"
6022 #| " response.fd = metadata-E<gt>fd;\n"
6023 #| " response.response = FAN_ALLOW;\n"
6024 #| " write(fd, &response, sizeof(response));\n"
6025 #| " }\n"
6026 #| "\\&\n"
6027 #| " /* Handle closing of writable file event. */\n"
6028 #| "\\&\n"
6029 #| " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
6030 #| " printf(\"FAN_CLOSE_WRITE: \");\n"
6031 #| "\\&\n"
6032 #| " /* Retrieve and print pathname of the accessed file. */\n"
6033 #| "\\&\n"
6034 #| " snprintf(procfd_path, sizeof(procfd_path),\n"
6035 #| " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
6036 #| " path_len = readlink(procfd_path, path,\n"
6037 #| " sizeof(path) - 1);\n"
6038 #| " if (path_len == -1) {\n"
6039 #| " perror(\"readlink\");\n"
6040 #| " exit(EXIT_FAILURE);\n"
6041 #| " }\n"
6042 #| "\\&\n"
6043 #| " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
6044 #| " printf(\"File %s\\[rs]n\", path);\n"
6045 #| "\\&\n"
6046 #| " /* Close the file descriptor of the event. */\n"
6047 #| "\\&\n"
6048 #| " close(metadata-E<gt>fd);\n"
6049 #| " }\n"
6050 #| "\\&\n"
6051 #| " /* Advance to next event. */\n"
6052 #| "\\&\n"
6053 #| " metadata = FAN_EVENT_NEXT(metadata, len);\n"
6054 #| " }\n"
6055 #| " }\n"
6056 #| "}\n"
6057 #| "\\&\n"
6058 #| "int\n"
6059 #| "main(int argc, char *argv[])\n"
6060 #| "{\n"
6061 #| " char buf;\n"
6062 #| " int fd, poll_num;\n"
6063 #| " nfds_t nfds;\n"
6064 #| " struct pollfd fds[2];\n"
6065 #| "\\&\n"
6066 #| " /* Check mount point is supplied. */\n"
6067 #| "\\&\n"
6068 #| " if (argc != 2) {\n"
6069 #| " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
6070 #| " exit(EXIT_FAILURE);\n"
6071 #| " }\n"
6072 #| "\\&\n"
6073 #| " printf(\"Press enter key to terminate.\\[rs]n\");\n"
6074 #| "\\&\n"
6075 #| " /* Create the file descriptor for accessing the fanotify API. */\n"
6076 #| "\\&\n"
6077 #| " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
6078 #| " O_RDONLY | O_LARGEFILE);\n"
6079 #| " if (fd == -1) {\n"
6080 #| " perror(\"fanotify_init\");\n"
6081 #| " exit(EXIT_FAILURE);\n"
6082 #| " }\n"
6083 #| "\\&\n"
6084 #| " /* Mark the mount for:\n"
6085 #| " - permission events before opening files\n"
6086 #| " - notification events after closing a write-enabled\n"
6087 #| " file descriptor. */\n"
6088 #| "\\&\n"
6089 #| " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
6090 #| " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
6091 #| " argv[1]) == -1) {\n"
6092 #| " perror(\"fanotify_mark\");\n"
6093 #| " exit(EXIT_FAILURE);\n"
6094 #| " }\n"
6095 #| "\\&\n"
6096 #| " /* Prepare for polling. */\n"
6097 #| "\\&\n"
6098 #| " nfds = 2;\n"
6099 #| "\\&\n"
6100 #| " fds[0].fd = STDIN_FILENO; /* Console input */\n"
6101 #| " fds[0].events = POLLIN;\n"
6102 #| "\\&\n"
6103 #| " fds[1].fd = fd; /* Fanotify input */\n"
6104 #| " fds[1].events = POLLIN;\n"
6105 #| "\\&\n"
6106 #| " /* This is the loop to wait for incoming events. */\n"
6107 #| "\\&\n"
6108 #| " printf(\"Listening for events.\\[rs]n\");\n"
6109 #| "\\&\n"
6110 #| " while (1) {\n"
6111 #| " poll_num = poll(fds, nfds, -1);\n"
6112 #| " if (poll_num == -1) {\n"
6113 #| " if (errno == EINTR) /* Interrupted by a signal */\n"
6114 #| " continue; /* Restart poll() */\n"
6115 #| "\\&\n"
6116 #| " perror(\"poll\"); /* Unexpected error */\n"
6117 #| " exit(EXIT_FAILURE);\n"
6118 #| " }\n"
6119 #| "\\&\n"
6120 #| " if (poll_num E<gt> 0) {\n"
6121 #| " if (fds[0].revents & POLLIN) {\n"
6122 #| "\\&\n"
6123 #| " /* Console input is available: empty stdin and quit. */\n"
6124 #| "\\&\n"
6125 #| " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
6126 #| " continue;\n"
6127 #| " break;\n"
6128 #| " }\n"
6129 #| "\\&\n"
6130 #| " if (fds[1].revents & POLLIN) {\n"
6131 #| "\\&\n"
6132 #| " /* Fanotify events are available. */\n"
6133 #| "\\&\n"
6134 #| " handle_events(fd);\n"
6135 #| " }\n"
6136 #| " }\n"
6137 #| " }\n"
6138 #| "\\&\n"
6139 #| " printf(\"Listening for events stopped.\\[rs]n\");\n"
6140 #| " exit(EXIT_SUCCESS);\n"
6141 #| "}\n"
6142 msgid ""
6143 "#define _GNU_SOURCE /* Needed to get O_LARGEFILE definition */\n"
6144 "#include E<lt>errno.hE<gt>\n"
6145 "#include E<lt>fcntl.hE<gt>\n"
6146 "#include E<lt>limits.hE<gt>\n"
6147 "#include E<lt>poll.hE<gt>\n"
6148 "#include E<lt>stdio.hE<gt>\n"
6149 "#include E<lt>stdlib.hE<gt>\n"
6150 "#include E<lt>sys/fanotify.hE<gt>\n"
6151 "#include E<lt>unistd.hE<gt>\n"
6152 "\\&\n"
6153 "/* Read all available fanotify events from the file descriptor \\[aq]fd\\[aq]. */\n"
6154 "\\&\n"
6155 "static void\n"
6156 "handle_events(int fd)\n"
6157 "{\n"
6158 " const struct fanotify_event_metadata *metadata;\n"
6159 " struct fanotify_event_metadata buf[200];\n"
6160 " ssize_t size;\n"
6161 " char path[PATH_MAX];\n"
6162 " ssize_t path_len;\n"
6163 " char procfd_path[PATH_MAX];\n"
6164 " struct fanotify_response response;\n"
6165 "\\&\n"
6166 " /* Loop while events can be read from fanotify file descriptor. */\n"
6167 "\\&\n"
6168 " for (;;) {\n"
6169 "\\&\n"
6170 " /* Read some events. */\n"
6171 "\\&\n"
6172 " size = read(fd, buf, sizeof(buf));\n"
6173 " if (size == -1 && errno != EAGAIN) {\n"
6174 " perror(\"read\");\n"
6175 " exit(EXIT_FAILURE);\n"
6176 " }\n"
6177 "\\&\n"
6178 " /* Check if end of available data reached. */\n"
6179 "\\&\n"
6180 " if (size E<lt>= 0)\n"
6181 " break;\n"
6182 "\\&\n"
6183 " /* Point to the first event in the buffer. */\n"
6184 "\\&\n"
6185 " metadata = buf;\n"
6186 "\\&\n"
6187 " /* Loop over all events in the buffer. */\n"
6188 "\\&\n"
6189 " while (FAN_EVENT_OK(metadata, size)) {\n"
6190 "\\&\n"
6191 " /* Check that run-time and compile-time structures match. */\n"
6192 "\\&\n"
6193 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
6194 " fprintf(stderr,\n"
6195 " \"Mismatch of fanotify metadata version.\\[rs]n\");\n"
6196 " exit(EXIT_FAILURE);\n"
6197 " }\n"
6198 "\\&\n"
6199 " /* metadata-E<gt>fd contains either FAN_NOFD, indicating a\n"
6200 " queue overflow, or a file descriptor (a nonnegative\n"
6201 " integer). Here, we simply ignore queue overflow. */\n"
6202 "\\&\n"
6203 " if (metadata-E<gt>fd E<gt>= 0) {\n"
6204 "\\&\n"
6205 " /* Handle open permission event. */\n"
6206 "\\&\n"
6207 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
6208 " printf(\"FAN_OPEN_PERM: \");\n"
6209 "\\&\n"
6210 " /* Allow file to be opened. */\n"
6211 "\\&\n"
6212 " response.fd = metadata-E<gt>fd;\n"
6213 " response.response = FAN_ALLOW;\n"
6214 " write(fd, &response, sizeof(response));\n"
6215 " }\n"
6216 "\\&\n"
6217 " /* Handle closing of writable file event. */\n"
6218 "\\&\n"
6219 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
6220 " printf(\"FAN_CLOSE_WRITE: \");\n"
6221 "\\&\n"
6222 " /* Retrieve and print pathname of the accessed file. */\n"
6223 "\\&\n"
6224 " snprintf(procfd_path, sizeof(procfd_path),\n"
6225 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
6226 " path_len = readlink(procfd_path, path,\n"
6227 " sizeof(path) - 1);\n"
6228 " if (path_len == -1) {\n"
6229 " perror(\"readlink\");\n"
6230 " exit(EXIT_FAILURE);\n"
6231 " }\n"
6232 "\\&\n"
6233 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
6234 " printf(\"File %s\\[rs]n\", path);\n"
6235 "\\&\n"
6236 " /* Close the file descriptor of the event. */\n"
6237 "\\&\n"
6238 " close(metadata-E<gt>fd);\n"
6239 " }\n"
6240 "\\&\n"
6241 " /* Advance to next event. */\n"
6242 "\\&\n"
6243 " metadata = FAN_EVENT_NEXT(metadata, size);\n"
6244 " }\n"
6245 " }\n"
6246 "}\n"
6247 "\\&\n"
6248 "int\n"
6249 "main(int argc, char *argv[])\n"
6250 "{\n"
6251 " char buf;\n"
6252 " int fd, poll_num;\n"
6253 " nfds_t nfds;\n"
6254 " struct pollfd fds[2];\n"
6255 "\\&\n"
6256 " /* Check mount point is supplied. */\n"
6257 "\\&\n"
6258 " if (argc != 2) {\n"
6259 " fprintf(stderr, \"Usage: %s MOUNT\\[rs]n\", argv[0]);\n"
6260 " exit(EXIT_FAILURE);\n"
6261 " }\n"
6262 "\\&\n"
6263 " printf(\"Press enter key to terminate.\\[rs]n\");\n"
6264 "\\&\n"
6265 " /* Create the file descriptor for accessing the fanotify API. */\n"
6266 "\\&\n"
6267 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
6268 " O_RDONLY | O_LARGEFILE);\n"
6269 " if (fd == -1) {\n"
6270 " perror(\"fanotify_init\");\n"
6271 " exit(EXIT_FAILURE);\n"
6272 " }\n"
6273 "\\&\n"
6274 " /* Mark the mount for:\n"
6275 " - permission events before opening files\n"
6276 " - notification events after closing a write-enabled\n"
6277 " file descriptor. */\n"
6278 "\\&\n"
6279 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
6280 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
6281 " argv[1]) == -1) {\n"
6282 " perror(\"fanotify_mark\");\n"
6283 " exit(EXIT_FAILURE);\n"
6284 " }\n"
6285 "\\&\n"
6286 " /* Prepare for polling. */\n"
6287 "\\&\n"
6288 " nfds = 2;\n"
6289 "\\&\n"
6290 " fds[0].fd = STDIN_FILENO; /* Console input */\n"
6291 " fds[0].events = POLLIN;\n"
6292 "\\&\n"
6293 " fds[1].fd = fd; /* Fanotify input */\n"
6294 " fds[1].events = POLLIN;\n"
6295 "\\&\n"
6296 " /* This is the loop to wait for incoming events. */\n"
6297 "\\&\n"
6298 " printf(\"Listening for events.\\[rs]n\");\n"
6299 "\\&\n"
6300 " while (1) {\n"
6301 " poll_num = poll(fds, nfds, -1);\n"
6302 " if (poll_num == -1) {\n"
6303 " if (errno == EINTR) /* Interrupted by a signal */\n"
6304 " continue; /* Restart poll() */\n"
6305 "\\&\n"
6306 " perror(\"poll\"); /* Unexpected error */\n"
6307 " exit(EXIT_FAILURE);\n"
6308 " }\n"
6309 "\\&\n"
6310 " if (poll_num E<gt> 0) {\n"
6311 " if (fds[0].revents & POLLIN) {\n"
6312 "\\&\n"
6313 " /* Console input is available: empty stdin and quit. */\n"
6314 "\\&\n"
6315 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
6316 " continue;\n"
6317 " break;\n"
6318 " }\n"
6319 "\\&\n"
6320 " if (fds[1].revents & POLLIN) {\n"
6321 "\\&\n"
6322 " /* Fanotify events are available. */\n"
6323 "\\&\n"
6324 " handle_events(fd);\n"
6325 " }\n"
6326 " }\n"
6327 " }\n"
6328 "\\&\n"
6329 " printf(\"Listening for events stopped.\\[rs]n\");\n"
6330 " exit(EXIT_SUCCESS);\n"
6331 "}\n"
6332 msgstr ""
6333 "#define _GNU_SOURCE /* Nécessaire pour obtenir la définition de O_LARGEFILE */\n"
6334 "#include E<lt>errno.hE<gt>\n"
6335 "#include E<lt>fcntl.hE<gt>\n"
6336 "#include E<lt>limits.hE<gt>\n"
6337 "#include E<lt>poll.hE<gt>\n"
6338 "#include E<lt>stdio.hE<gt>\n"
6339 "#include E<lt>stdlib.hE<gt>\n"
6340 "#include E<lt>sys/fanotify.hE<gt>\n"
6341 "#include E<lt>unistd.hE<gt>\n"
6342 "\\&\n"
6343 "/* Lire tous les évènements fanotify disponibles du descripteur de fichier « fd ». */\n"
6344 "\\&\n"
6345 "static void\n"
6346 "handle_events(int fd)\n"
6347 "{\n"
6348 " const struct fanotify_event_metadata *metadata;\n"
6349 " struct fanotify_event_metadata buf[200];\n"
6350 " ssize_t len;\n"
6351 " char path[PATH_MAX];\n"
6352 " ssize_t path_len;\n"
6353 " char procfd_path[PATH_MAX];\n"
6354 " struct fanotify_response response;\n"
6355 "\\&\n"
6356 " /* Bouclage tant que des évènements peuvent être lus du descripteur de fichier. */\n"
6357 "\\&\n"
6358 " for (;;) {\n"
6359 "\\&\n"
6360 " /* Lecture de quelques évènements. */\n"
6361 "\\&\n"
6362 " len = read(fd, buf, sizeof(buf));\n"
6363 " if (len == -1 && errno != EAGAIN) {\n"
6364 " perror(\"read\");\n"
6365 " exit(EXIT_FAILURE);\n"
6366 " }\n"
6367 "\\&\n"
6368 " /* Vérification que la fin des données disponibles soit atteinte. */\n"
6369 "\\&\n"
6370 " if (len E<lt>= 0)\n"
6371 " break;\n"
6372 "\\&\n"
6373 " /* Pointage vers le premier évènement dans le tampon. */\n"
6374 "\\&\n"
6375 " metadata = buf;\n"
6376 "\\&\n"
6377 " /* Bouclage sur tous les évènements du tampon. */\n"
6378 "\\&\n"
6379 " while (FAN_EVENT_OK(metadata, len)) {\n"
6380 "\\&\n"
6381 " /* Vérification que les structures d’exécution et de compilation correspondent. */\n"
6382 "\\&\n"
6383 " if (metadata-E<gt>vers != FANOTIFY_METADATA_VERSION) {\n"
6384 " fprintf(stderr,\n"
6385 " \"Mauvaise correspondance des versions de métadonnées de fanotify.\\[rs]en\");\n"
6386 " exit(EXIT_FAILURE);\n"
6387 " }\n"
6388 "\\&\n"
6389 " /* metadata-E<gt>fd contient soit FAN_NOFD, indiquant un\n"
6390 " débordement de file ou un descripteur de fichier (un entier\n"
6391 " non négatif). Ici, le débordement est simplement ignoré. */\n"
6392 "\\&\n"
6393 " if (metadata-E<gt>fd E<gt>= 0) {\n"
6394 "\\&\n"
6395 " /* Gestion de la permission d’ouvrir. */\n"
6396 "\\&\n"
6397 " if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
6398 " printf(\"FAN_OPEN_PERM: \");\n"
6399 "\\&\n"
6400 " /* Autorisation d’ouvrir le fichier. */\n"
6401 "\\&\n"
6402 " response.fd = metadata-E<gt>fd;\n"
6403 " response.response = FAN_ALLOW;\n"
6404 " write(fd, &response, sizeof(response));\n"
6405 " }\n"
6406 "\\&\n"
6407 " /* Gestion de la fermeture d’évènement de fichier éditable. */\n"
6408 "\\&\n"
6409 " if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
6410 " printf(\"FAN_CLOSE_WRITE: \");\n"
6411 "\\&\n"
6412 " /* Récupération et affichage du chemin du fichier accédé. */\n"
6413 "\\&\n"
6414 " snprintf(procfd_path, sizeof(procfd_path),\n"
6415 " \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
6416 " path_len = readlink(procfd_path, path,\n"
6417 " sizeof(path) - 1);\n"
6418 " if (path_len == -1) {\n"
6419 " perror(\"readlink\");\n"
6420 " exit(EXIT_FAILURE);\n"
6421 " }\n"
6422 "\\&\n"
6423 " path[path_len] = \\[aq]\\[rs]0\\[aq];\n"
6424 " printf(\"File %s\\[rs]n\", path);\n"
6425 "\\&\n"
6426 " /* Fermeture du descripteur de fichier de l’évènement. */\n"
6427 "\\&\n"
6428 " close(metadata-E<gt>fd);\n"
6429 " }\n"
6430 "\\&\n"
6431 " /* Avance jusqu’au prochain évènement. */\n"
6432 "\\&\n"
6433 " metadata = FAN_EVENT_NEXT(metadata, len);\n"
6434 " }\n"
6435 " }\n"
6436 "}\n"
6437 "\\&\n"
6438 "int\n"
6439 "main(int argc, char *argv[])\n"
6440 "{\n"
6441 " char buf;\n"
6442 " int fd, poll_num;\n"
6443 " nfds_t nfds;\n"
6444 " struct pollfd fds[2];\n"
6445 "\\&\n"
6446 " /* Vérification que le point de montage soit fourni. */\n"
6447 "\\&\n"
6448 " if (argc != 2) {\n"
6449 " fprintf(stderr, \"Utilisation : %s MOUNT\\[rs]n\", argv[0]);\n"
6450 " exit(EXIT_FAILURE);\n"
6451 " }\n"
6452 "\\&\n"
6453 " printf(\"Presser la touche Entrée pour terminer.\\[rs]n\");\n"
6454 "\\&\n"
6455 " /* Création d’un descripteur de fichier pour accéder à l’API de fanotify. */\n"
6456 "\\&\n"
6457 " fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,\n"
6458 " O_RDONLY | O_LARGEFILE);\n"
6459 " if (fd == -1) {\n"
6460 " perror(\"fanotify_init\");\n"
6461 " exit(EXIT_FAILURE);\n"
6462 " }\n"
6463 "\\&\n"
6464 " /* Marque du montage pour :\n"
6465 " – évènements de permission avant ouvertures de fichier\n"
6466 " – évènements de notification après la fermeture\n"
6467 " d’un descripteur de fichier éditable. */\n"
6468 "\\&\n"
6469 " if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
6470 " FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
6471 " argv[1]) == -1) {\n"
6472 " perror(\"fanotify_mark\");\n"
6473 " exit(EXIT_FAILURE);\n"
6474 " }\n"
6475 "\\&\n"
6476 " /* Préparation pour sondage. */\n"
6477 "\\&\n"
6478 " nfds = 2;\n"
6479 "\\&\n"
6480 " fds[0].fd = STDIN_FILENO; /* Entrée de console */\n"
6481 " fds[0].events = POLLIN;\n"
6482 "\\&\n"
6483 " fds[1].fd = fd; /* Entrée de fanotify */\n"
6484 " fds[1].events = POLLIN;\n"
6485 "\\&\n"
6486 " /* Ceci est une boucle pour attendre de futurs évènements. */\n"
6487 "\\&\n"
6488 " printf(\"Écoute d’évènements.\\[rs]n\");\n"
6489 "\\&\n"
6490 " while (1) {\n"
6491 " poll_num = poll(fds, nfds, -1);\n"
6492 " if (poll_num == -1) {\n"
6493 " if (errno == EINTR) /* Interruption par un signal */\n"
6494 " continue; /* Redémarrage de poll() */\n"
6495 "\\&\n"
6496 " perror(\"poll\"); /* Erreur inattendue */\n"
6497 " exit(EXIT_FAILURE);\n"
6498 " }\n"
6499 "\\&\n"
6500 " if (poll_num E<gt> 0) {\n"
6501 " if (fds[0].revents & POLLIN) {\n"
6502 "\\&\n"
6503 " /* Entrée de console disponible : stdin vide et quitter. */\n"
6504 "\\&\n"
6505 " while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\[aq]\\[rs]n\\[aq])\n"
6506 " continue;\n"
6507 " break;\n"
6508 " }\n"
6509 "\\&\n"
6510 " if (fds[1].revents & POLLIN) {\n"
6511 "\\&\n"
6512 " /* Évènements de fanotify disponibles. */\n"
6513 "\\&\n"
6514 " handle_events(fd);\n"
6515 " }\n"
6516 " }\n"
6517 " }\n"
6518 "\\&\n"
6519 " printf(\"Écoute d’évènements arrêtée.\\[rs]n\");\n"
6520 " exit(EXIT_SUCCESS);\n"
6521 "}\n"
6522
6523 #. type: TH
6524 #: opensuse-leap-16-1 opensuse-tumbleweed
6525 #, no-wrap
6526 msgid "Linux man-pages (unreleased)"
6527 msgstr "Pages du manuel de Linux (non publiées)"