From 491fb46cb99775ce29d88f029d2ac9707c0b9ee5 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Thu, 19 May 2022 17:18:05 +0100 Subject: [PATCH 1/2] updated nix to 0.24.1 --- Cargo.lock | 15 ++++----------- Cargo.toml | 2 +- src/spawner/mod.rs | 4 ++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f8ab7e1..1f579e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,12 +61,6 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "cc" -version = "1.0.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" - [[package]] name = "cfg-if" version = "1.0.0" @@ -367,9 +361,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.117" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "log" @@ -397,12 +391,11 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" +checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" dependencies = [ "bitflags", - "cc", "cfg-if", "libc", "memoffset", diff --git a/Cargo.toml b/Cargo.toml index d10cffd..978c892 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ serde_json = "1.0" ipnetwork = "0.18" libc = "0.2.117" -nix = "0.23.1" +nix = "0.24.1" close_fds = "0.3.2" tempfile = "3.3" diff --git a/src/spawner/mod.rs b/src/spawner/mod.rs index d460c41..cdc0f96 100644 --- a/src/spawner/mod.rs +++ b/src/spawner/mod.rs @@ -205,9 +205,9 @@ impl<'a> Spawner<'a> { let mut cmsg_buf = nix::cmsg_space!([RawFd; MAX_FILE_DESCRIPTORS]); loop { - let msg = recvmsg( + let msg = recvmsg::<()>( socket.as_raw_fd(), - &[], + &mut [], Some(&mut cmsg_buf), MsgFlags::empty(), ) -- 2.47.0 From 4f0f74b859c6cf56fcd54766bc1bb90bdcfd742c Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Thu, 19 May 2022 17:19:52 +0100 Subject: [PATCH 2/2] fixed broken waitpid and switched to waitid --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7561300..049b24c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,8 +17,8 @@ use std::path::Path; use nix::fcntl::OFlag; use nix::sys::socket; -use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus}; -use nix::unistd::{self, Pid}; +use nix::sys::wait::{waitid, Id, WaitPidFlag, WaitStatus}; +use nix::unistd; pub struct RunArgs<'a> { pub spec: Option<&'a Path>, @@ -72,7 +72,7 @@ pub fn run(args: &RunArgs) -> Result { let mut exit_code = exitcode::OK; loop { - let status = match waitpid(Some(Pid::from_raw(-1)), Some(WaitPidFlag::WEXITED)) { + let status = match waitid(Id::All, WaitPidFlag::WEXITED) { Ok(v) => Ok(v), Err(nix::Error::ECHILD) => { info!("all child processes have exited, exiting..."); -- 2.47.0