Skip to content

Commit

Permalink
Merge pull request #336 from jprendes/bump-nix
Browse files Browse the repository at this point in the history
Bump nix to 1.27.1
  • Loading branch information
cpuguy83 authored Sep 30, 2023
2 parents 1ffd054 + 06d9eb6 commit 89040e0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ env_logger = "0.10"
libc = "0.2.147"
libcontainer = { version = "0.2", default-features = false }
log = "0.4"
nix = "0.26"
nix = "0.27"
oci-spec = { version = "0.6.1", features = ["runtime"] }
serde = "1.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/containerd-shim-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ wat = { workspace = true }
caps = "0.5"
dbus = { version = "*", features = ["vendored"] }
libcontainer = { workspace = true, features = ["libseccomp", "systemd", "v1", "v2"]}
nix = { workspace = true }
nix = { workspace = true, features = ["sched", "mount"] }

[target.'cfg(windows)'.dependencies]
windows-sys = { workspace = true, features = ["Win32_Foundation", "Win32_Storage_FileSystem"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use libcontainer::signal::Signal;
use libcontainer::syscall::syscall::SyscallType;
use nix::errno::Errno;
use nix::sys::wait::{waitid, Id as WaitID, WaitPidFlag, WaitStatus};
use nix::unistd::Pid;

use crate::container::Engine;
use crate::sandbox::instance::{ExitCode, Wait};
Expand Down Expand Up @@ -60,7 +61,7 @@ impl<E: Engine> SandboxInstance for Instance<E> {
.with_systemd(false)
.build()?;

let pid = container.pid().context("failed to get pid")?;
let pid = container.pid().context("failed to get pid")?.as_raw();

container.start().map_err(|err| {
SandboxError::Any(anyhow::anyhow!("failed to start container: {}", err))
Expand All @@ -70,7 +71,7 @@ impl<E: Engine> SandboxInstance for Instance<E> {
thread::spawn(move || {
let (lock, cvar) = &*exit_code;

let status = match waitid(WaitID::Pid(pid), WaitPidFlag::WEXITED) {
let status = match waitid(WaitID::Pid(Pid::from_raw(pid)), WaitPidFlag::WEXITED) {
Ok(WaitStatus::Exited(_, status)) => status,
Ok(WaitStatus::Signaled(_, sig, _)) => sig as i32,
Ok(_) => 0,
Expand All @@ -86,7 +87,7 @@ impl<E: Engine> SandboxInstance for Instance<E> {
cvar.notify_all();
});

Ok(pid.as_raw() as u32)
Ok(pid as u32)
}

/// Send a signal to the instance
Expand Down
3 changes: 1 addition & 2 deletions crates/containerd-shim-wasm/src/sys/unix/networking.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::fs::File;
use std::os::unix::io::AsRawFd;

use anyhow::Result;
use containerd_shim::error::Error as ShimError;
Expand All @@ -25,7 +24,7 @@ pub fn setup_namespaces(spec: &runtime::Spec) -> Result<()> {
err
))
})?;
setns(f.as_raw_fd(), CloneFlags::CLONE_NEWNET).map_err(|err| {
setns(f, CloneFlags::CLONE_NEWNET).map_err(|err| {
ShimError::Other(format!("could not set network namespace: {0}", err))
})?;
} else {
Expand Down

0 comments on commit 89040e0

Please sign in to comment.