From 397825c9bc5886b6956ddecbbf123c8d689ef77f Mon Sep 17 00:00:00 2001 From: lengrongfu <1275177125@qq.com> Date: Wed, 8 Feb 2023 23:22:05 +0800 Subject: [PATCH] add time namespaces Signed-off-by: lengrongfu <1275177125@qq.com> --- src/runtime/linux.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/runtime/linux.rs b/src/runtime/linux.rs index 956d3a8b24..ad18b9da14 100644 --- a/src/runtime/linux.rs +++ b/src/runtime/linux.rs @@ -84,6 +84,10 @@ pub struct Linux { /// Personality contains configuration for the Linux personality /// syscall. personality: Option, + + #[serde(default, skip_serializing_if = "Option::is_none")] + /// TimeOffsets specifies the offset for supporting time namespaces. + time_offsets: Option>, } // Default impl for Linux (see funtions for more info) @@ -128,6 +132,7 @@ impl Default for Linux { seccomp: None, intel_rdt: None, personality: None, + time_offsets: None, } } } @@ -752,6 +757,9 @@ pub enum LinuxNamespaceType { /// Network Namespace for isolating network devices, ports, stacks etc. Network = 0x40000000, + + /// Time Namespace for isolating the clocks + Time = 0x00000080, } impl TryFrom<&str> for LinuxNamespaceType { @@ -766,6 +774,7 @@ impl TryFrom<&str> for LinuxNamespaceType { "user" => Ok(LinuxNamespaceType::User), "pid" => Ok(LinuxNamespaceType::Pid), "net" => Ok(LinuxNamespaceType::Network), + "time" => Ok(LinuxNamespaceType::Time), _ => Err(oci_error(format!( "unknown namespace {namespace}, could not convert" ))),