Skip to content

Commit e325a43

Browse files
authored
Merge pull request #2 from fastly/tyler/refresher
Refresh library for open sourcing
2 parents ef50311 + 56a11e0 commit e325a43

File tree

8 files changed

+97
-146
lines changed

8 files changed

+97
-146
lines changed

.github/workflows/rust.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ jobs:
1717
run: cargo build --verbose
1818
- name: Run tests
1919
run: cargo test --verbose
20+
21+
audit:
22+
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Install Cargo Audit
28+
run: cargo install cargo-audit
29+
- name: Audit
30+
run: cargo audit

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66

77
[dependencies]
88
bitflags = "1.0"
9-
failure = "0.1"
10-
libc = "=0.2.59"
9+
libc = "0.2.65"
1110
nix = "0.13"
11+
thiserror = "1.0.4"
1212
userfaultfd-sys = { path = "userfaultfd-sys" }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![Rust](https://github.com/fastly/userfaultfd-rs/workflows/Rust/badge.svg)
1+
![Build](https://github.com/fastly/userfaultfd-rs/workflows/Rust/badge.svg)
22

33
# userfaultfd-rs
44
Rust bindings for Linux's userfaultfd functionality.

linux-version/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ nix = "0.13"
1111
semver = "0.9"
1212

1313
[build-dependencies]
14-
bindgen = "0.47"
14+
bindgen = "0.51"

src/error.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::IoctlFlags;
2-
use failure::Fail;
2+
use thiserror::Error;
33
use nix::errno::Errno;
44

55
pub type Result<T> = std::result::Result<T, Error>;
@@ -10,38 +10,38 @@ pub type Result<T> = std::result::Result<T, Error>;
1010
/// [`userfaultfd(2)`](http://man7.org/linux/man-pages/man2/userfaultfd.2.html) and
1111
/// [`ioctl_userfaultfd(2)`](http://man7.org/linux/man-pages/man2/ioctl_userfaultfd.2.html) for more
1212
/// details on how to interpret these errors.
13-
#[derive(Debug, Fail)]
13+
#[derive(Debug, Error)]
1414
pub enum Error {
1515
/// Copy ioctl failure with `errno` value.
16-
#[fail(display = "copy failed: {}", 0)]
16+
#[error("Copy failed")]
1717
CopyFailed(Errno),
1818

1919
/// Failure to read a full `uffd_msg` struct from the underlying file descriptor.
20-
#[fail(display = "incomplete uffd_msg; read only {}/{} bytes", read, expected)]
20+
#[error("Incomplete uffd_msg; read only {read}/{expected} bytes")]
2121
IncompleteMsg { read: usize, expected: usize },
2222

2323
/// Generic system error.
24-
#[fail(display = "system error: {}", 0)]
25-
SystemError(nix::Error),
24+
#[error("System error")]
25+
SystemError(#[source] nix::Error),
2626

2727
/// End-of-file was read from the underlying file descriptor.
28-
#[fail(display = "EOF when reading file descriptor")]
28+
#[error("EOF when reading file descriptor")]
2929
ReadEof,
3030

3131
/// An unrecognized event code was found in a `uffd_msg` struct.
32-
#[fail(display = "unrecognized event in uffd_msg: {}", 0)]
32+
#[error("Unrecognized event in uffd_msg: {0}")]
3333
UnrecognizedEvent(u8),
3434

3535
/// An unrecognized ioctl bit was set in the result of API initialization or registration.
36-
#[fail(display = "unrecognized ioctl flags: {}", 0)]
36+
#[error("Unrecognized ioctl flags: {0}")]
3737
UnrecognizedIoctls(u64),
3838

3939
/// Requested ioctls were not available when initializing the API.
40-
#[fail(display = "requested ioctls unsupported; supported: {:?}", 0)]
40+
#[error("Requested ioctls unsupported; supported: {0:?}")]
4141
UnsupportedIoctls(IoctlFlags),
4242

4343
/// Zeropage ioctl failure with `errno` value.
44-
#[fail(display = "zeropage failed: {}", 0)]
44+
#[error("Zeropage failed: {0}")]
4545
ZeropageFailed(Errno),
4646
}
4747

userfaultfd-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ build = "build.rs"
1010
cfg-if = "0.1"
1111

1212
[build-dependencies]
13-
bindgen = "0.47"
13+
bindgen = "0.51"
1414
cc = "1.0"
1515
linux-version = { path = "../linux-version" }

userfaultfd-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl ParseCallbacks for Callbacks {
6262
("UFFD_PAGEFAULT_FLAG_", IntKind::U64),
6363
("UFFD_FEATURE_", IntKind::U64),
6464
]
65-
.into_iter()
65+
.iter()
6666
{
6767
if name.starts_with(prefix) {
6868
return Some(*kind);

0 commit comments

Comments
 (0)