A modern fanotify wrapper.
Note: This is still under development.
Feel free to open issues on the repo.
```rust use naughtyfy::api::; use naughtyfy::flags::;
fn main() { unsafe { // Use carefully in multi thread. FANEVENTBUFFERLEN = 230; } // Initialise fanotify let fd = init(FANCLASS_NOTIF, 0).unwrap();
// Mark file descriptor for events
mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_ACCESS, AT_FDCWD, "/").unwrap();
// Try extracting events from the buffer and print it
let mut iter = 10;
loop {
let res = read(fd).unwrap();
println!("{res:#?}");
res.iter().for_each(|e| close(e.fd).unwrap());
iter += 1;
if iter > 10 {
break;
}
}
close(fd).unwrap();
} ```
Even though it's not designed to be blazzingly fast but is comparable. Will get better with further updates.