Skip to content

Commit

Permalink
Added a second version of the rm_watch function to deal with android.
Browse files Browse the repository at this point in the history
  • Loading branch information
vdagonneau committed Feb 19, 2019
1 parent aef2227 commit c49e483
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sys/inotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,20 @@ impl Inotify {
/// Returns an EINVAL error if the watch descriptor is invalid.
///
/// For more information see, [inotify_rm_watch(2)](http://man7.org/linux/man-pages/man2/inotify_rm_watch.2.html).
#[cfg(target_os = "linux")]
pub fn rm_watch(&self, wd: WatchDescriptor) -> Result<()> {
let res = unsafe { libc::inotify_rm_watch(self.fd, wd.wd) };

Errno::result(res).map(drop)
}

#[cfg(target_os = "android")]
pub fn rm_watch(&self, wd: WatchDescriptor) -> Result<()> {
let res = unsafe { libc::inotify_rm_watch(self.fd, wd.wd as u32) };

Errno::result(res).map(drop)
}

/// Reads a collection of events from the inotify file descriptor. This call
/// can either be blocking or non blocking depending on whether IN_NONBLOCK
/// was set at initialization.
Expand Down

0 comments on commit c49e483

Please sign in to comment.