Re: procfs uglyness caused by "cat"

From: Paul Jackson
Date: Tue Mar 14 2006 - 10:55:14 EST


Robert Hancock explained what's wrong with your proposal of:
+ if (off)
+ return 0;

For an alternative that seems to work better, see the processing
behind the /proc/<pid>/cpuset file, by grep'ing for seq_file in
kernel/cpuset.c.

Essentially, it composes the result string on the open, and then
lets user code read and seek over that string at will.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.925.600.0401
-
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/