It'd be nice to actually see the sysctl names not the pointers to arrays in truss.
Depends on D21693
|Unit Tests Skipped|
just a note: int oid[CTL_MAXNAME] is correct (an OID can have CTL_MAXNAME levels in the kernel) but it is useless because the "undocumented interface" can handle up to "CTL__MAXNAME - 2" levels (except 0.3 name2oid), CTL_MAXNAME + 2 for qoid does not solve (unfortunately this false solution is quite widespread)
I would wait to document the magical nodes yet, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240390
here the problem (from the comment above), len + 2 could be 26 > CTL_MAXNAME
I couldn't find any obvious CTL_MAXNAME - 2 (apart of libjail, TBC) so if there is a truncation, it's probably because one of the in-kernel functions doesn't use CTL_MAXNAME + 2. I'll take a look at this but it's out of scope for this review anyway.
I matched the names with the names functions responsible as used by kern/kern_sysctl.c Hope that helps.