From f6d1f45ef843e02e60854f5deb5ecd8c1a305ea9 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Thu, 17 Aug 2023 15:33:14 -0700 Subject: [PATCH] Simplify cfgs Signed-off-by: James Sturtevant Signed-off-by: James Sturtevant --- crates/containerd-shim-wasm/src/lib.rs | 2 +- .../src/libcontainer_instance/container_executor.rs | 1 - .../src/libcontainer_instance/instance.rs | 1 - crates/containerd-shim-wasm/src/libcontainer_instance/mod.rs | 2 -- crates/containerd-shim-wasm/src/sandbox/instance.rs | 4 ++-- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/containerd-shim-wasm/src/lib.rs b/crates/containerd-shim-wasm/src/lib.rs index 0b60561de..806a33fa7 100644 --- a/crates/containerd-shim-wasm/src/lib.rs +++ b/crates/containerd-shim-wasm/src/lib.rs @@ -8,5 +8,5 @@ pub mod sandbox; mod macros; pub mod services; -#[cfg(feature = "libcontainer")] +#[cfg(all(feature = "libcontainer", not(target_os = "windows")))] pub mod libcontainer_instance; diff --git a/crates/containerd-shim-wasm/src/libcontainer_instance/container_executor.rs b/crates/containerd-shim-wasm/src/libcontainer_instance/container_executor.rs index 4bcc40214..4da20c797 100644 --- a/crates/containerd-shim-wasm/src/libcontainer_instance/container_executor.rs +++ b/crates/containerd-shim-wasm/src/libcontainer_instance/container_executor.rs @@ -1,4 +1,3 @@ -#![cfg(unix)] use crate::sandbox::oci; use libcontainer::workload::default::DefaultExecutor; use libcontainer::workload::{Executor, ExecutorError}; diff --git a/crates/containerd-shim-wasm/src/libcontainer_instance/instance.rs b/crates/containerd-shim-wasm/src/libcontainer_instance/instance.rs index 564e3223e..8bc4f45be 100644 --- a/crates/containerd-shim-wasm/src/libcontainer_instance/instance.rs +++ b/crates/containerd-shim-wasm/src/libcontainer_instance/instance.rs @@ -1,4 +1,3 @@ -#![cfg(unix)] //! Abstractions for running/managing a wasm/wasi instance that uses youki's libcontainer library. use anyhow::Context; diff --git a/crates/containerd-shim-wasm/src/libcontainer_instance/mod.rs b/crates/containerd-shim-wasm/src/libcontainer_instance/mod.rs index 805e68dbc..7d0b07faa 100644 --- a/crates/containerd-shim-wasm/src/libcontainer_instance/mod.rs +++ b/crates/containerd-shim-wasm/src/libcontainer_instance/mod.rs @@ -1,5 +1,3 @@ -#![cfg(unix)] - pub mod container_executor; pub mod instance; diff --git a/crates/containerd-shim-wasm/src/sandbox/instance.rs b/crates/containerd-shim-wasm/src/sandbox/instance.rs index 27040a2e4..832df7504 100644 --- a/crates/containerd-shim-wasm/src/sandbox/instance.rs +++ b/crates/containerd-shim-wasm/src/sandbox/instance.rs @@ -14,6 +14,8 @@ pub type ExitCode = Arc<(Mutex)>>, Condvar)>; #[cfg(unix)] use libc::SIGKILL; +#[cfg(windows)] +const SIGKILL: i32 = 9; /// Generic options builder for creating a wasm instance. /// This is passed to the `Instance::new` method. @@ -192,7 +194,6 @@ impl Instance for Nop { } fn kill(&self, signal: u32) -> Result<(), Error> { let code = match signal as i32 { - #[cfg(unix)] SIGKILL => 137, SIGINT | SIGTERM => 0, s => { @@ -226,7 +227,6 @@ mod noptests { use super::*; - #[cfg(unix)] #[test] fn test_nop_kill_sigkill() -> Result<(), Error> { let nop = Nop::new("".to_string(), None);