On Tue, Jun 25, 2019 at 06:03:47PM -0700, ron minnich wrote:
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.
When looking at linux's /proc, there are three broad categories of
stuff:
* Traditional process-specific files, in /proc/<pid>/...
* System configuration parameters, aka "sysctls", which are
in /proc/sys/...
* Other miscellaneous ad-hoc files
It's the last category where there has been a big push to only add new
files in /sys (aka sysfs), and in general the vast majority of new
files have been going into sysfs, and not into /proc. However, for
backwards compatibility reasons, all of the old ad-hoc /proc files
have stuck around.
The files in /sys and /proc/sys tend to be very discplined, in that
it's one value per file. That's both a good and bad thing. We don't
have a general, efficient, way of supporting files that return a
variable list of fields, especially if there is no obvious key.
(e.g., like /proc/mounts). And it's certainly the case that looking
at, say, /proc/scsi/scsi is much more conveient that iterating over
/sys/bus/scsi/devices and grabbing a huge number of tiny files to get
the same information.
This last is the usual reason where there is temptation by some
developers to add a new file in /proc, as opposed to adding several
dozen files (per device/process/network connection) in /sys and then
needing to promulgate a perl/python/go program to actually get a user
friendly status report out.
- Ted