/// Tries to create a `Process` based on a PID.
///
/// This can fail if the process doesn't exist, or if you don't have permission to access it.
Tries to create a `Process` based on a PID.
This can fail if the process doesn't exist, or if you don't have permission to access it.
Tries to create a ` Process ` based on a PID . This can fail if the process doesn ' t exist or if you don ' t have permission to access it .
pub fn new(pid: pid_t) -> ProcResult<Process> {
        let root = PathBuf::from("/proc").join(format!("{}", pid));
        let stat = Stat::from_reader(proctry!(File::open(root.join("stat")))).unwrap();
        let md = proctry!(std::fs::metadata(&root));
        ProcResult::Ok(Process {
            root,
            stat,
            owner: md.st_uid(),
        })
    }
pub fn new ( pid : pid_t ) -> ProcResult < Process > { let root = PathBuf :: from ( " " ) . join ( format ! ( " " pid ) ) ; let stat = Stat :: from_reader ( proctry ! ( File open ( root join ( " " ) ) ) ) . unwrap ( ) ; let md = proctry ! ( std fs metadata ( root ) ) ; ProcResult :: Ok ( Process { root , stat , owner : md . st_uid ( ) , } ) }
Tries to create a `Process` based on a PID.
Tries to create a ` Process ` based on a PID .
pid
pid_t