Subject: Re: sysctl constants (was Re: sysctl knob to let sugid processes dump core (pr 15994))
To: Quentin Garnier <cube@cubidou.net>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 01/15/2006 13:55:20
On Sat, Jan 14, 2006 at 01:59:53PM +0100, Quentin Garnier wrote:
>On Sat, Jan 14, 2006 at 10:40:06AM +0200, Elad Efrat wrote:
>> YAMAMOTO Takashi wrote:
>> 
>> > is it still desirable to assign these constants these days?
>> > or are they superseded by CTL_CREATE?
>> 
>> I would expect the #defines to be still needed (as we use them
>> when calling sysctl_createv) but IIRC the FOO_NAMES was used
>> by sysctl(8) before the move to the new sysctl(9)... though I
>> never really bothered checking.
>> 
>> If Andrew says they're not needed I'll do a sweep (!) of removing
>> them, if desired.
>
>The constants are historical.  No new constant should be defined.
>
>What is there exists to keep binary compatibility.  New nodes should
>be created with CTL_CREATE.

what he said.  there should be no need to #define new names, unless
you really want to reserve a specific mib in the tree for yourself.
it's not disallowed at all, but mostly just unnecessary these days.

FOO_NAMES *was* used by the older sysctl(8) implementation and was
left in so that old code could still compile.  they could probably be
removed, though someone would have to check that no other code uses
them yet.

one word of caution when removing names.  calling sysctlbyname()
incurs malloc which incurs a call to sysctl(3) to find out the page
size, so just be careful about what gets removed.

-- 
|-----< "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."