Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
arilou committed Jul 18, 2022
1 parent 3a0eb5a commit 505a00a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/process/namespaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,23 @@ impl Process {

namespaces
.insert(
ns_type,
ns_type.clone(),
Namespace {
ns_type,
path,
identifier: stat.st_ino,
device_id: stat.st_dev,
},
)
.expect("NsType already in map");
.map_or_else(
|| Ok(()),
|n| {
Err(build_internal_error!(format!(
"NsType appears more than once {:?}",
n.ns_type
)))
},
)?;
}

Ok(namespaces)
Expand All @@ -45,6 +54,8 @@ impl Process {
/// See also the [Process::namespaces()] method
#[derive(Debug, Clone)]
pub struct Namespace {
/// Namespace type
pub ns_type: OsString,
/// Handle to the namespace
pub path: PathBuf,
/// Namespace identifier (inode number)
Expand Down

0 comments on commit 505a00a

Please sign in to comment.