read_proc issue

Laurent (laurent@augias.org)
Tue, 26 Feb 2002 19:21:16 +0100


Hi everyone, hope I don't disturb too much.

I'm developping a module which uses an entry in /proc (read-only)
Currently my (*read_proc) function just write a integer in my /proc entry
and increments it. Here is the code:

static int number_read_procmem(char *buf, char **start, off_t offset, int
count, int *eof, void *data)
{
int len = 0;

len = sprintf(buf, "%d\n", number_current++);
*eof = 1;
return len;
}

the function is registered in init_module with this:
create_proc_read_entry("number", 0, NULL, number_read_procmem, NULL);

Problem is:
when I 'cat /proc/number' multiple times, instead of getting
0
1
2
3
...

I get
0
2
4
6
...

I've searched the Net for an answer to this but in vain. I'm not sure I
should post this to this list (and I'm very sorry if I indeed shouldn't have)
but this list is my last hope :(

Please can you CC: me the answers to this post as I'm not on the list.
Then again, sorry if I'm intruding and thanks for any help.

Regards,
Laurent Sinitambirivoutin
laurent@augias.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/