Subject: Re: vmstat, iostat etc no longer work?
To: Curt Sampson <>
From: Bill Studenmund <>
List: current-users
Date: 11/12/1996 12:11:29
On Tue, 12 Nov 1996, Curt Sampson wrote:

> On Mon, 11 Nov 1996, Greg Hudson wrote:
> > At least one core team member (mycroft) has expressed support for the
> > idea that the kernel should always keep the symbol table in core...
> Ouch! My Sun 3/50 would not like that in the slightest.
> It's possible in some ports (such as the alpha) to get the name of
> the loaded kernel. In others, such as the i386, it may be possible
> for the boot loader to pass this on to the kernel. Why not have a
> new sysctl variable, kern.filename or whatever, that contains the
> filename that the kernel was loaded from? Then we just need to execute
> the following in /etc/rc after /var is mounted:
> 	rm -f /var/run/kernel
> 	if [ -n "`sysctl kern.hostname`" ]; then
> 	    ln -s `sysctl kern.hostname` /var/run/kernel
> 	fi
> cjs

It's obvious a one-size-fits-all solution won't work. How about:

1) add sysctl kern.kernelname and kern.kerneltable. The difference is the
former is the name of the kerne file (if available) and the latter is
where to look for the symbol table file. They aren't always the same!

2) If you're keeping the symbol table around (either for ddb or because
you want to), and you have kernfs around, kern.kerneltable returns
"/kern/kernfs's_name_for_the_exported_symboltable". If you're not keeping
the symbol table aroud, but can get at the kernel file, this returns that
file name. If you aren't keeping the symbol table, and you can't get at
the kernel file (it was off tape or floppy or such), then this sysctl
returns "/netbsd" and you pray. :-)

The advantage of using kernfs even if you can get at the booted kernel is
that it allows you to get at symbols for lkm's. Using kernfs as opposed to
some sysctl or other interface (IMHO) is simpler as the userland routines
only have to know how to read a file. The kernel can hack together a file
header for the kernfs export.

I think this route would keep things flexable, light, and fast.

Unfortunately I can't just go off and code it right now. :-(

Take care,