pub fn get_process_maps(pid: Pid) -> Result<Vec<MapRange>>
Expand description

Gets a Vec of MapRange structs for the passed in PID. (Note that while this function is for Linux, the macOS, Windows, and FreeBSD variants have the same interface)

Examples found in repository?
examples/print_maps.rs (line 12)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fn main() {
    let args: Vec<String> = std::env::args().collect();

    let pid = if args.len() > 1 {
        args[1].parse().expect("invalid pid")
    } else {
        panic!("Usage: print_maps PID");
    };

    let maps = proc_maps::get_process_maps(pid).expect("failed to get proc maps");
    for map in maps {
        println!(
            "Filename {:?} Address {} Size {}",
            map.filename(),
            map.start(),
            map.size()
        );
    }
}