pub struct ProcDir { /* private fields */ }Expand description
An open /proc/<pid> directory handle that pins the process.
Opening the directory and reading the status/cmdline files through the
same dirfd (openat/fstatat) removes the pid-reuse TOCTOU between
independent path lookups: once the directory is open, the kernel keeps it
bound to that specific process, so a pid recycled between a probe and a
read cannot misattribute identity (finding 13).
Implementations§
Source§impl ProcDir
impl ProcDir
Sourcepub fn open(pid: i32) -> Result<Self, CoreError>
pub fn open(pid: i32) -> Result<Self, CoreError>
Open the /proc/<pid> directory.
§Errors
EACCES: Permission denied.ENOENT: The process does not exist (or is gone).
Sourcepub fn open_at(proc_root: impl AsRef<Path>, pid: i32) -> Result<Self, CoreError>
pub fn open_at(proc_root: impl AsRef<Path>, pid: i32) -> Result<Self, CoreError>
Open the /proc/<pid> directory under an explicit procfs root.
Sourcepub fn status(&self) -> Result<ProcStatus, CoreError>
pub fn status(&self) -> Result<ProcStatus, CoreError>
Read /proc/<pid>/status through the pinned handle.
Auto Trait Implementations§
impl Freeze for ProcDir
impl RefUnwindSafe for ProcDir
impl Send for ProcDir
impl Sync for ProcDir
impl Unpin for ProcDir
impl UnsafeUnpin for ProcDir
impl UnwindSafe for ProcDir
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more