All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent <laurent@augias.org>
To: linux-kernel@vger.kernel.org
Subject: read_proc issue
Date: Tue, 26 Feb 2002 19:21:16 +0100	[thread overview]
Message-ID: <E16fmE1-0000Mu-00@lsinitam> (raw)

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

             reply	other threads:[~2002-02-26 18:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-26 18:21 Laurent [this message]
2002-02-27 19:33 ` read_proc issue 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
  -- 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=E16fmE1-0000Mu-00@lsinitam \
    --to=laurent@augias.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.