1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/// Error codes associated to fanotify, fanotify_init(), fanotify_mark() and read()
/// EINVAL An invalid value was passed in flags or event_f_flags.
/// FAN_ALL_INIT_FLAGS (deprecated since Linux kernel version
/// 4.20) defines all allowable bits for flags.
///
/// EMFILE The number of fanotify groups for this user exceeds 128.
///
/// EMFILE The per-process limit on the number of open file
/// descriptors has been reached.
///
/// ENOMEM The allocation of memory for the notification group
/// failed.
///
/// ENOSYS This kernel does not implement fanotify_init(). The
/// fanotify API is available only if the kernel was
/// configured with CONFIG_FANOTIFY.
///
/// EPERM The operation is not permitted because the caller lacks
/// the CAP_SYS_ADMIN capability.
///
/// Error codes associated to fanotify_mark()
///
/// EBADF An invalid file descriptor was passed in fanotify_fd.
///
/// EBADF pathname is relative but dirfd is neither AT_FDCWD nor a
/// valid file descriptor.
///
/// EINVAL An invalid value was passed in flags or mask, or
/// fanotify_fd was not an fanotify file descriptor.
///
/// EINVAL The fanotify file descriptor was opened with
/// FAN_CLASS_NOTIF or the fanotify group identifies
/// filesystem objects by file handles and mask contains a
/// flag for permission events (FAN_OPEN_PERM or
/// FAN_ACCESS_PERM).
///
/// ENODEV The filesystem object indicated by pathname is not
/// associated with a filesystem that supports fsid (e.g.,
/// tmpfs(5)). This error can be returned only with an
/// fanotify group that identifies filesystem objects by file
/// handles.
///
/// ENOENT The filesystem object indicated by dirfd and pathname does
/// not exist. This error also occurs when trying to remove a
/// mark from an object which is not marked.
///
/// ENOMEM The necessary memory could not be allocated.
///
/// ENOSPC The number of marks exceeds the limit of 8192 and the
/// FAN_UNLIMITED_MARKS flag was not specified when the
/// fanotify file descriptor was created with
/// fanotify_init(2).
///
/// ENOSYS This kernel does not implement fanotify_mark(). The
/// fanotify API is available only if the kernel was
/// configured with CONFIG_FANOTIFY.
///
/// ENOTDIR
/// flags contains FAN_MARK_ONLYDIR, and dirfd and pathname do
/// not specify a directory.
///
/// EOPNOTSUPP
/// The object indicated by pathname is associated with a
/// filesystem that does not support the encoding of file
/// handles. This error can be returned only with an fanotify
/// group that identifies filesystem objects by file handles.
///
/// EXDEV The filesystem object indicated by pathname resides within
/// a filesystem subvolume (e.g., btrfs(5)) which uses a
/// different fsid than its root superblock. This error can
/// be returned only with an fanotify group that identifies
/// filesystem objects by file handles.
///
use fmt;