From: Laurent <laurent@augias.org>
To: Val Henson <val@nmt.edu>, "Randy.Dunlap" <rddunlap@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: read_proc issue
Date: Thu, 28 Feb 2002 00:32:34 +0100 [thread overview]
Message-ID: <E16gDYp-0000FG-00@lsinitam> (raw)
In-Reply-To: <E16fmE1-0000Mu-00@lsinitam> <Pine.LNX.4.33L2.0202271122040.1463-100000@dragon.pdx.osdl.net> <20020227140432.L20918@boardwalk>
In-Reply-To: <20020227140432.L20918@boardwalk>
> I've encountered this problem before, too. What is the "One True Way"
> to do this cleanly? In other words, if you want to do a calculation
> once every time someone runs "cat /proc/foo", what is the cleanest way
> to do that? The solution we came up with was to check the file offset
> and only do the calculation if offset == 0, which seems pretty
> hackish.
I've tried it and... it works ! :)
Many many thanks :)
In the meantime, I've also followed Tommy Reynolds' advice to not modify
global state variables within read_procmem. I've intercepted a syscall which
does the calculation (I've used the open syscall since it allowed me to
increase the counter by just running vi on any file ;) ) and put it into a
buffer which is dumped when the /proc entry is read. Works great that way too.
By the way, as the final module will intercept syscalls like open, creat,
close, link, unlink, mkdir, etc. , I'm wondering if there'll be a dramatic
negative impact on file operations performance. Is there any efficient method
to measure this ?
In any case, thanks for all the help you gave me :)
Regards,
Laurent Sinitambirivoutin
laurent@augias.org
next prev parent reply other threads:[~2002-02-27 23:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-26 18:21 read_proc issue Laurent
2002-02-27 19:33 ` Randy.Dunlap
2002-02-27 21:04 ` Val Henson
2002-02-27 21:42 ` Alan Cox
2002-02-27 21:44 ` Cort Dougan
2002-02-28 0:05 ` Erik Mouw
2002-02-27 3:19 ` Daniel Phillips
2002-03-01 7:14 ` Erik Mouw
2002-03-01 7:47 ` Alexander Viro
2002-03-01 8:18 ` Laurent
2002-03-01 8:18 ` Alexander Viro
2002-03-01 19:49 ` Cort Dougan
2002-02-27 23:32 ` Laurent [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-02-27 0:51 Thomas Hood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E16gDYp-0000FG-00@lsinitam \
--to=laurent@augias.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rddunlap@osdl.org \
--cc=val@nmt.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox