Function naughtyfy::api::fanotify_mark
source · pub fn fanotify_mark<P: ?Sized + Path>(
fanotify_fd: i32,
flags: u32,
mask: u64,
dirfd: i32,
path: &P
) -> Result<(), Error>Expand description
Adds, removes, or modifies an fanotify mark on a filesystem object. The caller must have read permission on the filesystem object that is to be marked.
Arguments
-
fanotify_fd- File descriptor returned byfanotify_init(). -
flags- Bit mask describing the modification to perform.
It must include exactly one of the following values:In addition, zero or more of the following values may be ORed into flags:
-
mask- Which events shall be listened for (or which shall be ignored).
It is a bit mask composed of the following values: -
dirfd- Defines the filesystem object to be marked. -
path- Filesystem path of file or diretory.
The filesystem object to be marked is determined by the file descriptor dirfd and the pathname specified in path:
- If pathname is
NULL, dirfd defines the filesystem object to be marked. - If pathname is
NULL, and dirfd takes the special valueAT_FDCWD, the current working directory is to be marked. - If pathname is absolute, it defines the filesystem object to be marked, and dirfd is ignored.
- If pathname is relative, and dirfd does not have the value
AT_FDCWD, then the filesystem object to be marked is determined by interpreting pathname relative the directory referred to by dirfd. - If pathname is relative, and dirfd has the value
AT_FDCWD, then the filesystem object to be marked is determined by interpreting pathname relative to the current working directory.
Example
This example will panic due to absence of CAP_SYS_ADMIN capabilitity
let fd = fanotify_init(FAN_CLASS_NOTIF, 0).unwrap();
fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_ACCESS, libc::AT_FDCWD, "./");