summaryrefslogtreecommitdiff
path: root/usr.bin/vmstat/vmstat.c
diff options
context:
space:
mode:
authorThierry Deval <tdeval@cvs.openbsd.org>2002-12-16 01:57:06 +0000
committerThierry Deval <tdeval@cvs.openbsd.org>2002-12-16 01:57:06 +0000
commitda3a34e76ccd83612ffbc890187c29ee4b2960c9 (patch)
tree5e7c9b8bb5df4f4ec21ea8156ecd837aee78b2e9 /usr.bin/vmstat/vmstat.c
parent8d617ca6e54dc39ece5af3b3a927e2dbbe2d3f1f (diff)
Make systat(1), iostat(8) and vmstat(8) automatically update their disk
statistics when a device is added/removed. ok deraadt@
Diffstat (limited to 'usr.bin/vmstat/vmstat.c')
-rw-r--r--usr.bin/vmstat/vmstat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 0ae8ee4cbb3..d341878c388 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -1,5 +1,5 @@
/* $NetBSD: vmstat.c,v 1.29.4.1 1996/06/05 00:21:05 cgd Exp $ */
-/* $OpenBSD: vmstat.c,v 1.72 2002/09/17 19:37:40 deraadt Exp $ */
+/* $OpenBSD: vmstat.c,v 1.73 2002/12/16 01:57:04 tdeval Exp $ */
/*
* Copyright (c) 1980, 1986, 1991, 1993
@@ -117,7 +117,7 @@ struct nlist namelist[] = {
};
/* Objects defined in dkstats.c */
-extern struct _disk cur;
+extern struct _disk cur, last;
extern char **dr_name;
extern int *dk_select, dk_ndrive;
@@ -386,10 +386,10 @@ dovmstat(u_int interval, int reps)
hz = clkinfo.stathz;
for (hdrcnt = 1;;) {
- if (!--hdrcnt)
- printhdr();
/* Read new disk statistics */
dkreadstats();
+ if (!--hdrcnt || last.dk_ndrive != cur.dk_ndrive)
+ printhdr();
if (nlistf == NULL && memf == NULL) {
size = sizeof(struct uvmexp);
mib[0] = CTL_VM;