13个版本
| 0.2.1 | 2023年11月29日 | 
|---|---|
| 0.2.0 | 2023年4月20日 | 
| 0.1.1 | 2023年4月2日 | 
| 0.1.0 |  | 
| 0.0.5 | 2023年2月28日 | 
#1665 in 文件系统
每月27次下载
67KB
698 行
📁 Naughtyfy
现代fanotify包装器。
为任何功能/错误提交问题。
示例
use naughtyfy::api::*;
use naughtyfy::flags::*;
fn main() {
    unsafe {
        // Use carefully in multi thread.
        FAN_EVENT_BUFFER_LEN = 230.into();
    }
    // Initialise fanotify
    let fd = &init(FAN_CLASS_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 = 1;
    loop {
        let res = read(fd).unwrap();
        println!("{res:#?}");
        res.iter().for_each(|e| close(e.fd).unwrap());
        iter += 1;
        if iter > 100 {
            break;
        }
    }
}
文档
目标
- 安全
- 更少的开销
- 已记录
- 描述性错误
- 仅有一个依赖项(libc)
- 并且,当然,速度快。
待办事项
- 添加更多示例
- 可能需要高级API?