Re: /proc guidelines and sysctl

From: Theodore Y. Ts'o (tytso@MIT.EDU)
Date: Fri Jan 07 2000 - 01:26:55 EST


   Date: Thu, 6 Jan 2000 21:50:54 -0500 (EST)
   From: Alexander Viro <viro@math.psu.edu>

> sysctl is deprecated. It's useful in one way only: it has some nice
> functions that can be used to add a block of /proc names. However, it
> has other downsides (allocating silly numbers etc - there should be no
> need for that, considering that the /proc namespace is alreayd a
> perfectly good namespace).

   Oh, please! All we need is sysctlbyname(2) - _not_ a problem, and closes
   all problems with numbers. And it should not work through mounted procfs -
   we can traverse the tree doing comparisons by name just fine. The fact
   that sysctl(8) needs mounted procfs is an artificial misfeature, nothing
   more.

I actually like the original sysctl() design --- including the use of
reserved numbers. After all, we have system calls, and we don't try to
look up system calls when we executed them by name..... why is this OK
for system calls, but not OK for sysctl()?

The main problem with sysctl is that we didn't go far enough. Sysctl is
great for programs in that you don't have to do ASCII parsing.
Unfortunately it doesn't work well for tables; but then again, neither
do the current /proc files that contain tables, which often cause
programs to break when new rows are added.

What I think would be great would be extending sysctl so that it could
easily be used to access tables, by specifying row and columns, but then
also having an easy /proc mirror of that information so that existing
programs (or curious sysadmins who are tuning their system by hand), can
get all of the information simply by cat'ing a /proc file.

But if what you're doing is making it easy for a program to access
system configuration information, IMHO sysctl is a far better interface
than /proc.

   sysctl() is a perfectly reasonable subset of pseudofs-type stuff, with
   well-defined semantics (unlike the rest ;-/). The rest is pretty much a
   maze of twisted little formats, none alike. IMO dissolving the thing is
   _not_ a good idea. You have the final word, indeed, but I think that
   sysctlbyname() may remove most of the problems.

Indeed, /proc is rather messy in the current kernel, and could stand
some cleaning up.....

                                                - Ted

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:08 EST