Re: sysctl() considered harmful

Richard Gooch (rgooch@atnf.CSIRO.AU)
Wed, 7 Jan 1998 08:15:52 +1100


A. N. Kuznetsov writes:
> In article <199801060047.BAA01590@mira.isdn.cs.tu-berlin.de> you wrote:
> : No effort has been taking to give those sysctls which lost their
> : meaning during 2.1 some reasonable implementation. Most notably,
> : NET_IPV4_FORWARD can probably implemented on top of
> : NET_IPV4_FORWARDING. One exception: NET_IPV4_DYNADDR is apparently
> : the same as NET_IPV4_IP_DYNADDR.
>
> 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.
>
> 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.
>
> 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.
>
> BTW I do not understand also why not to do an ioctl(SYSCTL_{R|W}) on
> open "/proc/sys/...." if someone dislikes ascii assignments.

That's what I did for my MTRR driver (/proc/mtrr). It supports an
ASCII interface for the sysadmin and an ioctl() interface for C
programmes (i.e. X server). IMHO this is a better way of doing it.
The ASCII interface can change without breaking C code.

Regards,

Richard....