On Sun, 16 Apr 2000, Andrzej Bialecki wrote:

> On Sat, 15 Apr 2000, Zhihui Zhang wrote:
> 
> > 
> > I have two unrelated questions I can not figure out myself:
> 
> > (2) I am trying to display kernel profiling sysctl variables with sysctl
> > -a or sysctl -A without success.  They are defined in subr_prof.c. Why
> > sysctl command can not display them? I can use kgmon.
> 

I spend some time on this.  It turns out that you can not do a sysctl() on
a node without a handler.  For the case of kern.prof, there is a handler,
but that handler - sysctl_kern_prof() - only allows you to access lower
level variables.

When you do sysctl -a or sysctl -A, you use the special {0,2, ..} names to
get the next oids in the MIB tree.  In the routine
sysctl_sysctl_next_ls(), you can see that a node with a handler is skipped
by the following statements:

                if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
                        continue;

                if (oidp->oid_handler)
                        continue;

That is why you can not show kern.prof stuff with command sysctl -a or
sysctl -A. You have to use the way shown in usr.sbin/kgmon/kgmon.c.

-Zhihui



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to