diff --git a/changelog/2718.added.md b/changelog/2718.added.md new file mode 100644 index 0000000000..8c80e804e7 --- /dev/null +++ b/changelog/2718.added.md @@ -0,0 +1 @@ +Add WatchDescriptor::inner_id, to get libc id of WatchDescriptor. diff --git a/src/sys/inotify.rs b/src/sys/inotify.rs index 3a00ea0d1d..4e8769eead 100644 --- a/src/sys/inotify.rs +++ b/src/sys/inotify.rs @@ -113,6 +113,12 @@ pub struct Inotify { pub struct WatchDescriptor { wd: i32, } +impl WatchDescriptor { + /// Inner WatchDescriptor, from libc. + pub fn inner_id(self) -> i32 { + self.wd + } +} /// A single inotify event. /// @@ -270,4 +276,4 @@ impl From for OwnedFd { fn from(value: Inotify) -> Self { value.fd } -} \ No newline at end of file +}