pub struct NamespaceManager { /* private fields */ }Expand description
Namespace manager
Implements the namespace lifecycle state machine from Nucleus_Isolation_NamespaceLifecycle.tla
Implementations§
Source§impl NamespaceManager
impl NamespaceManager
pub fn new(config: NamespaceConfig) -> Self
Sourcepub fn with_user_mapping(self, user_config: UserNamespaceConfig) -> Self
pub fn with_user_mapping(self, user_config: UserNamespaceConfig) -> Self
Create a new namespace manager with user namespace mapping
Create namespaces via unshare(2)
This implements the transition: uninitialized -> unshared in the namespace state machine
Check if namespaces have been created
Sourcepub fn enter(&mut self) -> Result<()>
pub fn enter(&mut self) -> Result<()>
Mark that the process has entered the namespaces
State transition: Unshared -> Entered
Sourcepub fn state(&self) -> NamespaceState
pub fn state(&self) -> NamespaceState
Get the current namespace state
Sourcepub fn config(&self) -> &NamespaceConfig
pub fn config(&self) -> &NamespaceConfig
Get namespace configuration
Sourcepub fn set_hostname(&self, hostname: &str) -> Result<()>
pub fn set_hostname(&self, hostname: &str) -> Result<()>
Set hostname in UTS namespace
This only works if the UTS namespace is enabled in the config
Auto Trait Implementations§
impl Freeze for NamespaceManager
impl RefUnwindSafe for NamespaceManager
impl Send for NamespaceManager
impl Sync for NamespaceManager
impl Unpin for NamespaceManager
impl UnsafeUnpin for NamespaceManager
impl UnwindSafe for NamespaceManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more