1 .\" Copyright (C) 2013, Heinrich Schuchardt <xypron.glpk@gmx.de>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of
9 .\" this manual under the conditions for verbatim copying, provided that
10 .\" the entire resulting derived work is distributed under the terms of
11 .\" a permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume.
15 .\" no responsibility for errors or omissions, or for damages resulting.
16 .\" from the use of the information contained herein. The author(s) may.
17 .\" not have taken the same level of care in the production of this.
18 .\" manual, which is licensed free of charge, as they might when working.
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .TH FANOTIFY_MARK 2 2014-04-24 "Linux" "Linux Programmer's Manual"
26 fanotify_mark \- add, remove, or modify an fanotify mark on a filesystem
30 .B #include <sys/fanotify.h>
32 .BI "int fanotify_mark(int " fanotify_fd ", unsigned int " flags ,
33 .BI " uint64_t " mask ", int " dirfd \
34 ", const char *" pathname );
37 For an overview of the fanotify API, see
41 adds, removes, or modifies an fanotify mark on a filesystem object.
42 The caller must have read permission on the filesystem object that is to be
47 argument is a file descriptor returned by
48 .BR fanotify_init (2).
51 is a bit mask describing the modification to perform.
52 It must include exactly one of the following values:
57 will be added to the mark mask (or to the ignore mask).
59 must be nonempty or the error
64 The events in argument
66 will be removed from the mark mask (or from the ignore mask).
68 must be nonempty or the error
73 Remove either all mount or non-mount marks from the fanotify group.
78 all marks for mounts are removed from the group.
79 Otherwise, all marks for directories and files are removed.
82 can be used in conjunction with
87 If none of the values above is specified, or more than one is specified, the
88 call fails with the error
93 may contain zero or more of the following:
95 .B FAN_MARK_DONT_FOLLOW
98 is a symbolic link, mark the link itself, rather than the file to which it
104 if it is a symbolic link.)
107 If the filesystem object to be marked is not a directory, the error
112 Mark the mount point specified by
116 is not itself a mount point, the mount point containing
119 All directories, subdirectories, and the contained files of the mount point
122 .B FAN_MARK_IGNORED_MASK
125 shall be added to or removed from the ignore mask.
127 .B FAN_MARK_IGNORED_SURV_MODIFY
128 The ignore mask shall survive modify events.
129 If this flag is not set, the ignore mask is cleared when a modify event occurs
130 for the ignored file or directory.
133 defines which events shall be listened to (or which shall be ignored).
134 It is a bit mask composed of the following values:
137 Create an event when a file or directory (but see BUGS) is accessed (read).
140 Create an event when a file is modified (write).
143 Create an event when a writable file is closed.
146 Create an event when a read-only file or directory is closed.
149 Create an event when a file or directory is opened.
152 Create an event when a permission to open a file or directory is requested.
153 An fanotify file descriptor created with
154 .B FAN_CLASS_PRE_CONTENT
160 Create an event when a permission to read a file or directory is requested.
161 An fanotify file descriptor created with
162 .B FAN_CLASS_PRE_CONTENT
168 Events for directories shall be created, for example when
174 Without this flag, only events for files are created.
176 .B FAN_EVENT_ON_CHILD
177 Events for the immediate children of marked directories shall be created.
178 The flag has no effect when marking mounts.
179 Note that events are not generated for children of the subdirectories
180 of marked directories.
181 To monitor complete directory trees it is necessary to mark the relevant
184 The following composed value is defined:
188 .RB ( FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE ).
190 The filesystem object to be marked is determined by the file descriptor
192 and the pathname specified in
199 defines the filesystem object to be marked.
205 takes the special value
207 the current working directory is to be marked.
211 is absolute, it defines the filesystem object to be marked, and
219 does not have the value
221 then the filesystem object to be marked is determined by interpreting
223 relative the directory referred to by
232 then the filesystem object to be marked is determined by interpreting
234 relative the current working directory.
239 On error, \-1 is returned, and
241 is set to indicate the error.
245 An invalid file descriptor was passed in
249 An invalid value was passed in
255 was not an fanotify file descriptor.
258 The fanotify file descriptor was opened with
260 and mask contains a flag for permission events
263 .BR FAN_ACCESS_PERM ).
266 The filesystem object indicated by
271 This error also occurs when trying to remove a mark from an object which is not
275 The necessary memory could not be allocated.
278 The number of marks exceeds the limit of 8192 and
279 .B FAN_UNLIMITED_MARKS
280 was not specified in the call to
281 .BR fanotify_init (2).
284 This kernel does not implement
285 .BR fanotify_mark ().
286 To make the fanotify API available,
288 has to be enabled in the Linux configuration.
293 .BR FAN_MARK_ONLYDIR ,
298 do not specify a directory.
301 was introduced in version 2.6.36 of the Linux kernel and enabled in version
304 This system call is Linux-specific.
307 the following bugs exist:
309 .\" FIXME: Patch is in next-20140424.
317 must indicate a filesystem object, even though this object is not used.
319 .\" FIXME: Patch is in next-20140424.
325 .\" FIXME: Patch proposed.
327 .BR fanotify_mark (2)
331 is not checked for invalid values.
333 .BR fanotify_init (2),