Counting access to proc file.
From: Frank (nospam_at_nospam.net)
Date: 02/23/05
- Previous message: Christopher Browne: "Re: Team System ? ?"
- Next in thread: Kasper Dupont: "Re: Counting access to proc file."
- Reply: Kasper Dupont: "Re: Counting access to proc file."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 23 Feb 2005 07:49:04 +0100
Hi,
I've just started to try to write my first module for linux. The module
can only output some info at a proc entry. Everytime it's called it
counts how many times it has been called (Just to play some around).
This is the code to output the data:
static int proc_read_proc(char *page, char **start,
off_t off, int count,
int *eof, void *data)
{
int len;
load_count = load_count + 1;
len = sprintf(page,"Test entry, called %d times since
loading\n",load_count);
dbg("Proc entry called!");
return len;
}
I've expected it to just counts 1 by 1. It starts well, with 1, but then
continues with 4, 7, 10, 13, etc. It kinda puzzles me. What is causing
the value not to add properly (as I want ;) )
Thanks in advanced,
Frank de Bot
- Previous message: Christopher Browne: "Re: Team System ? ?"
- Next in thread: Kasper Dupont: "Re: Counting access to proc file."
- Reply: Kasper Dupont: "Re: Counting access to proc file."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]