Debian Codegraph @

third_party/rust/procfs-core/src/process/namespaces.rs

raw
1 use std::collections::HashMap;
2 use std::ffi::OsString;
3 use std::path::PathBuf;
4
5 #[cfg(feature = "serde1")]
6 use serde::{Deserialize, Serialize};
7
8 /// Information about a namespace
9 #[derive(Debug, Clone, Eq)]
10 #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
11 pub struct Namespace {
12 /// Namespace type
13 pub ns_type: OsString,
14 /// Handle to the namespace
15 pub path: PathBuf,
16 /// Namespace identifier (inode number)
17 pub identifier: u64,
18 /// Device id of the namespace
19 pub device_id: u64,
20 }
21
22 impl PartialEq for Namespace {
23 fn eq(&self, other: &Self) -> bool {
24 // see https://lore.kernel.org/lkml/[email protected]/
25 self.identifier == other.identifier && self.device_id == other.device_id
26 }
27 }
28
29 /// All namespaces of a process.
30 #[derive(Debug, Clone, PartialEq, Eq)]
31 #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
32 pub struct Namespaces(pub HashMap<OsString, Namespace>);