Re: /proc/net/dev: candidate for reformatting

Albert Cahalan (albert@ccs.neu.edu)
Thu, 21 Mar 1996 15:35:14 -0500 (EST)


> Despite of some problems with the network card I'd like to present an
> other candidate to reformat a little:
>
> pc1542:/proc/net# cat dev
> Inter-| Receive | Transmit
> face |packets errs drop fifo frame|packets errs drop fifo colls carrier
> lo: 3041 0 0 0 0 3041 0 0 0 0 0
> eth0:16010389 0 421559 0 71224 110093 0 0 0 2578 0
> pc1542:/proc/net#
>
> This is after an uptime of 29 days on a NOT busy machine.
>
> This is from /proc/net/udp:
>
> 67: 00000000:0043 00000000:0000 07 00000000:00000000 00:F09045D1 00000000 0 0
> 111: 00000000:006F 00000000:0000 07 00000000:00000000 00:F09045D1 00000000 0 0
>
> Note the shift because of one more digit for the slot. This applies
> to tcp and raw as well.

This is why _all_ numbers in /proc should be 0-padded hex.

For many files, fixed-record length text is most appropriate.
You get most of the speed of a binary format while /bin/cat
is still usable when the proper tool is missing. It is possible
to read and write hex numbers much faster than decimal numbers,
most of all 0-padded ones at fixed offsets.