summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sys/inotify.rs8
-rw-r--r--src/sys/socket/mod.rs2
2 files changed, 8 insertions, 2 deletions
diff --git a/src/sys/inotify.rs b/src/sys/inotify.rs
index 2398c16e..e5fe930f 100644
--- a/src/sys/inotify.rs
+++ b/src/sys/inotify.rs
@@ -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! {
@@ -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()
+ }
+}
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs
index ab7495ed..a953059b 100644
--- a/src/sys/socket/mod.rs
+++ b/src/sys/socket/mod.rs
@@ -220,7 +220,7 @@ pub enum SockProtocol {
// The protocol number is fed into the socket syscall in network byte order.
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
- EthAll = libc::ETH_P_ALL.to_be(),
+ EthAll = (libc::ETH_P_ALL as u16).to_be() as i32,
/// The Controller Area Network raw socket protocol
/// ([ref](https://docs.kernel.org/networking/can.html#how-to-use-socketcan))
#[cfg(target_os = "linux")]