processes/processes.rs
1use std::io;
2
3// NOTE: It's better to run this example with `sudo` or at least with a SUID bit,
4// because some functions will return `Operation not permitted` for any pid given.
5
6fn main() -> io::Result<()> {
7 let pids = darwin_libproc::all_pids()?;
8 for pid in pids {
9 println!("PID: #{}", pid);
10 println!("\tName: {:?}", darwin_libproc::name(pid)?);
11 println!("\tPath: {:?}", darwin_libproc::pid_path(pid)?);
12 }
13
14 Ok(())
15}