Skip to content

Commit

Permalink
inotify: Add AsFd to allow using with epoll (issue #1998)
Browse files Browse the repository at this point in the history
  • Loading branch information
VorpalBlade committed Feb 19, 2023
1 parent 1a838c7 commit 7830042
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sys/inotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use libc::{c_char, c_int};
use std::ffi::{CStr, OsStr, OsString};
use std::mem::{size_of, MaybeUninit};
use std::os::unix::ffi::OsStrExt;
use std::os::unix::io::{AsRawFd, FromRawFd, OwnedFd, RawFd};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, OwnedFd, RawFd};
use std::ptr;

libc_bitflags! {
Expand Down Expand Up @@ -240,3 +240,9 @@ impl FromRawFd for Inotify {
Inotify { fd: OwnedFd::from_raw_fd(fd) }
}
}

impl AsFd for Inotify {
fn as_fd(&'_ self) -> BorrowedFd<'_> {
self.fd.as_fd()
}
}

0 comments on commit 7830042

Please sign in to comment.