On Fri, 24 Mar 2000, Andrzej Bialecki wrote:

> Hi,
> 
> Inspired by PR kern/16928 I implemented completely dynamic
> creation/deletion of sysctl trees at runtime. The patches (relative to
> -current) can be found at:
> 
>       http://www.freebsd.org/~abial/dyn_sysctl.tgz
> 
> Included is an example of KLD that creates some subtrees when loaded, and
> deletes them before unloading.
> 
> I'd appreciate some feedback. Thanks!

This stuff looks very useful. I have done this kind of thing 'by hand' in
the past but this should make life quite a bit easier. I think the only
thing in the patch which I would want to change is to rename
sysctl_deltree() to sysctl_delete_tree() to be more consistent with the
naming of other functions.

How much has this been tested? I wonder if the code in
sysctl_deltree() which iterates over the children is correct. Surely the
SLIST_REMOVE called by the child will screw up the SLIST_FOREACH iterator
of the parent. In this kind of situation, I often write things
differently:

        while ((p = SLIST_FIRST(SYSCTL_CHILDREN(oidp)) != NULL) {
                sysctl_deltree(p);
        }

This will make sure that the parent does not access memory after it has
been freed.

--
Doug Rabson                             Mail:  [EMAIL PROTECTED]
Nonlinear Systems Ltd.                  Phone: +44 181 442 9037




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to