darwin_libproc

Function all_pids

Source
pub fn all_pids() -> Result<Vec<pid_t>>
Expand description

Fetch pids for all processes running in system.

Examples found in repository?
examples/processes.rs (line 7)
6
7
8
9
10
11
12
13
14
15
fn main() -> io::Result<()> {
    let pids = darwin_libproc::all_pids()?;
    for pid in pids {
        println!("PID: #{}", pid);
        println!("\tName: {:?}", darwin_libproc::name(pid)?);
        println!("\tPath: {:?}", darwin_libproc::pid_path(pid)?);
    }

    Ok(())
}