proc-maps
proc-maps copied to clipboard
macos query process info wrong
fn main() {
let pid = std::env::args().nth(1).unwrap().parse().unwrap();
let maps = proc_maps::get_process_maps(pid).unwrap();
for map in maps.into_iter().filter(|x| !x.is_write()) {
println!(
"{:x}-{:x} {:?}",
map.start(),
map.size() + map.start(),
map.filename()
)
}
}
In the vmmap command, the filename obtained should be None.
proc-maps output:
...
108c80000-108cc0000 Some("/Users/****/UnityFramework")
...
vmmap command output:
...
VM_ALLOCATE 108c80000-108cc0000 [ 256K 0K 0K 0K] ---/rwx SM=NUL
...
But for very small processes, such as print helloworld , proc-maps can get the filename correctly.