Function nc::inotify_add_watch
source · pub unsafe fn inotify_add_watch<P: AsRef<Path>>(
fd: i32,
filename: P,
mask: u32
) -> Result<i32, Errno>
Expand description
Add a watch to an initialized inotify instance.
§Example
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());