On Tue, Jun 25, 2019 at 5:46 PM Larry McVoy <lm(a)mcvoy.com> wrote:
I'm curious what Rob and others think of the Linux /proc. It's string
based and it seems like it is more like /whatever_you_might_want.
it's very handy but quite difficult to work with programatically. The
output is convenient for humans to parse, not very nice for programs
to parse.
/proc on linux has no real standard way of outputting things. You get
tables, tuples, and lists and some stuff I can't classify
(/proc/execdomains, /proc/devices); and, in some cases, some files
give you more than one type of thing. Units are not clear for many
tables.
/proc on linux has far more than just process information, including
stuff that has nothing to do with processes (51 things on my current
linux, e.g. /proc/mounts).
Things are in many cases not self-describing, though lots of /proc
have this issue.
I do recall (possibly wrongly) at some point in the 2000s there was an
effort to stop putting stuff in /proc, but rather in /sys, but that
seems to have not worked out. /proc is just too convenient a place,
and by convention, lots of stuff lands there.
While I was at LANL we did experiment with having /proc come out as
s-expressions, which were nicely self describing, composable, easily
parsed and operated on, and almost universally disliked b/c humans
don't read s-expressions that easily. So that ended.
We've been reimplementing Unix commands in Go for about 8 years now
and dealing with all the variance in /proc on linux was a headache.
You pretty much need a different function for every file in /proc.
And all that said, it's handy, so hard to complain about too much.