Update nix to 0.29

This commit is contained in:
Fabian Boehm 2024-06-05 17:02:57 +02:00
parent f59cdfaa8d
commit ad73dcc308
9 changed files with 39 additions and 40 deletions

46
Cargo.lock generated
View file

@ -20,12 +20,6 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.5.0"
@ -34,9 +28,9 @@ checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "cc"
version = "1.0.97"
version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
dependencies = [
"jobserver",
"libc",
@ -49,6 +43,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "dashmap"
version = "5.5.3"
@ -92,7 +92,7 @@ source = "git+https://github.com/fish-shell/fast-float-rust?branch=fish#9590c33a
name = "fish"
version = "0.1.0"
dependencies = [
"bitflags 2.5.0",
"bitflags",
"cc",
"errno",
"fast-float",
@ -161,9 +161,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.151"
version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "lock_api"
@ -204,13 +204,13 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "nix"
version = "0.25.1"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"autocfg",
"bitflags 1.3.2",
"bitflags",
"cfg-if",
"cfg_aliases",
"libc",
]
@ -241,9 +241,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "parking_lot"
version = "0.12.2"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
"parking_lot_core",
@ -343,9 +343,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.82"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
dependencies = [
"unicode-ident",
]
@ -404,7 +404,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
dependencies = [
"bitflags 2.5.0",
"bitflags",
]
[[package]]
@ -470,9 +470,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.63"
version = "2.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704"
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
dependencies = [
"proc-macro2",
"quote",
@ -628,5 +628,5 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.63",
"syn 2.0.66",
]

View file

@ -26,12 +26,12 @@ fast-float = { git = "https://github.com/fish-shell/fast-float-rust", branch="fi
bitflags = "2.4.0"
errno = "0.2.8"
lazy_static = "1.4.0"
libc = "= 0.2.151"
libc = "0.2.155"
# lru pulls in hashbrown by default, which uses a faster (though less DoS resistant) hashing algo.
# disabling default features uses the stdlib instead, but it doubles the time to rewrite the history
# files as of 22 April 2024.
lru = "0.10.0"
nix = { version = "0.25.0", default-features = false, features = ["inotify", "resource", "fs"] }
nix = { version = "0.29.0", default-features = false, features = ["inotify", "resource", "fs"] }
num-traits = "0.2.15"
once_cell = "1.17.0"
printf = { path = "./printf" }

View file

@ -4,5 +4,5 @@ edition = "2021"
version = "0.1.0"
[dependencies]
libc = "= 0.2.151"
libc = "0.2.155"
widestring = "1.0.2"

View file

@ -1525,7 +1525,7 @@ pub fn write_loop<Fd: AsRawFd>(fd: &Fd, buf: &[u8]) -> std::io::Result<usize> {
let fd = fd.as_raw_fd();
let mut total = 0;
while total < buf.len() {
match nix::unistd::write(fd, &buf[total..]) {
match nix::unistd::write(unsafe { BorrowedFd::borrow_raw(fd) }, &buf[total..]) {
Ok(written) => {
total += written;
}

View file

@ -120,7 +120,7 @@ impl FdEventSignaller {
let mut ret;
loop {
let bytes = c.to_ne_bytes();
ret = nix::unistd::write(self.write_fd(), &bytes);
ret = nix::unistd::write(unsafe { BorrowedFd::borrow_raw(self.write_fd()) }, &bytes);
match ret {
Ok(_) => break,

View file

@ -40,7 +40,7 @@ impl Read for AutoCloseFd {
impl Write for AutoCloseFd {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
nix::unistd::write(self.as_raw_fd(), buf).map_err(std::io::Error::from)
nix::unistd::write(self, buf).map_err(std::io::Error::from)
}
fn flush(&mut self) -> std::io::Result<()> {
@ -161,8 +161,8 @@ pub fn make_autoclose_pipes() -> nix::Result<AutoClosePipes> {
}
};
let readp = unsafe { OwnedFd::from_raw_fd(pipes.0) };
let writep = unsafe { OwnedFd::from_raw_fd(pipes.1) };
let readp = pipes.0;
let writep = pipes.1;
// Ensure our fds are out of the user range.
let readp = heightenize_fd(readp, already_cloexec)?;
@ -271,17 +271,16 @@ mod o_search {
/// where O_EXEC is 0x40000000. This is only on macOS 12.0+ or later; however
/// prior macOS versions ignores O_EXEC so it is treated the same as O_RDONLY.
#[cfg(target_os = "macos")]
pub const BEST_O_SEARCH: OFlag =
unsafe { OFlag::from_bits_unchecked(libc::O_DIRECTORY | 0x40000000) };
pub const BEST_O_SEARCH: OFlag = OFlag::from_bits_truncate(libc::O_DIRECTORY | 0x40000000);
/// On FreeBSD, we have O_SEARCH = 0x00040000.
#[cfg(target_os = "freebsd")]
pub const BEST_O_SEARCH: OFlag = unsafe { OFlag::from_bits_unchecked(0x00040000) };
pub const BEST_O_SEARCH: OFlag = OFlag::from_bits_truncate(0x00040000);
/// On Linux we can use O_PATH, it has nearly the same semantics. we can use the fd for openat / fchdir, with only requiring
/// x permission on the directory.
#[cfg(any(target_os = "linux", target_os = "android"))]
pub const BEST_O_SEARCH: OFlag = unsafe { OFlag::from_bits_unchecked(libc::O_PATH) };
pub const BEST_O_SEARCH: OFlag = OFlag::from_bits_truncate(libc::O_PATH);
/// Fall back to O_RDONLY.
#[cfg(not(any(

View file

@ -208,7 +208,7 @@ impl binary_semaphore_t {
Self::Pipes(pipes) => {
// Write exactly one byte.
loop {
match unistd::write(pipes.write.as_raw_fd(), &[0]) {
match unistd::write(&pipes.write, &[0]) {
Err(Errno::EINTR) => continue,
Err(_) => self.die("write"),
Ok(_) => break,

View file

@ -5,7 +5,7 @@ use crate::wchar::prelude::*;
use crate::wutil::{wbasename, wdirname};
use nix::sys::inotify::{AddWatchFlags, InitFlags, Inotify};
use std::ffi::OsString;
use std::os::fd::{AsRawFd, RawFd};
use std::os::fd::{AsFd, AsRawFd, RawFd};
/// A notifier based on inotify.
pub struct InotifyNotifier {
@ -50,13 +50,13 @@ impl UniversalNotifier for InotifyNotifier {
// Returns the fd from which to watch for events.
fn notification_fd(&self) -> Option<RawFd> {
Some(self.inotify.as_raw_fd())
Some(self.inotify.as_fd().as_raw_fd())
}
// The notification_fd is readable; drain it. Returns true if a notification is considered to
// have been posted.
fn notification_fd_became_readable(&self, fd: RawFd) -> bool {
assert_eq!(fd, self.inotify.as_raw_fd(), "unexpected fd");
assert_eq!(fd, self.inotify.as_fd().as_raw_fd(), "unexpected fd");
let Ok(evts) = self.inotify.read_events() else {
return false;
};

View file

@ -492,7 +492,7 @@ pub fn wrename(old_name: &wstr, new_name: &wstr) -> libc::c_int {
}
pub fn write_to_fd(input: &[u8], fd: RawFd) -> nix::Result<usize> {
nix::unistd::write(fd, input)
nix::unistd::write(unsafe { BorrowedFd::borrow_raw(fd) }, input)
}
/// Write a wide string to a file descriptor. This avoids doing any additional allocation.