Re: reading /proc values thorugh C code
- From: Joe Pfeiffer <pfeiffer@xxxxxxxxxxx>
- Date: 18 Feb 2008 10:48:57 -0700
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.
.
- Follow-Ups:
- Re: reading /proc values thorugh C code
- From: thomas . mertes
- Re: reading /proc values thorugh C code
- References:
- reading /proc values thorugh C code
- From: uday kiran
- reading /proc values thorugh C code
- Prev by Date: ALSA PCM play one small problem
- Next by Date: Re: How to wait for multiple threads simultaneously?
- Previous by thread: Re: reading /proc values thorugh C code
- Next by thread: Re: reading /proc values thorugh C code
- Index(es):