From owner-freebsd-current Sun Mar 26 4:24:31 2000 Delivered-To: freebsd-current@freebsd.org Received: from finch-post-10.mail.demon.net (finch-post-10.mail.demon.net [194.217.242.38]) by hub.freebsd.org (Postfix) with ESMTP id 9A60A37B6DC for ; Sun, 26 Mar 2000 04:24:21 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from nlsys.demon.co.uk ([158.152.125.33] helo=herring.nlsystems.com) by finch-post-10.mail.demon.net with esmtp (Exim 2.12 #1) id 12ZC5b-000NSJ-0A; Sun, 26 Mar 2000 12:24:20 +0000 Received: from salmon.nlsystems.com (salmon.nlsystems.com [10.0.0.3]) by herring.nlsystems.com (8.9.3/8.8.8) with ESMTP id NAA98827; Sun, 26 Mar 2000 13:27:21 +0100 (BST) (envelope-from dfr@nlsystems.com) Date: Sun, 26 Mar 2000 13:31:14 +0100 (BST) From: Doug Rabson To: Andrzej Bialecki Cc: freebsd-current@freebsd.org Subject: Re: Dynamic sysctls - patches for review In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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