Struct procfs::Process [−][src]
Represents a process in /proc/<pid>
.
The stat
structure is pre-populated because it's useful info, but other data is loaded on
demand (and so might fail, if the process no longer exist).
Fields
stat: Stat
Process status, based on the /proc/<pid>/stat
file.
owner: u32
The user id of the owner of this process
Methods
impl Process
[src]
impl Process
pub fn new(pid: pid_t) -> ProcResult<Process>
[src]
pub fn new(pid: pid_t) -> ProcResult<Process>
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 myself() -> ProcResult<Process>
[src]
pub fn myself() -> ProcResult<Process>
Returns a Process
for the currently running process.
This is done by using the /proc/self
symlink
pub fn cmdline(&self) -> ProcResult<Vec<String>>
[src]
pub fn cmdline(&self) -> ProcResult<Vec<String>>
Returns the complete command line for the process, unless the process is a zombie.
pub fn pid(&self) -> pid_t
[src]
pub fn pid(&self) -> pid_t
Returns the process ID for this process.
pub fn is_alive(&self) -> bool
[src]
pub fn is_alive(&self) -> bool
Is this process still alive?
pub fn cwd(&self) -> ProcResult<PathBuf>
[src]
pub fn cwd(&self) -> ProcResult<PathBuf>
The the current working directory of the process. This done by dereferencing the
/proc/pid/cwd
symbolic link.
In a multithreaded process, the contents of this symbolic link are not available if the main thread has already terminated (typically by calling pthread_exit(3)).
Permission to dereference or read (readlink(2)) this symbolic link is governed by a ptrace access mode PTRACE_MODE_READ_FSCREDS check;
pub fn environ(&self) -> ProcResult<HashMap<OsString, OsString>>
[src]
pub fn environ(&self) -> ProcResult<HashMap<OsString, OsString>>
Gets the current environment for the process. This is done by reading the
/proc/pid/environ
file.
pub fn exe(&self) -> ProcResult<PathBuf>
[src]
pub fn exe(&self) -> ProcResult<PathBuf>
The actual path of the executed command, taken by resolving the /proc/pid/exe
symbolic
link.
Under Linux 2.2 and later, this symbolic link contains the actual pathname of the executed command. If the pathname has been unlinked, the symbolic link will contain the string '(deleted)' appended to the original pathname. In a multithreaded process, the contents of this symbolic link are not available if the main thread has already terminated (typically by calling pthread_exit(3)).
pub fn io(&self) -> ProcResult<Io>
[src]
pub fn io(&self) -> ProcResult<Io>
Return the Io stats for this process, based on the /proc/pid/io
file.
(since kernel 2.6.20)
pub fn maps(&self) -> ProcResult<Vec<MemoryMap>>
[src]
pub fn maps(&self) -> ProcResult<Vec<MemoryMap>>
Return a list of the currently mapped memory regions and their access permissions, based on
the /proc/pid/maps
file.
Trait Implementations
impl Debug for Process
[src]
impl Debug for Process
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Process
[src]
impl Clone for Process