Skip to content

Commit

Permalink
Merge pull request #122 from lengrongfu/feat/add_time_namespaces
Browse files Browse the repository at this point in the history
add time namespaces
  • Loading branch information
utam0k authored Feb 20, 2023
2 parents 8993941 + 397825c commit 65ad456
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/runtime/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ pub struct Linux {
/// Personality contains configuration for the Linux personality
/// syscall.
personality: Option<LinuxPersonality>,

#[serde(default, skip_serializing_if = "Option::is_none")]
/// TimeOffsets specifies the offset for supporting time namespaces.
time_offsets: Option<HashMap<String, String>>,
}

// Default impl for Linux (see funtions for more info)
Expand Down Expand Up @@ -128,6 +132,7 @@ impl Default for Linux {
seccomp: None,
intel_rdt: None,
personality: None,
time_offsets: None,
}
}
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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"
))),
Expand Down

0 comments on commit 65ad456

Please sign in to comment.