Crate proc_maps

source ·
Expand description

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

Re-exports

Modules

Functions

  • Returns whether or not any MapRange contains the given address Note: this will only work correctly on macOS and Linux.