Date: 2017dec19
OS: Linux
Q. Linux: How can a Linux program find out info about itself ?
A. The folder
/proc/self
Contains all sorts of juicy details about the current process.
For example
ls /proc/self
Might list
arch_status coredump_filter gid_map maps oom_adj sched statm wchan
attr cpu_resctrl_groups io mem oom_score schedstat status
autogroup cpuset ksm_merging_pages mountinfo oom_score_adj sessionid syscall
auxv cwd ksm_stat mounts pagemap setgroups task
cgroup environ latency mountstats patch_state smaps timens_offsets
clear_refs exe limits net personality smaps_rollup timers
cmdline fd loginuid ns projid_map stack timerslack_ns
comm fdinfo map_files numa_maps root stat uid_map
You can drill into each of those.
You can not simply `cat /proc/self/mem`
Here how to do that:
https://serverfault.com/questions/173999/dump-a-linux-processs-memory-to-file