Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add time namespaces #122

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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