devela::_dep::nc::call

Function inotify_add_watch

pub unsafe fn inotify_add_watch<P>(
    fd: i32,
    filename: P,
    mask: u32,
) -> Result<i32, i32> 
where P: AsRef<Path>,
Available on crate feature dep_nc only.
Expand description

Add a watch to an initialized inotify instance.

§Examples

let ret = unsafe { nc::inotify_init1(nc::IN_NONBLOCK | nc::IN_CLOEXEC) };
assert!(ret.is_ok());
let fd = ret.unwrap();

let path = "/etc/passwd";
let ret = unsafe { nc::inotify_add_watch(fd, path, nc::IN_MODIFY) };
assert!(ret.is_ok());
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());