diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/vmstat/names.c | 58 | ||||
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 6 |
2 files changed, 62 insertions, 2 deletions
diff --git a/usr.bin/vmstat/names.c b/usr.bin/vmstat/names.c index ba16804..603be7d 100644 --- a/usr.bin/vmstat/names.c +++ b/usr.bin/vmstat/names.c @@ -34,10 +34,66 @@ */ #if !defined(hp300) && !defined(tahoe) && !defined(vax) && \ - !defined(luna68k) && !defined(mips) + !defined(luna68k) && !defined(mips) && !defined(i386) char *defdrives[] = { 0 }; #endif +#if defined(i386) +/* + * i386 support added by Rodney W. Grimes. + */ +#include <i386/isa/isa_device.h> + +char *defdrives[] = { "fd0", "fd1", "wd0", "wd1", "sd0", "sd1", 0 }; + +int +read_names() +{ + register char *p; + register u_long isa_bio; + static char buf[BUFSIZ]; + struct isa_device dev; + struct isa_driver drv; + char name[10]; + int i = 0; + int dummydk = 0; + int fdunit = 0; + int wdunit = 0; + int ahaunit = 0; + + isa_bio = namelist[X_ISA_BIO].n_value; + if (isa_bio == 0) { + (void) fprintf(stderr, + "vmstat: disk init info not in namelist\n"); + return(0); + } + + p = buf; + for (;; isa_bio += sizeof dev) { + (void)kvm_read(kd, isa_bio, &dev, sizeof dev); + if (dev.id_driver == 0) + break; + if (dev.id_alive == 0) + continue; + (void)kvm_read(kd, (u_long)dev.id_driver, &drv, sizeof drv); + (void)kvm_read(kd, (u_long)drv.name, name, sizeof name); + + /* + * XXX FreeBSD is kinda brain dead about dk_units, or at least + * I can't figure out how to get the real unit mappings + */ + if (strcmp(name, "fd") == 0) dummydk = fdunit++; + if (strcmp(name, "wd") == 0) dummydk = wdunit++; + if (strcmp(name, "aha") == 0) dummydk = ahaunit++; + + dr_name[i] = p; + p += sprintf(p, "%s%d", name, dummydk) + 1; + i++; + } + return(1); +} +#endif /* i386 */ + #if defined(hp300) || defined(luna68k) #if defined(hp300) #include <hp/dev/device.h> diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index 0f3f4ce..e1a8da1 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -107,7 +107,7 @@ struct nlist namelist[] = { { "_pgintime" }, #define X_XSTATS 18 { "_xstats" }, -#define X_END 18 +#define X_END 19 #else #define X_END 14 #endif @@ -115,6 +115,10 @@ struct nlist namelist[] = { #define X_HPDINIT (X_END) { "_hp_dinit" }, #endif +#if defined(i386) +#define X_ISA_BIO (X_END) + { "_isa_devtab_bio" }, +#endif #ifdef mips #define X_SCSI_DINIT (X_END) { "_scsi_dinit" }, |