Skip to content

Commit b4b7679

Browse files
werdahiasMatthias Geiger
andauthored
Port to nix 0.29 (#109)
Co-authored-by: Matthias Geiger <werdahias@debian.org>
1 parent b70fd54 commit b4b7679

File tree

3 files changed

+12
-31
lines changed

3 files changed

+12
-31
lines changed

Cargo.lock

Lines changed: 5 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ input = "0.8"
3737
libc = "0.2.147"
3838
evdev-rs = "0.6.1"
3939
async-std = "1.12.0"
40-
nix = "0.26.2"
40+
nix = { version = "0.29", features = ["poll"] }
4141
blight = "0.7.0"
4242
anyhow = "1.0.75"
4343
thiserror = "1.0.49"

src/input-backend/main.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use libc::{O_RDONLY, O_RDWR};
1111
use nix::poll::{poll, PollFd, PollFlags};
1212
use std::fs::{File, OpenOptions};
1313
use std::os::fd::AsRawFd;
14+
use std::os::fd::BorrowedFd;
1415
use std::os::unix::{fs::OpenOptionsExt, io::OwnedFd};
1516
use std::path::Path;
1617
use std::time::Duration;
@@ -57,9 +58,11 @@ fn main() -> Result<(), zbus::Error> {
5758
input
5859
.udev_assign_seat("seat0")
5960
.expect("Could not assign seat0");
60-
61-
let pollfd = PollFd::new(input.as_raw_fd(), PollFlags::POLLIN);
62-
while poll(&mut [pollfd], -1).is_ok() {
61+
let fd = input.as_raw_fd();
62+
assert!(fd != -1);
63+
let borrowed_fd = unsafe { BorrowedFd::borrow_raw(input.as_raw_fd()) };
64+
let pollfd = PollFd::new(borrowed_fd, PollFlags::POLLIN);
65+
while poll(&mut [pollfd], None::<u8>).is_ok() {
6366
event(&mut input, &iface_ref);
6467
}
6568

0 commit comments

Comments
 (0)