Re: unwanted double reads in /proc routines
- From: Tauno Voipio <tauno.voipio@xxxxxxxxxxxxx>
- Date: Wed, 16 Aug 2006 17:20:25 GMT
Bernhard Holzmayer wrote:
Hi all,
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.
This is the offending procedure:
static int pss__read_enable(char *buf, char **start, off_t offset, int len,
int *eof, void * unused)
{
char * dest = buf;
*eof = 1;
*dest++ = (enable==off) ? '0':'1';
*dest ='\0';
printk( KERN_DEBUG "here we are\n");
return 2;
}
So there is nothing special, it should just respond with a result like "1".
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?
Did you trace to see how many read() calls cat is doing?
--
Tauno Voipio
tauno voipio (at) iki fi
.
- References:
- unwanted double reads in /proc routines
- From: Bernhard Holzmayer
- unwanted double reads in /proc routines
- Prev by Date: Re: semaphore question
- Next by Date: Re: unwanted double reads in /proc routines
- Previous by thread: unwanted double reads in /proc routines
- Next by thread: Re: unwanted double reads in /proc routines
- Index(es):
Relevant Pages
|