naughtyfy/lib.rs
1//! Linux file system monitoring library that uses
2//! [fanotify](https://man7.org/linux/man-pages/man7/fanotify.7.html)
3//! underneath.
4//!
5//! # Installation
6//! Run the command in project root directory
7//! ```bash
8//! cargo add naughtyfy
9//! ```
10//! Or manually add it to `Cargo.toml`
11//! ```toml
12//! [dependencies]
13//! naughtyfy = "*"
14//! ```
15//! # Example
16//! ```rust
17//! # use naughtyfy::flags::*;
18//! # use naughtyfy::types::*;
19//! # use naughtyfy::api::*;
20//! let fd = &init(FAN_CLOEXEC | FAN_CLASS_CONTENT ,
21//! O_RDONLY | O_LARGEFILE);
22//! match fd {
23//! Ok(fd) => {
24//! let m = mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_ACCESS, AT_FDCWD, "./");
25//! let events = read(fd).unwrap();
26//! for event in events {
27//! println!("{:#?}",event);
28//! close(event.fd);
29//! }
30//! }
31//! Err(e) => {
32//! // This can fail for multiple reason, most common being privileges.
33//! eprintln!("Cannot get fd due to {e}");
34//! }
35//! }
36//! ```
37
38pub mod api;
39pub mod errors;
40pub mod flags;
41pub mod types;