Subject: Re: kvm
To: Gordon W. Ross <>
From: Brian C. Grayson <>
List: tech-kern
Date: 08/20/1997 13:11:07
Gordon W. Ross wrote:
> On many ports, the kernel can tell you what name the boot program
> used to load the kernel.  We could make /kern/boot_name contain
> that name, or a new sysctl thing...

  This would work fine for kvm_mkdb, but for general-purpose
kvm utilities, one has the (admittedly rare) problem of `What if I
boot off of /netbsd-test, see that everything works, and then
rename it to /netbsd-good?'.  Currently, a kvm program run
without the -N option will lose both before and after the move,
because it tries only /netbsd.  With the sysctl, programs
started before the move will work okay, but any programs
started after the move would lose, because they would try to
look up /netbsd-test, which no longer exists (and maybe then
fall back to /netbsd, which isn't correct).  One good thing
about my user-level program (or libkvm) idea is that it would
work in both of these situations; however, it does add cost.

  Perhaps keeping track of the inode number in addition to the
pathname would be a good idea?  One can't remove the kernel file
while it is running, right?  Then, the getkernelname() or
sysctl call can do an stat() check on the kernel path, and if
it fails, or if the inode is different from what is recorded,
the getkernelname() routine returns an error (or perhaps does a
more extensive search).

  Maybe there is no solution that fits all situations.  :(
Or maybe I'm just trying to cover too many situations. 
Regardless, if the eventual solution doesn't handle the above
rare case, I'll probably add a utility program to the xosview
distribution to do the right thing.  :)
Brian Grayson (
Graduate Student, Electrical and Computer Engineering
The University of Texas at Austin
Office:  ENS 406       (512) 471-8011
Finger for PGP key.