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

//  <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to