#virtual-memory #proc #process #maps #memory #virtual

bin+lib proc-maps

Helper crate for getting virtual memory maps from processes

11 releases

Uses old Rust 2015

0.3.0 Oct 2, 2022
0.2.1 May 2, 2022
0.2.0 Nov 12, 2021
0.1.8 Apr 4, 2021
0.1.5 Nov 20, 2018

#42 in Operating systems

Download history 1741/week @ 2022-08-19 2257/week @ 2022-08-26 1646/week @ 2022-09-02 1873/week @ 2022-09-09 1391/week @ 2022-09-16 1576/week @ 2022-09-23 1038/week @ 2022-09-30 1110/week @ 2022-10-07 1005/week @ 2022-10-14 983/week @ 2022-10-21 1069/week @ 2022-10-28 1961/week @ 2022-11-04 1325/week @ 2022-11-11 903/week @ 2022-11-18 1113/week @ 2022-11-25 710/week @ 2022-12-02

4,382 downloads per month
Used in 16 crates (9 directly)

MIT license

175KB
5.5K 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.

Example:

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());
}

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

Release 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

~225KB