Re: Machine friendly format for /proc files

Nigel Metheringham (Nigel.Metheringham@ThePLAnet.net)
Tue, 18 Feb 1997 09:30:36 +0000


kwrohrer@uiuc.edu said:
} That sounds fairly good; I'm not sure whether we want 2D tables like /
} proc/net/dev to stay line-per-device, or be line-per-parameter; their
} 2D format does mean you'll have to keep track of both rows and columns
} anyway, and doesn't succumb to any compact 1D format...

Another thing to watch is that some of the (potentially) long tabular
files, such as /proc/net/route and /proc/net/ip_masquerade, use fixed
length records (they are padded up to 128 bytes per line), this allows
seeking into the data easily. That may not sound like a big advantage,
however the proc drivers only pass back a particular size chunk of data at
a time, so a sequential read of a large proc file actually results in a
series of calls to the proc file generating function, and with changing
data (such as the ip_masquerade timestamps) can mean that the chunks don't
"fit together" unless you are very careful (hence the use of fixed length
records).

In any case the thing you read is not necessarily a snap shot of any
particular point in the kernel state... the first bit may come from one
point in time, the rest from another... and they need not be self
consistent :-(.

Nigel.

Nigel.

-- 
[ Nigel.Metheringham@theplanet.net   -  Systems Software Engineer ]
[ Tel : +44 113 251 6012                   Fax : +44 113 224 0003 ]
[            Dedicated to the replacement of sendmail!            ]