Subject: Re: dynamic sysctl
To: Jason Thorpe <>
From: Andrew Brown <>
List: tech-kern
Date: 11/14/2003 15:04:56
>> sysctlnametomib() just checks that all the versions are the same at
>> the top of the tree each time it's called, and for those that have
>> changed, it purges that data from its cache.
>Ok.  But you said that ABI compatiblity was maintained with the old 
>code.  I'm not sure how that can be the case if nodes can appear and 
>disappear, thus changing the numbering.

nodes like kern.securelevel are at 1.9 and always will be.  there's no
reason for them to move.  anything that already has an "assigned"
number stays where it is.

the only ones that will disappear and reappear with different
(dynamically assigned) numbers are things being added by users, lkms,
or device drivers that add and remove nodes when devices appear or

if you wanted to load ipsec as an lkm (can you even do that?), it
would always get the numbers it has assigned to it.  otoh, if you
loaded an lkm that wanted to add its own nodes (that you've never
heard of) to the sysctl tree, those numbers would get assigned

>It seems like the node lookup should all be string-based internally, 
>and that a compat syscall should be used for old number-based lookups.

i have a test program that prints the value of once a second.
if it fails to get a result, it calls sysctlnametomib() once a second
until it gets a new mib path.  then it goes back to calling sysctl()
ni order to print the value again.  i can add and remove the node
called as much as i like and sysctlnametomib() (and therefore
the test program) always manages to find it.

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."