Skip to content

Commit 1b29df1

Browse files
committed
update nix and remove old-style macro invocations
1 parent 11a061e commit 1b29df1

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ readme = "README.md"
1111
[dependencies]
1212
bitflags = "1.0"
1313
libc = "0.2.65"
14-
nix = "0.13"
14+
nix = "0.17"
1515
thiserror = "1.0.4"
1616
userfaultfd-sys = { path = "userfaultfd-sys", version = "0.1.1-dev" }

examples/manpage.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Port of the example from the `userfaultfd` manpage.
22
use libc::{self, c_void};
3-
use nix::poll::{poll, EventFlags, PollFd};
3+
use nix::poll::{poll, PollFd, PollFlags};
44
use nix::sys::mman::{mmap, MapFlags, ProtFlags};
55
use nix::unistd::{sysconf, SysconfVar};
66
use std::env;
@@ -31,16 +31,16 @@ fn fault_handler_thread(uffd: Uffd) {
3131
loop {
3232
// See what poll() tells us about the userfaultfd
3333

34-
let pollfd = PollFd::new(uffd.as_raw_fd(), EventFlags::POLLIN);
34+
let pollfd = PollFd::new(uffd.as_raw_fd(), PollFlags::POLLIN);
3535
let nready = poll(&mut [pollfd], -1).expect("poll");
3636

3737
println!("\nfault_handler_thread():");
3838
let revents = pollfd.revents().unwrap();
3939
println!(
4040
" poll() returns: nready = {}; POLLIN = {}; POLLERR = {}",
4141
nready,
42-
revents.contains(EventFlags::POLLIN),
43-
revents.contains(EventFlags::POLLERR),
42+
revents.contains(PollFlags::POLLIN),
43+
revents.contains(PollFlags::POLLERR),
4444
);
4545

4646
// Read an event from the userfaultfd

linux-version/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "Package for detecting the version of the linux kernel a program i
99
build = "build.rs"
1010

1111
[dependencies]
12-
nix = "0.13"
12+
nix = "0.17"
1313
semver = "0.9"
1414

1515
[build-dependencies]

src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
//! [`ioctl_userfaultfd(2)`](http://man7.org/linux/man-pages/man2/ioctl_userfaultfd.2.html) for more
88
//! details.
99
10-
// TODO: convert this to 2018-style import once `nix` exports its macros cleanly
11-
#[macro_use]
12-
extern crate nix;
13-
1410
mod builder;
1511
mod error;
1612
mod event;

src/raw.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ pub unsafe fn userfaultfd(flags: c_int) -> c_int {
1010
}
1111
}
1212

13-
ioctl_readwrite!(api, UFFDIO, _UFFDIO_API, uffdio_api);
14-
ioctl_readwrite!(register, UFFDIO, _UFFDIO_REGISTER, uffdio_register);
15-
ioctl_read!(unregister, UFFDIO, _UFFDIO_UNREGISTER, uffdio_range);
16-
ioctl_read!(wake, UFFDIO, _UFFDIO_WAKE, uffdio_range);
17-
ioctl_readwrite!(copy, UFFDIO, _UFFDIO_COPY, uffdio_copy);
18-
ioctl_readwrite!(zeropage, UFFDIO, _UFFDIO_ZEROPAGE, uffdio_zeropage);
13+
nix::ioctl_readwrite!(api, UFFDIO, _UFFDIO_API, uffdio_api);
14+
nix::ioctl_readwrite!(register, UFFDIO, _UFFDIO_REGISTER, uffdio_register);
15+
nix::ioctl_read!(unregister, UFFDIO, _UFFDIO_UNREGISTER, uffdio_range);
16+
nix::ioctl_read!(wake, UFFDIO, _UFFDIO_WAKE, uffdio_range);
17+
nix::ioctl_readwrite!(copy, UFFDIO, _UFFDIO_COPY, uffdio_copy);
18+
nix::ioctl_readwrite!(zeropage, UFFDIO, _UFFDIO_ZEROPAGE, uffdio_zeropage);

0 commit comments

Comments
 (0)