Re: reading /proc values thorugh C code



uday kiran <s.udaikiran@xxxxxxxxx> writes:

Hi all,
I have been looking for quite some time to read /proc entries through
a c code. I understand that there are directories with pids. If there
is a library or a kernel structure that lets us to do so. Please let
me know.

You just read them. If you want to read /proc, you open it with
opendir() and read the entries with readdir(). If you want to read
/proc/1, you do the same. If you want to read /proc/1/maps, you open
it with open() and read it with read().

If you want to use stdio, you just use its functions (like fopen() and
fread()) instead.

That's really the point -- no new API needed, just leveraging the
"everything is a file" model.
.