Your assignment is to create a bash script called "procparser.bash" that sums the total heap size used by processes on a system (obviously, to successfully run this on all processes, the process would need a uid of 0.)
bash-4.2$ ./procparser.bash Usable result from /proc/116543/maps. Usable result from /proc/121212/maps. Usable result from /proc/122697/maps. Usable result from /proc/134525/maps. Usable result from /proc/135594/maps. Processes read : 5, total heap used = 7081984, average heap size = 1416396.75
Please run your code on both your LFS and your Debian installations, and to the extent that you are able to do so, also on a linprog machine.
For example, on my Funtoo machine in my office, here's what I would get as an ordinary user:
procparser $ ./procparser.bash Usable result from /proc/26007/maps. Usable result from /proc/26027/maps. Usable result from /proc/26043/maps. Usable result from /proc/26051/maps. Usable result from /proc/26054/maps. Usable result from /proc/26055/maps. Usable result from /proc/26065/maps. Usable result from /proc/26070/maps. Usable result from /proc/26073/maps. Usable result from /proc/26079/maps. Usable result from /proc/26087/maps. Usable result from /proc/26091/maps. Usable result from /proc/26095/maps. Usable result from /proc/26100/maps. Usable result from /proc/26122/maps. Usable result from /proc/26124/maps. Usable result from /proc/26129/maps. Usable result from /proc/26131/maps. Usable result from /proc/26136/maps. Usable result from /proc/26149/maps. Usable result from /proc/26154/maps. Usable result from /proc/26158/maps. Usable result from /proc/26161/maps. Usable result from /proc/26230/maps. Usable result from /proc/26235/maps. Usable result from /proc/26241/maps. Usable result from /proc/26243/maps. Usable result from /proc/26244/maps. Usable result from /proc/26272/maps. Usable result from /proc/26278/maps. Usable result from /proc/26340/maps. Usable result from /proc/26352/maps. Usable result from /proc/26647/maps. Usable result from /proc/28791/maps. Usable result from /proc/28936/maps. Usable result from /proc/29512/maps. Usable result from /proc/29533/maps. Usable result from /proc/29930/maps. Usable result from /proc/29943/maps. Usable result from /proc/29945/maps. Usable result from /proc/29959/maps. Usable result from /proc/30225/maps. Usable result from /proc/30231/maps. Usable result from /proc/30257/maps. Usable result from /proc/30270/maps. Usable result from /proc/30302/maps. Processes read : 46, total heap used = 145764352, average heap size = 3168790.25
If I run this as root, I get more even more information:
langley@localhost ~/procparser $ su - root Password: localhost procparser # ./procparser.bash Usable result from /proc/1/maps. Usable result from /proc/24757/maps. Usable result from /proc/25738/maps. Usable result from /proc/25780/maps. Usable result from /proc/25810/maps. Usable result from /proc/25811/maps. Usable result from /proc/25854/maps. Usable result from /proc/25923/maps. Usable result from /proc/25924/maps. Usable result from /proc/25925/maps. Usable result from /proc/25926/maps. Usable result from /proc/25928/maps. Usable result from /proc/25984/maps. Usable result from /proc/25988/maps. Usable result from /proc/25990/maps. Usable result from /proc/25996/maps. Usable result from /proc/26007/maps. Usable result from /proc/26027/maps. Usable result from /proc/26043/maps. Usable result from /proc/26044/maps. Usable result from /proc/26051/maps. Usable result from /proc/26054/maps. Usable result from /proc/26055/maps. Usable result from /proc/26065/maps. Usable result from /proc/26070/maps. Usable result from /proc/26073/maps. Usable result from /proc/26079/maps. Usable result from /proc/26083/maps. Usable result from /proc/26087/maps. Usable result from /proc/26091/maps. Usable result from /proc/26095/maps. Usable result from /proc/26100/maps. Usable result from /proc/26122/maps. Usable result from /proc/26124/maps. Usable result from /proc/26129/maps. Usable result from /proc/26131/maps. Usable result from /proc/26136/maps. Usable result from /proc/26149/maps. Usable result from /proc/26154/maps. Usable result from /proc/26158/maps. Usable result from /proc/26161/maps. Usable result from /proc/26168/maps. Usable result from /proc/26180/maps. Usable result from /proc/26230/maps. Usable result from /proc/26235/maps. Usable result from /proc/26241/maps. Usable result from /proc/26243/maps. Usable result from /proc/26244/maps. Usable result from /proc/26272/maps. Usable result from /proc/26278/maps. Usable result from /proc/26340/maps. Usable result from /proc/26352/maps. Usable result from /proc/26647/maps. Usable result from /proc/28791/maps. Usable result from /proc/28936/maps. Usable result from /proc/29512/maps. Usable result from /proc/29533/maps. Usable result from /proc/29535/maps. Usable result from /proc/29930/maps. Usable result from /proc/29943/maps. Usable result from /proc/29945/maps. Usable result from /proc/29959/maps. Usable result from /proc/30225/maps. Usable result from /proc/30231/maps. Usable result from /proc/30257/maps. Usable result from /proc/30270/maps. Usable result from /proc/30303/maps. Usable result from /proc/30306/maps. Usable result from /proc/30309/maps. Processes read : 69, total heap used = 179240960, average heap size = 2597695.00
Submission: Please email me your code.