Re: procfs uglyness caused by "cat"

From: Paul Rolland
Date: Tue Mar 14 2006 - 13:42:57 EST


Hello,

> main()
> {
> char c;
> int fd = open("/proc/uptime", 0);
> while (read(fd, &c, 1) == 1) {
> write(1, &c, 1);
> sleep(1);
> }
> }

Yes, much better, same result for 2.2.x and 2.4.31 :
bash-2.05# cat /proc/uptime; ./test2
112049.81 111665.11
112054.89 111670.29

The result is more "correct", but I guess this makes it worse for
Herbert, as uptime_read_proc() is then called for each character...

Paul

-
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/