/// Gets a list of open file descriptors for a process
Gets a list of open file descriptors for a process
Gets a list of open file descriptors for a process
pub fn fd(&self) -> ProcResult<Vec<FDInfo>> {
        use std::ffi::OsStr;
        use std::fs::read_link;
        let mut vec = Vec::new();
        for dir in proctry!(self.root.join("fd").read_dir()) {
            let entry = proctry!(dir);
            let fd = u32::from_str_radix(entry.file_name().to_str().unwrap(), 10).unwrap();
            //  note: the link might have disappeared between the time we got the directory listing
            //  and now.  So if the read_link fails, that's OK
            if let Ok(link) = read_link(entry.path()) {
                let link_os: &OsStr = link.as_ref();
                vec.push(FDInfo {
                    fd,
                    target: FDTarget::from_str(link_os.to_str().unwrap()).unwrap(),
                });
            }
        }
        ProcResult::Ok(vec)
    }
pub fn fd ( & self ) -> ProcResult < Vec < FDInfo > > { use std :: ffi :: OsStr ; use std :: fs :: read_link ; let mut vec = Vec :: new ( ) ; for dir in proctry ! ( self root join ( " " ) read_dir ( ) ) { let entry = proctry ! ( dir ) ; let fd = u32 :: from_str_radix ( entry . file_name ( ) . to_str ( ) . unwrap ( ) , 10 ) . unwrap ( ) ; //  note: the link might have disappeared between the time we got the directory listing //  and now.  So if the read_link fails, that's OK if let Ok ( link ) = read_link ( entry . path ( ) ) { let link_os : & OsStr = link . as_ref ( ) ; vec . push ( FDInfo { fd , target : FDTarget :: from_str ( link_os . to_str ( ) . unwrap ( ) ) . unwrap ( ) , } ) ; } } ProcResult :: Ok ( vec ) }
Gets a list of open file descriptors for a process
Gets a list of open file descriptors for a process
&self