#procfs #linux #memory-maps

rsprocmaps

A Rust library for handling memory maps in procfs

4 releases (2 breaking)

0.3.1 Jan 6, 2022
0.3.0 Nov 2, 2020
0.2.0 Aug 4, 2020
0.1.3 Jul 28, 2020

#133 in Unix APIs

Download history 19/week @ 2022-03-10 48/week @ 2022-03-17 14/week @ 2022-03-24 22/week @ 2022-03-31 21/week @ 2022-04-07 34/week @ 2022-04-14 33/week @ 2022-04-21 71/week @ 2022-04-28 57/week @ 2022-05-05 84/week @ 2022-05-12 36/week @ 2022-05-19 37/week @ 2022-05-26 57/week @ 2022-06-02 22/week @ 2022-06-09 28/week @ 2022-06-16 36/week @ 2022-06-23

153 downloads per month

MIT license

16KB
301 lines

procmaps.rs

Build Status

procmaps.rs is a (very) small Rust library with one job: parsing the memory maps that Linux (and some other Unices) expose via /proc/<pid>/maps with a pleasant structure.

I wrote it before realizing that procmaps already exists. You should probably use that one instead, since it's nearly identical.

A quick sample:

let maps = rsprocmaps::from_pid(9001)?;

for map in maps {
  println!("{} executable? {}", map.address_range, map.permissions.executable);
}

Full documentation is available on docs.rs.

Goals

  • Parsing /proc/<pid>/maps correctly and into a clean structure

Anti-goals

  • Parsing other parts of /proc
  • Resolving fundamental ambiguities in the maps file format (e.g. newlines and deleted pathnames)

Dependencies

~1.8–2.5MB
~54K SLoC