RFC: sysctl additional functions/macros

John Baldwin jhb at freebsd.org
Fri Jan 4 09:09:15 PST 2008


On Friday 04 January 2008 11:18:29 am Poul-Henning Kamp wrote:
> In message <477E592B.9040106 at elischer.org>, Julian Elischer writes:
> >John Baldwin wrote:
> 
> >right, so you've solved that one.. 
> 
> Please no!
> 
> This is far more complicated and wasteful than it needs to be.
> 
> Please just include the code in the macro call and instantiate
> a function with that code inlined.

Your code body in the example though is the just the validation step, it 
doesn't have all the copyin/copyout goop (nor should it).  Are you really 
worried about the overhead of having a worker function call a function 
containing the validation code?  Provided enough validated sysctls you'd 
actually result in less actual kernel text (1 copy of the copyin/copyout vs 
N, same reason we don't inline sysctl_handle_int() everywhere).

I would probably just start with the FOO_VALIDATED at first and maybe 
FOO_VALIDATOR (that takes the code inline) if cpp(1) is happy with it and not 
worry about _CLAMPED and _BOUNDED.

-- 
John Baldwin


More information about the freebsd-arch mailing list