Re: procfs uglyness caused by "cat"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux