X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=README.md;h=5873c9bf6364dde831e03c931a28435391fd8231;hb=38223df1a9534a19968c5b04cf234375bec3bb58;hp=cbf3513e6e293ac148c7f70fb3f0543ee67276c7;hpb=7c1bb3f368b9b8143877794f134970ce77b7d2ac;p=chaz%2Fp5-Linux-Proc-Maps diff --git a/README.md b/README.md index cbf3513..5873c9b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Linux::Proc::Maps - Read and write /proc/\[pid\]/maps files # VERSION -version 0.001 +version 0.002 # SYNOPSIS @@ -23,23 +23,27 @@ version 0.001 This module reads and writes `/proc/[pid]/maps` files that contain listed mapped memory regions. -# METHODS +# FUNCTIONS -## read\_maps %args +## read\_maps Read and parse a maps file, returning an arrayref of regions (each represented as a hashref). See ["parse\_maps\_single\_line"](#parse_maps_single_line) to see the format of the hashrefs. + my $regions = read_maps(%args); + Arguments: - `file` - Path to maps file - `pid` - Process ID (one of `file` or `pid` is required) - `mnt` - Absolute path where [proc(5)](http://man.he.net/man5/proc) is mounted (optional, default: `/proc`) -## write\_maps \\@regions, %args +## write\_maps Returns a string with the contents of a maps file from the memory regions passed. + my $file_content = write_maps(\@regions, %args); + This is the opposite of ["read\_maps"](#read_maps). Arguments: @@ -47,10 +51,12 @@ Arguments: - `fh` - Write maps to this open file handle (optional) - `file` - Open this filepath and write maps to that file (optional) -## parse\_maps\_single\_line $line +## parse\_maps\_single\_line Parse and return a single line from a maps file into a region represented as a hashref. + my $region = parse_maps_single_line($line); + For example, # address perms offset dev inode pathname @@ -71,16 +77,24 @@ becomes: pathname => '/usr/sbin/gpm', } -## format\_maps\_single\_line \\%region +## format\_maps\_single\_line Return a single line for a maps file from a region represented as a hashref. + my $line = format_maps_single_line(\%region); + This is the opposite of ["parse\_maps\_single\_line"](#parse_maps_single_line). # SEE ALSO [proc(5)](http://man.he.net/man5/proc) describes the file format. +# CAVEATS + +Integer overloading may occur if you try to parse memory regions from address spaces larger than +your current architecture (or perl) supports. This is currently not fatal, though you will get +warnings from perl that you probably shouldn't ignore. + # BUGS Please report any bugs or feature requests on the bugtracker website