Module Name: src Committed By: mlelstv Date: Sun Apr 8 11:37:31 UTC 2018
Modified Files: src/usr.sbin/iostat: iostat.c Log Message: Re-evaluate drive selection to catch hog-plug devices. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/iostat/iostat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/iostat/iostat.c diff -u src/usr.sbin/iostat/iostat.c:1.66 src/usr.sbin/iostat/iostat.c:1.67 --- src/usr.sbin/iostat/iostat.c:1.66 Sat Sep 9 23:51:58 2017 +++ src/usr.sbin/iostat/iostat.c Sun Apr 8 11:37:31 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $ */ +/* $NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $ */ /* * Copyright (c) 1996 John M. Vinopal @@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19 #if 0 static char sccsid[] = "@(#)iostat.c 8.3 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $"); +__RCSID("$NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $"); #endif #endif /* not lint */ @@ -210,14 +210,6 @@ main(int argc, char *argv[]) if (todo == 0) errx(1, "no drives"); } - if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) { - lines = ndrives; - hdroffset = 3; - } else { - lines = 1; - hdroffset = 4; - } - tv.tv_sec = interval; tv.tv_nsec = 0; @@ -225,6 +217,14 @@ main(int argc, char *argv[]) (void)signal(SIGCONT, sig_header); for (hdrcnt = 1;;) { + if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) { + lines = ndrives; + hdroffset = 3; + } else { + lines = 1; + hdroffset = 4; + } + if (do_header || (hdrcnt -= lines) <= 0) { do_header = 0; header(); @@ -244,6 +244,8 @@ main(int argc, char *argv[]) nanosleep(&tv, NULL); cpureadstats(); drvreadstats(); + + ndrives = selectdrives(argc, argv); } exit(0); }