Subject: Re: difference between sysctl and sysctl
To: kamel derouiche <>
From: Martin Husemann <>
List: tech-kern
Date: 01/15/2005 09:26:27
On Sat, Jan 15, 2005 at 02:19:40AM +0100, kamel derouiche wrote:

> - or is the difference between sysctl(3) and sysctl(9)

The section names (3 vs. 9) have standard meanings, you get a hint at the
top line of the manual page. sysctl(3) describes how you can use sysctl()
from userland, i.e. when writting applications. Sysctl(9) describes the
kernel internal interface to sysctl, i.e. what you need to use if you
write kernel code that supports sysctl'able settings.

> - what is new sysctl (9) for settings kernel interface

Previously all sysctls had to be known in advance and have been assigned a 
fixed number, called a MIB (not quite that simple, but you get the idea).

In the new scheme, kernel components can create and destroy nodes or whole
subtrees at runtime, for example when you insert a pcmcia card and the driver
allows controll over some features of the card via sysctl. Or for SMP kernels,
where some nodes are duplicated for every CPU (try "sysctl -A kern.cp_time"
on such a machine)

As a side effect, the userland sysctl binary does not need to know the meaning
of the internal encoding of the sysctl anymore, i.e. you do not need to rebuild
the sysctl(8) binary every time someone added new nodes inside the kernel.

Actually it can even do more, like create sysctl nodes from userland and bind
them to existing kernel variables, and probably other things that I