Skip to content

Commit b1e0a1c

Browse files
Upgrade nix to v0.27
1 parent 69365ed commit b1e0a1c

File tree

3 files changed

+78
-102
lines changed

3 files changed

+78
-102
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ categories = ["hardware-support"]
1616

1717
[target."cfg(unix)".dependencies]
1818
bitflags = "2.4.0"
19-
nix = { version = "0.26", default-features = false, features = ["fs", "ioctl", "poll", "signal", "term"] }
19+
nix = { version = "0.27", default-features = false, features = ["fs", "ioctl", "poll", "signal", "term"] }
2020

2121
[target.'cfg(all(target_os = "linux", not(target_env = "musl")))'.dependencies]
2222
libudev = { version = "0.3.0", optional = true }

src/posix/poll.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(non_camel_case_types, dead_code)]
22

33
use std::io;
4-
use std::os::unix::io::RawFd;
4+
use std::os::fd::AsFd;
55
use std::slice;
66
use std::time::Duration;
77

@@ -12,18 +12,19 @@ use nix::sys::signal::SigSet;
1212
#[cfg(any(target_os = "linux", test))]
1313
use nix::sys::time::TimeSpec;
1414

15-
pub fn wait_read_fd(fd: RawFd, timeout: Duration) -> io::Result<()> {
16-
wait_fd(fd, PollFlags::POLLIN, timeout)
15+
pub fn wait_read_fd<Fd: AsFd>(fd: Fd, timeout: Duration) -> io::Result<()> {
16+
wait_fd(fd.as_fd(), PollFlags::POLLIN, timeout)
1717
}
1818

19-
pub fn wait_write_fd(fd: RawFd, timeout: Duration) -> io::Result<()> {
20-
wait_fd(fd, PollFlags::POLLOUT, timeout)
19+
pub fn wait_write_fd<Fd: AsFd>(fd: Fd, timeout: Duration) -> io::Result<()> {
20+
wait_fd(fd.as_fd(), PollFlags::POLLOUT, timeout)
2121
}
2222

23-
fn wait_fd(fd: RawFd, events: PollFlags, timeout: Duration) -> io::Result<()> {
23+
fn wait_fd<Fd: AsFd>(fd: Fd, events: PollFlags, timeout: Duration) -> io::Result<()> {
2424
use nix::errno::Errno::{EIO, EPIPE};
2525

26-
let mut fd = PollFd::new(fd, events);
26+
let fd = fd.as_fd();
27+
let mut fd = PollFd::new(&fd, events);
2728

2829
let wait = match poll_clamped(&mut fd, timeout) {
2930
Ok(r) => r,

0 commit comments

Comments
 (0)