Subject: Re: dynamic sysctl
To: David Laight <firstname.lastname@example.org>
From: Andrew Brown <email@example.com>
Date: 11/18/2003 15:38:53
>> int name, namelen = 2;
>> sysctlnametomib("kern.securelevel", &name, &namelen,
>> NULL, NULL, NULL);
>> sysctl(&name, 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!
>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
|-----< "CODE WARRIOR" >-----|
firstname.lastname@example.org * "ah! i see you have the internet
email@example.com (Andrew Brown) that goes *ping*!"
firstname.lastname@example.org * "information is power -- share the wealth."