pub struct UserNamespaceMapper { /* private fields */ }Expand description
User namespace mapper
Handles UID/GID mapping for rootless container execution
Implementations§
Source§impl UserNamespaceMapper
impl UserNamespaceMapper
pub fn new(config: UserNamespaceConfig) -> Self
Sourcepub fn setup_mappings(&self) -> Result<()>
pub fn setup_mappings(&self) -> Result<()>
Setup UID/GID mappings for the current process
This must be called after unshare(CLONE_NEWUSER) and before any other namespace operations
Sourcepub fn write_mappings_for_pid(&self, pid: u32) -> Result<()>
pub fn write_mappings_for_pid(&self, pid: u32) -> Result<()>
Write UID/GID mappings for the given process from an external writer.
For privileged multi-ID mappings, Linux requires a task outside the new
user namespace to write /proc/<pid>/{uid,gid}_map.
Sourcepub fn config(&self) -> &UserNamespaceConfig
pub fn config(&self) -> &UserNamespaceConfig
Get the user namespace configuration
Auto Trait Implementations§
impl Freeze for UserNamespaceMapper
impl RefUnwindSafe for UserNamespaceMapper
impl Send for UserNamespaceMapper
impl Sync for UserNamespaceMapper
impl Unpin for UserNamespaceMapper
impl UnsafeUnpin for UserNamespaceMapper
impl UnwindSafe for UserNamespaceMapper
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