<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">>> I want process related information like rss.(we can get this by doing cat /proc/<pid>status) Is there a way to get this from >> within a kernel module? I checked out the sources on /proc filesystem. They all show how to create, read, write a new</div>
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">>> proc file. But I want to read from an existing proc file specifically /proc/<pid>/status
</div></blockquote><div> <br></div><div>Have a look here: <a href="https://gist.github.com/Aruna-Hewapathirane/f41e7291e15bae6062a1">https://gist.<span tabindex="-1" id=":2oq.1" style class="">github</span>.com/<span tabindex="-1" id=":2oq.2" style class="">Aruna</span>-<span tabindex="-1" id=":2oq.3" style class="">Hewapathirane</span>/f41e7291e15bae6062a1</a> does exactly what your trying to do.<br>
</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>>> Can anyone please point me to either resources or guide me to accomplish the task of reading information from <br>
</div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">>>/proc/files...<br></div></blockquote><div><br></div><div>I would suggest you go through the source code for PS : <a href="http://procps.sourceforge.net/">http://<span tabindex="-1" id=":2oq.4" style class="">procps</span>.<span tabindex="-1" id=":2oq.5" style class="">sourceforge</span>.net/</a> and carefully study how things are done.<br>
<br></div></div>This will also help: <a href="https://www.kernel.org/doc/Documentation/filesystems/proc.txt">https://www.kernel.org/doc/Documentation/<span tabindex="-1" id=":2oq.6" style class="">filesystems</span>/<span tabindex="-1" id=":2oq.7" style class="">proc</span>.<span tabindex="-1" id=":2oq.8" style class="">txt</span></a><br>
<br></div><div class="gmail_extra">That being said I have to agree fully with <span tabindex="-1" id=":2oq.9" style class="">Valdis</span> the best way is always to grep through the kernel that way you get to see code that is being used and how things are done.<br>
<br></div><div class="gmail_extra">With all due respect to all the more experienced and knowledgeable folks on the list I had great difficulty when I first started out accessing information and I have no wish to see anyone who is fascinated by the kernel and wants to mess with the internals be it for fun as a hobby to learn or for serious patching and contributing to the kernel walk away frustrated like I did so many times. ( I always walked right back though... :)<br>
<br></div><div class="gmail_extra">Yes <span tabindex="-1" id=":2oq.10" style class="">Valdis</span> you can give me a hard time on <span tabindex="-1" id=":2oq.11" style class="">IRC</span> when I next show up :)<br><br>
</div><div class="gmail_extra"><span tabindex="-1" id=":2oq.12" style class="">Aruna</span> ( <span tabindex="-1" id=":2oq.13" style class="">Ravali</span>, please heed <span tabindex="-1" id=":2oq.14" style class="">Valdis's</span> advice that is the best way. I just pointed you in the right direction with a bit more code to play with but try to do your own digging first through the kernel and good luck ! )<br>
</div></div>