14 releases

Uses old Rust 2015

0.4.0 Oct 17, 2024
0.3.2 Sep 27, 2023
0.3.1 Apr 26, 2023
0.3.0 Oct 2, 2022
0.1.5 Nov 20, 2018

#65 in Operating systems

Download history 2265/week @ 2024-07-26 2048/week @ 2024-08-02 2610/week @ 2024-08-09 2729/week @ 2024-08-16 2027/week @ 2024-08-23 2476/week @ 2024-08-30 2807/week @ 2024-09-06 2803/week @ 2024-09-13 3205/week @ 2024-09-20 5434/week @ 2024-09-27 8212/week @ 2024-10-04 5372/week @ 2024-10-11 5181/week @ 2024-10-18 6992/week @ 2024-10-25 6276/week @ 2024-11-01 4317/week @ 2024-11-08

23,498 downloads per month
Used in 28 crates (18 directly)

MIT license

180KB
6K SLoC

proc-maps

Build Status crates.io docs.rs

This crate supports reading virtual memory maps from another process - and supports Linux, macOS, Windows, and FreeBSD operating systems.

Examples

use proc_maps::get_process_maps;

let maps = get_process_maps(pid)?;
for map in maps {
    println!("Filename {:?} Address {} Size {}", map.filename(), map.start(), map.size());
}
cargo run --example print_maps <PID>

Credits

This code was originally developed by Julia Evans as part of the rbspy project: https://github.com/rbspy/rbspy.

License

Released under the MIT License.


lib.rs:

Get virtual memory maps from another process

This crate provides a function—get_process_maps that returns a Vec of MapRange structs.

This code works on Linux, macOS, and Windows. Each operating system has a different implementation, but the functions and structs for all OSes share the same interface - so this can be used generically across operating systems.

Note: on macOS this requires root access, and even with root will still not work on processes that have System Integrity Protection enabled (anything in /usr/bin for example).

Example

use proc_maps::{get_process_maps, MapRange, Pid};

let maps = get_process_maps(123456 as Pid).unwrap();
for map in maps {
   println!("Filename {:?} Address {} Size {}", map.filename(), map.start(), map.size());
}

Dependencies

~0–6.5MB
~41K SLoC