On Tue, Mar 13, 2012 at 9:08 PM, Isaac Levy <span dir="ltr"><<a href="mailto:ike@blackskyresearch.net">ike@blackskyresearch.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Jason,<br>
<br>
Sorry this took me time to get back to, but your comments are more than welcome- they got me going in the right direction faster:<br>
<div class="im"><br>
On Feb 29, 2012, at 12:21 AM, Jason Hellenthal wrote:<br>
<br>
><br>
><br>
> On Tue, Feb 28, 2012 at 04:57:35PM -0500, Isaac Levy wrote:<br>
>> Hi All,<br>
>><br>
><br>
> Hi.<br>
><br>
>> In the spirit of the dmesg db, I need your sysctls!<br>
>><br>
>> Off-list, just send me the output from:<br>
>> # sysctl -oa ; echo '--' ; dmesg<br>
>><br>
>> Or, if your host has local mail facility:<br>
>> # echo "`sysctl -oa ; echo '--' ; dmesg`" | mail -s "ike sysctl quest" <a href="mailto:ike@blackskyresearch.net">ike@blackskyresearch.net</a><br>
>><br>
><br>
> This is a nice idea and all and dont get me wrong, I am not against it,<br>
> but it would seem more beneficial in creating a structured SYSCTL_DESC<br>
> which would help in narrowing down what is already there and what is not<br>
> allowing to focus on given areas of interest. There might already be a<br>
> way to scope through the code for empty values of where the descriptions<br>
> have been left out but I just don't know about it.<br>
><br>
> Speaking purely of FreeBSD and sysctl(9):<br>
> grep -n SYSCTL_ /usr/src/sys/*/*<br>
<br>
</div>Running from FreeBSD svn checkout r232948:<br>
<br>
# grep -niR SYSCTL_ ./src/* | wc -l<br>
   11795<br>
<br>
# grep -niR SYSCTL ./src/* | wc -l<br>
   18507<br>
<div class="im"><br>
><br>
> grasp the line numbers and file for further processing and the +- some<br>
> lines to grab extra context should get you pretty close to what needs to<br>
> be done.<br>
><br>
> static int sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS);<br>
> SYSCTL_OID(_vm, OID_AUTO, phys_free, CTLTYPE_STRING | CTLFLAG_RD,<br>
>    NULL, 0, sysctl_vm_phys_free, "A", "Phys Free Info");<br>
<br>
</div>SYSCTL_OID seems key to programatically generating documentation from a tool,<br>
<br>
# grep -niR SYSCTL_OID ./* | wc -l<br>
     489<br>
<br>
Based on your notes, I'm sortof following your approach here- the sysctl man pages in section 9 and section 3 both have a ton of info for how I can programatically get all all the mib info, so now I'm off to reasonably parsing the C source with shell utils to get what I need out of it.<br>

<div class="im"><br>
<br>
><br>
><br>
> Don't forget about "options NO_SYSCTL_DESCR" which would effectively<br>
> wipe all these out in a running kernel.<br>
<br>
</div># grep -niR NO_SYSCTL_DESCR ./src/* | wc -l<br>
      10<br>
<br>
Fascinating.  Not in any of the man pages either?  Hrm...<br>
<div class="im"><br>
><br>
><br>
> Anyway after all this these MiBs should be able to be enumerated in a<br>
> fashion that would yield better results than just recieving random<br>
> compilations from different systems. Just my opninion.<br>
<br>
</div>Your opinion is quite valued here- this is the way I'm headed with this now…  I think I can even get all the acceptable values documented in an automated fashion from this- (e.g. will kern.foo it take '1m' as arg, or only '8388608' [bits]?  Is it bootonly (loader.conf) or runtime configurable (sysctl.conf)?)<br>

I'll see as I go along here- any thoughts welcome.<br>
<br>
I'll certainly report back with what comes of it next!<br>
<br>
Best,<br>
.ike<br></blockquote><div><br></div><div>You should also (if you haven't already) give sysctl.h a quick read through (this probably showed up in your grep output):</div><div><br></div><div>/usr/src/sys/sys/sysctl.h</div>
<div> </div><div>Godspeed!</div></div>