Subject: Re: Reading sysctl values in the kernel
To: Andrew Brown <atatat@atatdot.net>
From: Alan Ritter <rittera@cc.wwu.edu>
List: tech-kern
Date: 07/24/2005 19:51:27
> i was just confused by the use of CTLFLAG_OWNDESC and no use of
> CTLFLAG_OWNDATA where both are addressed from the same structure.
>

OK thanks, that's something I probably need (I was having some weird
problems entering certain nodes).

>>> also,
>>> the space alloted for each "value" is only as large as the space you
>>> indicate here (via the strlen() call).
>>
>>does sysctl_createv() allocate space to store the sysctl_data
>>(sysctl_un.scu_data.sud_data) field in?  I took a brief look at the
>> source
>>for sysctl_createv() and it didn't seem like it.  Maybe there's something
>>I'm missing here.
>
> sysctl_createv() calls sysctl_create() which abuses^Wuses
> CTLFLAG_OWNDATA for you.  if you also give a pointer to data, it will
> copy it into place for you.  see the code in sysctl_create()
> immediately following the comment "at this point, if sz is zero..."

Thanks for the pointer, I'll check it out.

>>anyway thanks again, I'm really glad that the dynamic sysctl interface
>>is there for me to use :-)
>
> i hope you're finding it easy to use and not too convoluted.  :)

I think my problem comes from the fact that I'm trying to use it for the
same purpose as the Windows registry, whereas the sysctl interface is more
of a replacement for /dev/kmem.  Also this is the first time I've
encountered it; I think the learning curve would have been less steep had
I first experimented with it from a userland program.