Re: sed not working on /proc files

Albert D. Cahalan (acahalan@cs.uml.edu)
Thu, 6 May 1999 00:03:27 -0400 (EDT)


Richard B. Johnson writes:
> On Wed, 5 May 1999, Rogier Wolff wrote:

>> The "files" in /proc should in my opinion not pretend to be files:
>> they should be "pipes". Many programs stat their input file, and if
>> they get "normal file", they have all sorts of assumptions on tricks
>> they can do.
>>
>> For example, "wc -c" will just return the st_size of the file, instead
>> of doing all the work that is normally involved in counting the file.
>
> Just for kicks, I changed them all to pipes, i.e., named FIFOS. This
> broke most of the tools like 'ps`. I gave up.

Don't give up. I'll guess that 'ps' broke because the kernel wouldn't
let it seek. Since 'ps' shares code with 'top', it keeps a few files
open for performance.

Applications should see the /proc files as named FIFOs, but lseek()
must be supported. I'd rather have seekable FIFOs than zero-length
files full of data.

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