tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sysctl(3) and strings



Hi,

I've been trying to use sysctlbyname(3) to set a new string value to a
MIB node that's already created. ( and is of type CTLTYPE_STRING ).
Turns out setting a new string is allowed as long as the length of the
new string is less than that of the current string associated with
that node.

http://nxr.netbsd.org/xref/src/sys/kern/kern_sysctl.c
(kern_sysctl.c,v1.225)

1515     * hmm...not done.  must now "copy in" new value.  re-adjust
1516     * sz to maximum value (strings are "weird").
1517     */
1518    sz = rnode->sysctl_size;

...

1555            if (newlen > sz)
1556                    return (EINVAL);


Looks like "re-adjust sz to maximum value" isn't what is intended here
( at least according to the man page ).

Is this an error or a feature ?

Thanks,
-- 
~Cherry


Home | Main Index | Thread Index | Old Index