Skip to content

Commit

Permalink
upgrade nix to 0.29.0
Browse files Browse the repository at this point in the history
Summary:
Enable more features that are disabled by default and update call
sites.

Reviewed By: opsound, jasonwhite

Differential Revision: D66275420

fbshipit-source-id: 4969045de7751c7d16b6ed5c7411f04077eb0ddc
  • Loading branch information
chadaustin authored and facebook-github-bot committed Dec 17, 2024
1 parent d3b2107 commit b7e0443
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion below/btrfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license = "Apache-2.0"
[dependencies]
common = { package = "below-common", version = "0.8.1", path = "../common" }
libc = "0.2.139"
nix = "0.26.4"
nix = { version = "0.29.0", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "term", "time", "user", "zerocopy"] }
openat = "0.1.21"
rand = { version = "0.8", features = ["small_rng"] }
rand_distr = "0.4"
Expand Down
3 changes: 3 additions & 0 deletions below/btrfs/src/btrfs_api/sudotest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use std::fs;
use std::fs::File;
use std::os::fd::BorrowedFd;
use std::os::unix::fs::MetadataExt;
use std::os::unix::io::AsRawFd;
use std::path::Path;
Expand All @@ -39,6 +40,8 @@ fn is_btrfs(base_path: &Path) -> bool {
.map_err(|e| Error::IoError(base_path.to_path_buf(), e))
.expect("Could not open directory");

// SAFETY: Fix when https://github.com/nix-rust/nix/issues/2546 is
let dir = unsafe { BorrowedFd::borrow_raw(dir.as_raw_fd()) };
let statfs = match fstatfs(&dir) {
Ok(s) => s,
Err(_) => {
Expand Down
2 changes: 1 addition & 1 deletion below/cgroupfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "Apache-2.0"

[dependencies]
common = { package = "below-common", version = "0.8.1", path = "../common" }
nix = "0.26.4"
nix = { version = "0.29.0", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "term", "time", "user", "zerocopy"] }
openat = "0.1.21"
serde = { version = "1.0.185", features = ["derive", "rc"] }
thiserror = "2"
Expand Down
7 changes: 6 additions & 1 deletion below/cgroupfs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
use std::io::ErrorKind;
use std::os::fd::AsRawFd;
use std::os::fd::BorrowedFd;
use std::path::Path;
use std::path::PathBuf;
use std::str::FromStr;
Expand Down Expand Up @@ -250,7 +252,10 @@ impl CgroupReader {

// Check that it's a cgroup2 fs
if validate {
let statfs = match fstatfs(&dir) {
// SAFETY: Fix when https://github.com/nix-rust/nix/issues/2546 is
let dir = unsafe { BorrowedFd::borrow_raw(dir.as_raw_fd()) };

let statfs = match fstatfs(dir) {
Ok(s) => s,
Err(e) => {
return Err(Error::IoError(
Expand Down
2 changes: 1 addition & 1 deletion below/ethtool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
nix = "0.26.4"
nix = { version = "0.29.0", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "term", "time", "user", "zerocopy"] }
serde = { version = "1.0.185", features = ["derive", "rc"] }
thiserror = "2"
5 changes: 2 additions & 3 deletions below/ethtool/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use std::alloc;
use std::ffi::CStr;
use std::mem;
use std::os::fd::AsRawFd;
use std::os::fd::FromRawFd;
use std::os::fd::OwnedFd;
use std::ptr;
use std::str;
Expand Down Expand Up @@ -326,8 +325,8 @@ impl EthtoolReadable for Ethtool {
SockFlag::empty(),
None,
) {
Ok(fd) => Ok(Ethtool {
sock_fd: unsafe { OwnedFd::from_raw_fd(fd) },
Ok(sock_fd) => Ok(Ethtool {
sock_fd,
if_name: if_name_bytes(if_name),
}),
Err(errno) => Err(EthtoolError::SocketError(errno)),
Expand Down
2 changes: 1 addition & 1 deletion below/procfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ license = "Apache-2.0"
common = { package = "below-common", version = "0.8.1", path = "../common" }
lazy_static = "1.4"
libc = "0.2.139"
nix = "0.26.4"
nix = { version = "0.29.0", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "term", "time", "user", "zerocopy"] }
openat = "0.1.21"
parking_lot = { version = "0.12.1", features = ["send_guard"] }
serde = { version = "1.0.185", features = ["derive", "rc"] }
Expand Down
2 changes: 1 addition & 1 deletion below/resctrlfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
nix = "0.26.4"
nix = { version = "0.29.0", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "term", "time", "user", "zerocopy"] }
openat = "0.1.21"
serde = { version = "1.0.185", features = ["derive", "rc"] }
thiserror = "2"
Expand Down
6 changes: 5 additions & 1 deletion below/resctrlfs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ use std::collections::BTreeSet;
use std::io::BufRead;
use std::io::BufReader;
use std::io::ErrorKind;
use std::os::fd::AsRawFd;
use std::os::fd::BorrowedFd;
use std::path::Path;
use std::path::PathBuf;
use std::str::FromStr;
Expand Down Expand Up @@ -383,7 +385,9 @@ impl ResctrlReader {
let dir = Dir::open(&path).map_err(|e| Error::IoError(path.clone(), e))?;
// Check that it's a resctrl fs
if validate {
let statfs = match fstatfs(&dir) {
// SAFETY: Fix when https://github.com/nix-rust/nix/issues/2546 is
let dir = unsafe { BorrowedFd::borrow_raw(dir.as_raw_fd()) };
let statfs = match fstatfs(dir) {
Ok(s) => s,
Err(e) => {
return Err(Error::IoError(
Expand Down
2 changes: 1 addition & 1 deletion below/store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ humantime = "2.1"
maplit = "1.0"
memmap2 = "0.5.10"
model = { package = "below-model", version = "0.8.1", path = "../model" }
nix = "0.26.4"
nix = { version = "0.29.0", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "term", "time", "user", "zerocopy"] }
serde = { version = "1.0.185", features = ["derive", "rc"] }
serde_cbor = "0.11"
slog = { version = "2.7", features = ["max_level_trace", "nested-values"] }
Expand Down
2 changes: 1 addition & 1 deletion below/tc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ license = "Apache-2.0"
netlink-packet-core = "0.7.0"
netlink-packet-route = "0.19.0"
netlink-sys = "0.8.5"
nix = "0.26.4"
nix = { version = "0.29.0", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "term", "time", "user", "zerocopy"] }
serde = { version = "1.0.185", features = ["derive", "rc"] }
thiserror = "2"

0 comments on commit b7e0443

Please sign in to comment.