procinfo: add some comments

This commit is contained in:
Wez Furlong committed 2022-01-01 09:53:56 -07:00
1 parent 5660942055
commit 6a7fd37d34
1 file changed
+22
+22
View File
@@ -24,21 +24,43 @@ pub enum LocalProcessStatus {
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct LocalProcessInfo {
/// The process identifier
pub pid: u32,
/// The parent process identifier
pub ppid: u32,
/// The COMM name of the process. May not bear any relation to
/// the executable image name. May be changed at runtime by
/// the process.
/// Many systems truncate this
/// field to 15-16 characters.
pub name: String,
/// Path to the executable image
pub executable: PathBuf,
/// The argument vector.
/// Some systems allow changing the argv block at runtime
/// eg: setproctitle().
pub argv: Vec<String>,
/// The current working directory for the process, or an empty
/// path if it was not accessible for some reason.
pub cwd: PathBuf,
/// The status of the process. Not all possible values are
/// portably supported on all systems.
pub status: LocalProcessStatus,
/// A clock value in unspecified system dependent units that
/// indicates the relative age of the process.
pub start_time: u64,
/// The console handle associated with the process, if any.
#[cfg(windows)]
pub console: u64,
/// Child processes, keyed by pid
pub children: HashMap<u32, LocalProcessInfo>,
}
luahelper::impl_lua_conversion!(LocalProcessInfo);
impl LocalProcessInfo {
/// Walk this sub-tree of processes and return a unique set
/// of executable base names. eg: `foo/bar` and `woot/bar`
/// produce a set containing just `bar`.
pub fn flatten_to_exe_names(&self) -> HashSet<String> {
let mut names = HashSet::new();