From owner-freebsd-current Mon Jan 25 09:34:08 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA14193 for freebsd-current-outgoing; Mon, 25 Jan 1999 09:34:08 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA14185 for ; Mon, 25 Jan 1999 09:34:02 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from localhost (dfr@localhost) by nlsystems.com (8.9.1/8.8.5) with SMTP id RAA87871 for ; Mon, 25 Jan 1999 17:36:06 GMT Date: Mon, 25 Jan 1999 17:36:00 +0000 (GMT) From: Doug Rabson To: current@FreeBSD.ORG Subject: Dynamic sysctl registration 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 I've made some changes to sysctl to allow nodes to be declared dynamically either by loading kld modules which contain SYSCTL declarations or, in theory, by generating oids from some other kernel data such as the device tree. To recap for those that are interested, the existing scheme uses linker sets to represent interior nodes of the tree. Each child node has a pointer in its parent's linker set (contained in the parent's oid_arg1 field). This is hard to make dynamic because linker sets can't easily be extended without wastefully allocating and reallocating memory. I have changed the code to use an SLIST to store the list of children for an interior node. This has the advantage that nodes can be easily added and removed. There is an associated cost (about 8 bytes per node on i386) which I think is reasonable. All the oids in the kernel (or kld module) are collected together in a single linker set from which the tree is constructed by threading the oids onto their parent's list. The kernel-user interface is completely unchanged. If anyone is interested in seeing diffs (approx 23k), please contact me. -- 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