Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Dec 1999 17:44:31 +0100 (CET)
From:      Andrzej Bialecki <abial@webgiro.com>
To:        Arun Sharma <adsharma@sharmas.dhs.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Fwd: Re: kstat - an API for gathering kernel stats
Message-ID:  <Pine.BSF.4.20.9912081739170.64782-100000@mx.webgiro.com>
In-Reply-To: <19991208083348.A29811@sharmas.dhs.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 8 Dec 1999, Arun Sharma wrote:

> On Mon, Nov 29, 1999 at 10:09:35AM +0100, Andrzej Bialecki wrote:
> > > I was thinking about implementing SMP cpu stats using sysctl today and
> > > I have a question - can I create sysctl nodes dynamically ?
> > > 
> > > i.e.
> > > 
> > > 	for (cpu = 0; cpu < get_num_cpus(); cpu++) {
> > > 		/* create sysctl node here ? */
> > > 	}
> > 
> > Yes. See for example linux emulator or my SPY module:
> > 
> > 	http://www.freebsd.org/~abial/spy
> > 
> > You can also create whole new branches, as the second example shows.
> 
> Thanks - that was useful. However, I noticed that only the leaves 
> (SYSCTL_INT/LONG/STRING) etc can be dynamically created. But nodes
> can't be dynamically created. Am I correct ?

Erhm.. No.

Look closer at the SPY module. I create the whole branch from the root
level. In the standard system there is no such thing as "kld" node,
neither there is a "spy" node. I created both of them. Only then I created
a bunch of leaves (of course, nothing stops you from creating some more
leaves on each intermediate level, if you need them).

The same is with linux emulator. It creates "compat" node, then
"linux" node, and then a couple of sysctls.


Andrzej Bialecki

//  <abial@webgiro.com> WebGiro AB, Sweden (http://www.webgiro.com)
// -------------------------------------------------------------------
// ------ FreeBSD: The Power to Serve. http://www.freebsd.org --------
// --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ ----




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" 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.20.9912081739170.64782-100000>