Subject: Re: nore on disk stats
To: Jon Buller <>
From: Jason Thorpe <>
List: tech-kern
Date: 11/13/1995 22:16:21
[ Trimmed obscene Cc: list a bit... ]

On Mon, 13 Nov 1995 23:10:36 -0600 
 Jon Buller <> wrote:

 > Perhaps what is needed is a program like 'autoconf' on Pyramid's
 > DC/OSx (their SVR4 alike)  It prints out *everything* the OS knows
 > about the hardware config, and the drivers, etc.  It also has a
 > flag to output a machine parsable version instead of something more
 > human readable.  All their install scripts grep through the output
 > of autoconf to find things...

Well, that would require that our drivers a) store this information, b) 
it's in a consistent form.  If you want just primitive info, I wrote a 
short (~300 lines, including comments) that demonstrates how to get stuff 
like the device name, it's parent device, and it's device class (DV_DISK, 
DV_IFNET, etc.) using libkvm.  On my Sun 4/260:

bigsby (thorpej) ~ 103% ./showdevs
mainbus0, class: generic (dull), root - no parent
cpu0, class: CPU, parent: mainbus0
obio0, class: generic (dull), parent: mainbus0
oclock0, class: generic (dull), parent: obio0
eeprom0, class: generic (dull), parent: obio0
memreg0, class: generic (dull), parent: obio0
zs0, class: tty, parent: obio0
zs1, class: tty, parent: obio0
bwtwo0, class: generic (dull), parent: obio0
ie0, class: network interface, parent: obio0
vmel0, class: generic (dull), parent: mainbus0
vmes0, class: generic (dull), parent: mainbus0
si0, class: generic (dull), parent: vmes0
scsibus0, class: generic (dull), parent: si0
sd0, class: disk, parent: scsibus0
bigsby (thorpej) ~ 104% ls -l showdevs
18 -rwxr-sr-x  1 thorpej  kmem  17439 Nov 13 22:06 showdevs*
bigsby (thorpej) ~ 105%

Note that the way devices are added to the linked list makes it easy to 
see the tree-like structure.

I sent it off to Perry because he asked for more info and, well, for me 
anyhow, writing up a quick bit of example code was easier than  
describing it in English :-)  If anyone else wants a copy of the 
program, just send me a piece of e-mail...


Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939