Re: size of files in /proc

C. Scott Ananian (cananian@lcs.mit.edu)
Wed, 20 May 1998 16:59:28 -0400 (EDT)


On Tue, 19 May 1998 thospel@mail.dma.be (Ton Hospel) wrote:

> But even then I'd like /proc to report the unknown sizes as 1, not 0.
> Because I like to be able to export /proc over NFS, and NFS doesn't even
> bother to read the file if the size is 0.
>
> A(nother) possibility is to cache the size from last time the file contents got
> generated. For most files that should be in the right ballpark.

This is exactly the Wrong Thing To Do. A file size of zero indicates that
the file is special in some way. Trying to guess the "right" value and
missing is Much Worse -- you're actually giving wrong information and
creating situations where programs work "most of the time" -- except for
that time when the guess is very wrong and everything breaks.

NFS needs fixing, not /proc. A zero-sized file is the best way to say "I
don't know."

[Note that silly mmap implementations of (for example) cp may have
problems with zero-length files, as well. They would have the same
troubles with 'finite but wrong' sized files, except the bugs would be
much more subtle.]
--Scott
@ @
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-oOO-(_)-OOo-=-=-=-=-=
C. Scott Ananian: cananian@lcs.mit.edu / Declare the Truth boldly and
Laboratory for Computer Science/Crypto / without hindrance.
Massachusetts Institute of Technology /META-PARRESIAS AKOLUTOS:Acts 28:31
-.-. .-.. .. ..-. ..-. --- .-. -.. ... -.-. --- - - .- -. .- -. .. .- -.
PGP key available via finger and from http://www.pdos.lcs.mit.edu/~cananian

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu