Skip to content

Commit c49e483

Browse files
committed
Added a second version of the rm_watch function to deal with android.
1 parent aef2227 commit c49e483

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/sys/inotify.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,20 @@ impl Inotify {
152152
/// Returns an EINVAL error if the watch descriptor is invalid.
153153
///
154154
/// For more information see, [inotify_rm_watch(2)](http://man7.org/linux/man-pages/man2/inotify_rm_watch.2.html).
155+
#[cfg(target_os = "linux")]
155156
pub fn rm_watch(&self, wd: WatchDescriptor) -> Result<()> {
156157
let res = unsafe { libc::inotify_rm_watch(self.fd, wd.wd) };
157158

158159
Errno::result(res).map(drop)
159160
}
160161

162+
#[cfg(target_os = "android")]
163+
pub fn rm_watch(&self, wd: WatchDescriptor) -> Result<()> {
164+
let res = unsafe { libc::inotify_rm_watch(self.fd, wd.wd as u32) };
165+
166+
Errno::result(res).map(drop)
167+
}
168+
161169
/// Reads a collection of events from the inotify file descriptor. This call
162170
/// can either be blocking or non blocking depending on whether IN_NONBLOCK
163171
/// was set at initialization.

0 commit comments

Comments
 (0)