Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Mar 2000 13:31:14 +0100 (BST)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Andrzej Bialecki <abial@webgiro.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Dynamic sysctls - patches for review
Message-ID:  <Pine.BSF.4.21.0003261325200.89245-100000@salmon.nlsystems.com>
In-Reply-To: <Pine.BSF.4.20.0003241623050.31345-100000@mx.webgiro.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 442 9037




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0003261325200.89245-100000>