The lack of consistency in what you can READ in /proc makes it hard to
believe its useful in the "wide" -but I am sure specific things get
benefit from it, as an abstraction which makes code simple because
"its a file"
if you're WRITING into things in /proc, I think you own the pain be it
an ioctl() or anything else.
I see occasional shell scripts about turning on and off meta-state for
SCSI or SAS as "cat 0 >
/dev/somedir/some-model-of-abstraction/some-disk" and while I applaud,
I also wince. So easy to go wrong..
As a long-term user and non-developer, I'm sort of half a believer,
half not. Maybe if it had emerged before the great Schism(s) it would
be more normal? sane? understandable?
-G
On Wed, Jun 26, 2019 at 11:04 AM ron minnich <rminnich(a)gmail.com> wrote:
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.