mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Rosmanith <kernel@wildsau.enemy.org>
To: Robert Hancock <hancockr@shaw.ca>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: procfs uglyness caused by "cat"
Date: Wed, 15 Mar 2006 09:06:30 +0100 (MET)	[thread overview]
Message-ID: <200603150806.k2F86VEf016534@wildsau.enemy.org> (raw)
In-Reply-To: <4416D4A3.9070705@shaw.ca>

> > static int uptime_read_proc(char *page, char **start, off_t off,
> >                                  int count, int *eof, void *data)
> > {
> >         struct timespec uptime;
> >         struct timespec idle;
> >         int len;
> >         cputime_t idletime;
> > 
> > +	if (off)
> > +		return 0;
> 
> Except that this is wrong - if you try to advance the offset a bit from 
> the start of the file and read something, you'll get nothing. This is 
> inconsistent with normal file behavior.

so what - "uptime_read_proc" ignores the offset parameter anyway.
you get wrong results right now, too, even without the two lines
I've added.

if you write "Except that this is wrong" you should have in mind that
"this is wrong" currently, too.

just "try to advance the offset a bit from the start of the file and
read something", like "dd if=/proc/uptime bs=1 count=1 seek=1".
do you expect to get right results?

regards,
h.rosmanith



  parent reply	other threads:[~2006-03-15  8:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5Qfgo-3At-15@gated-at.bofh.it>
2006-03-14 14:35 ` Robert Hancock
2006-03-14 15:33   ` Paul Rolland
2006-03-14 17:59     ` Paul Jackson
2006-03-14 18:45       ` Paul Rolland
2006-03-15  8:06   ` Herbert Rosmanith [this message]
2006-03-15  8:23   ` Herbert Rosmanith
2006-03-14 10:43 Herbert Rosmanith
2006-03-14 15:57 ` Paul Jackson

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=200603150806.k2F86VEf016534@wildsau.enemy.org \
    --to=kernel@wildsau.enemy.org \
    --cc=hancockr@shaw.ca \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome