Re: sysctl() considered harmful

Martin von Loewis (martin@mira.isdn.cs.tu-berlin.de)
Wed, 7 Jan 1998 01:26:05 +0100


> I'm sorry but the most of 2.1.77 NET_IPV4_* and NET_IPV6_* are obsolete.
> So that just imagine, that they do not exist at all :-)
> They will stabilize in 2.2 and, apparently, will have nothing
> common with 2.0.

Are you really saying those 52 NET_IPV4 calls are obsolete? In what
sense? I see all of them implemented. For most of them, I see also
code that depends on it...

> Moreover, I believe all the idea behind binary sysctl() is wrong
> by design. sysctl() touches bowels of kernel, so that you cannot hope
> that a value will be preserved in development or between major releases.

I don't agree. There are indeed several sysctl values that have the
same meaning in 2.0 and 2.1. If IPV4* broke, it is not the fault of
the sysctl concept, but is due to the specific selection of IP
configuration values.

You are essentially claiming that system management will not work in
general, and that those people defining MIBs are wasting their time.

> In other word, sysctl() is NOT an API. It is part of kernel.
> Otherwise there are no reasons why not to get rid of it at all.
> ioctl() is more then enough for this purpose.

No, it is not sufficient. You need a file when you have none.

> BTW I do not understand also why not to do an ioctl(SYSCTL_{R|W}) on
> open "/proc/sys/...." if someone dislikes ascii assignments.

Do you think this would solve the specific problem of breaking
interfaces? If there would have been ioctls for all this IP
configuration in 2.0, I doubt it would have survived in 2.2.

As you say, if the mechanism changes, it is hard to keep the
configuration of it - regardless what the interface to the
configuration is.

sysctl is solving the specific problem of a binary interface to
system-global configuration data. Everything else proposed in place
of it (parsing /proc, mis-using ioctl) is a hack compared to that.

Regards,
Martin