Re: reading /proc values thorugh C code
- From: thomas.mertes@xxxxxx
- Date: Wed, 20 Feb 2008 02:12:54 -0800 (PST)
On 18 Feb., 18:48, Joe Pfeiffer <pfeif...@xxxxxxxxxxx> wrote:
uday kiran <s.udaiki...@xxxxxxxxx> writes:I agree. There is one thing: /proc changes dynamic.
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().
You could read an entry with readdir() and when you try to open() it,
the file has disappeared (I know this can happen everywhere, but
elsewhere it does not happen so often). As good programmer you
check the result of open() and there will be no problem...
Greetings Thomas Mertes
Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch.
.
- References:
- reading /proc values thorugh C code
- From: uday kiran
- Re: reading /proc values thorugh C code
- From: Joe Pfeiffer
- reading /proc values thorugh C code
- Prev by Date: Re: How to wait for multiple threads simultaneously?
- Next by Date: download peak control
- Previous by thread: Re: reading /proc values thorugh C code
- Next by thread: ALSA PCM play one small problem
- Index(es):
Relevant Pages
|