Re: procfs uglyness caused by "cat"

From: Robert Hancock
Date: Tue Mar 14 2006 - 09:32:58 EST


Herbert Rosmanith wrote:
a simple way to get rid of this:

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.

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@xxxxxxxxxxxxx
Home Page: http://www.roberthancock.com/

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