pub fn fd(&self) -> ProcResult<Vec<FDInfo>> {
        use std::ffi::OsStr;
        use std::fs::read_link;

        let mut vec = Vec::new();

        let path = self.root.join("fd");

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