Subject: Re: kvm
To: David Brownlee <>
From: Brian C. Grayson <>
List: tech-kern
Date: 08/20/1997 11:53:56
David Brownlee wrote:
> 	Are you booting from each kernal as /netbsd?
> 	The kvm routines will use /netbsd to determine where to look in
> 	memory for data (IIRC)

  Would it be worth the effort to make /etc/rc a bit smarter?
For example, it could grab the version string of the running
kernel from uname -v, and then do pattern matching on /*netbsd*
to find the unique (provided one isn't manually patching
kernels?) matching kernel, and use that for kvm_mkdb.  If
it found multiple matches, or no matches, it could print a
warning, rather than silently using /netbsd.

  If speed is a concern, one could write a simple C program that
did a series of kvm_open() calls and grabbed just the 'version'
string directly from each potential kernel -- that should be
pretty quick.  It should be a small executable -- a loop of
kvm_open, kvm_nlist, kvm_read, and strcmp.

  Such a utility program could also be used by top and friends so
that they work with non-/netbsd kernels -- they could do a
kvm_open of what they get from popen("getkernelname") rather
than kvm_open of NULL, for those familiar with kvm_open.

  Of course, if one is booting off of a media such that the
kernel file is not accessible at /etc/rc time (netboot? some
floppy boots?), you're out of luck, but you are out of luck
currently anyway, plus a warning would let you _know_ you are
out of luck.  :)

Brian Grayson (
Graduate Student, Electrical and Computer Engineering
The University of Texas at Austin
Office:  ENS 406       (512) 471-8011
Finger for PGP key.