sysctl: good practices and how to deprecate a node

John Baldwin jhb at
Fri Mar 7 14:19:07 UTC 2008

On Friday 07 March 2008 05:11:17 am Jean-Sébastien Pédron wrote:
> Hello,
> I'm currently working again on the Synaptics Touchpad support[1] in psm(4).
> The enable_synaptics() probe function adds a subtree to "hw.psm"; I
> didn't changed its behaviour for now. This subtree is created only if:
>     o  "hw.psm.synaptics_support" is true
>     o  no previous probe function "took" the device.
> If the function doesn't find a Synaptics touchpad, the tree is left
> created.
> First, is enable_synaptics() the right place to add this subtree
> (compared to a "globally" created tree, like "hw.psm")?


> If enable_synaptics() is the way to go, should it be always created if
> "hw.psm.synaptics_support" is true, even if no touchpad is found? Or
> only when the touchpad is detected? 

Probably only if you have an actual touchpad.

> In psmsoftintr(), the code in FreeBSD doesn't check for bad sysctl
> values. My patch doesn't do it either for now. But wrong values could
> cause division by zero for example. Is there a way to check sysctls only
> when they are modified, instead of before every use?

Yes, use a SYSCTL_PROC() for those nodes.

> Last question: I expanded the Synaptics subtree with my own nodes but
> there are three nodes which are not used anymore. How should I handle
> deprecation of these nodes?

Just remove them.

John Baldwin

More information about the freebsd-hackers mailing list