We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
nix
1 parent 11a061e commit 1b29df1Copy full SHA for 1b29df1
Cargo.toml
@@ -11,6 +11,6 @@ readme = "README.md"
11
[dependencies]
12
bitflags = "1.0"
13
libc = "0.2.65"
14
-nix = "0.13"
+nix = "0.17"
15
thiserror = "1.0.4"
16
userfaultfd-sys = { path = "userfaultfd-sys", version = "0.1.1-dev" }
examples/manpage.rs
@@ -1,6 +1,6 @@
1
//! Port of the example from the `userfaultfd` manpage.
2
use libc::{self, c_void};
3
-use nix::poll::{poll, EventFlags, PollFd};
+use nix::poll::{poll, PollFd, PollFlags};
4
use nix::sys::mman::{mmap, MapFlags, ProtFlags};
5
use nix::unistd::{sysconf, SysconfVar};
6
use std::env;
@@ -31,16 +31,16 @@ fn fault_handler_thread(uffd: Uffd) {
31
loop {
32
// See what poll() tells us about the userfaultfd
33
34
- let pollfd = PollFd::new(uffd.as_raw_fd(), EventFlags::POLLIN);
+ let pollfd = PollFd::new(uffd.as_raw_fd(), PollFlags::POLLIN);
35
let nready = poll(&mut [pollfd], -1).expect("poll");
36
37
println!("\nfault_handler_thread():");
38
let revents = pollfd.revents().unwrap();
39
println!(
40
" poll() returns: nready = {}; POLLIN = {}; POLLERR = {}",
41
nready,
42
- revents.contains(EventFlags::POLLIN),
43
- revents.contains(EventFlags::POLLERR),
+ revents.contains(PollFlags::POLLIN),
+ revents.contains(PollFlags::POLLERR),
44
);
45
46
// Read an event from the userfaultfd
linux-version/Cargo.toml
@@ -9,7 +9,7 @@ description = "Package for detecting the version of the linux kernel a program i
9
build = "build.rs"
10
semver = "0.9"
[build-dependencies]
src/lib.rs
@@ -7,10 +7,6 @@
7
//! [`ioctl_userfaultfd(2)`](http://man7.org/linux/man-pages/man2/ioctl_userfaultfd.2.html) for more
8
//! details.
-// TODO: convert this to 2018-style import once `nix` exports its macros cleanly
-#[macro_use]
-extern crate nix;
-
mod builder;
mod error;
mod event;
src/raw.rs
@@ -10,9 +10,9 @@ pub unsafe fn userfaultfd(flags: c_int) -> c_int {
}
-ioctl_readwrite!(api, UFFDIO, _UFFDIO_API, uffdio_api);
-ioctl_readwrite!(register, UFFDIO, _UFFDIO_REGISTER, uffdio_register);
-ioctl_read!(unregister, UFFDIO, _UFFDIO_UNREGISTER, uffdio_range);
-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);
+nix::ioctl_readwrite!(api, UFFDIO, _UFFDIO_API, uffdio_api);
+nix::ioctl_readwrite!(register, UFFDIO, _UFFDIO_REGISTER, uffdio_register);
+nix::ioctl_read!(unregister, UFFDIO, _UFFDIO_UNREGISTER, uffdio_range);
+nix::ioctl_read!(wake, UFFDIO, _UFFDIO_WAKE, uffdio_range);
+nix::ioctl_readwrite!(copy, UFFDIO, _UFFDIO_COPY, uffdio_copy);
+nix::ioctl_readwrite!(zeropage, UFFDIO, _UFFDIO_ZEROPAGE, uffdio_zeropage);
0 commit comments