Subject: Re: dynamic sysctl
To: David Laight <david@l8s.co.uk>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 11/18/2003 15:38:53
>> 	int name[2], namelen = 2;
>> 	sysctlnametomib("kern.securelevel", &name[0], &namelen,
>> 			NULL, NULL, NULL);
>> 	sysctl(&name[0], namelen, ...
>> 
>> (though i've grown particularly fond of merely using 1.9 on the
>> command line to represent kern.securelevel -- it's a lot lesss
>> typing :).
>
>(Yes - there is no reason why the current sysctl program couldn't
>just accept random numeric tags...)

well...the *current* sysctl program doesn't have an easy way to map
the numbers back to names and types, so...  ;-)

>> that uses the kernel's name<->number mapping and not the header file
>> and the program continues to "know" what it's asking for.
>
>I suspect we are arguing over finer points of agreement!

probably.

>My thought was the the application doesn't ever(?) need to know that the
>numbers exists at all, so you might just as well pass the string into the
>kernel and have it find the data item while parsing the string.

that could be done easily enough.  i just haven't done that.

>> >Maybe, in time, the numbers could be depracated....
>> 
>> sure, though the sysctl() interface would have to be abandoned at that
>> point in favor of something else.
>
>Well you are adding a system call to convert names to numbers, why not
>add 'sysctl by name' instead?

actually, i'm just extending sysctl() sideways a little to add some
functionality.  such as retrieving the name<->number mapping.  or
other stuff.  it's not really a new system call at all.  it does all
the old one did, in exactly the same way, but it does some other
things, too.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
werdna@squooshy.com       * "information is power -- share the wealth."