waitpid-fix #38

Merged
JakeHillion merged 2 commits from waitpid-fix into main 2022-05-19 17:28:28 +01:00
4 changed files with 10 additions and 17 deletions

15
Cargo.lock generated
View File

@ -61,12 +61,6 @@ dependencies = [
"rustc_version", "rustc_version",
] ]
[[package]]
name = "cc"
version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -367,9 +361,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.117" version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]] [[package]]
name = "log" name = "log"
@ -397,12 +391,11 @@ dependencies = [
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.23.1" version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cc",
"cfg-if", "cfg-if",
"libc", "libc",
"memoffset", "memoffset",

View File

@ -17,7 +17,7 @@ serde_json = "1.0"
ipnetwork = "0.18" ipnetwork = "0.18"
libc = "0.2.117" libc = "0.2.117"
nix = "0.23.1" nix = "0.24.1"
close_fds = "0.3.2" close_fds = "0.3.2"
tempfile = "3.3" tempfile = "3.3"

View File

@ -17,8 +17,8 @@ use std::path::Path;
use nix::fcntl::OFlag; use nix::fcntl::OFlag;
use nix::sys::socket; use nix::sys::socket;
use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus}; use nix::sys::wait::{waitid, Id, WaitPidFlag, WaitStatus};
use nix::unistd::{self, Pid}; use nix::unistd;
pub struct RunArgs<'a> { pub struct RunArgs<'a> {
pub spec: Option<&'a Path>, pub spec: Option<&'a Path>,
@ -72,7 +72,7 @@ pub fn run(args: &RunArgs) -> Result<i32> {
let mut exit_code = exitcode::OK; let mut exit_code = exitcode::OK;
loop { 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), Ok(v) => Ok(v),
Err(nix::Error::ECHILD) => { Err(nix::Error::ECHILD) => {
info!("all child processes have exited, exiting..."); info!("all child processes have exited, exiting...");

View File

@ -205,9 +205,9 @@ impl<'a> Spawner<'a> {
let mut cmsg_buf = nix::cmsg_space!([RawFd; MAX_FILE_DESCRIPTORS]); let mut cmsg_buf = nix::cmsg_space!([RawFd; MAX_FILE_DESCRIPTORS]);
loop { loop {
let msg = recvmsg( let msg = recvmsg::<()>(
socket.as_raw_fd(), socket.as_raw_fd(),
&[], &mut [],
Some(&mut cmsg_buf), Some(&mut cmsg_buf),
MsgFlags::empty(), MsgFlags::empty(),
) )