Re: unwanted double reads in /proc routines
- From: "Slaytanic" <gianni.costanzi@xxxxxxxxx>
- Date: 16 Aug 2006 10:30:04 -0700
Bernhard Holzmayer wrote:
can anyone please help me to shed some light onto this strange behavior.
Here are the facts:
device driver (kernel 2.6.8) using /proc entries to communicate.
Now, I see the printk() message twice (!!) for every read which I issue like
"cat /proc/.../state"
The response is ok.
If I leave out the line *eof=1; there are even three (!) lines from printk.
Who does understand this?
Hi, does the offset value change from one call to the other one? I had
the same problem and even if I was setting *eof to 1, the routine was
called a second time with an offset value set to the amount of data I
returned in the first call.. It seems that the read routine is called
untill it returns 0 (any other better explaination would be appreciated
:) )
I solved the problem by adding
if (offset != 0) {
*eof = 1;
return 0;
}
at the beginning of the function.. This is fine for me, since I write
only few data and it should not be necessary to make multiple read
calls to read it.
Hope it helps..
.
- References:
- unwanted double reads in /proc routines
- From: Bernhard Holzmayer
- unwanted double reads in /proc routines
- Prev by Date: Re: unwanted double reads in /proc routines
- Next by Date: Re: Inject a shared library or DLL into a running process in Linux
- Previous by thread: Re: unwanted double reads in /proc routines
- Next by thread: Re: unwanted double reads in /proc routines
- Index(es):
Relevant Pages
|