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

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 value AT_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, "./");