Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/iostat Re-evaluate drive selection to catch hog-plu...



details:   https://anonhg.NetBSD.org/src/rev/069237c27bba
branches:  trunk
changeset: 831631:069237c27bba
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Apr 08 11:37:31 2018 +0000

description:
Re-evaluate drive selection to catch hog-plug devices.

diffstat:

 usr.sbin/iostat/iostat.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (57 lines):

diff -r bbceda1807b4 -r 069237c27bba usr.sbin/iostat/iostat.c
--- a/usr.sbin/iostat/iostat.c  Sun Apr 08 10:56:05 2018 +0000
+++ b/usr.sbin/iostat/iostat.c  Sun Apr 08 11:37:31 2018 +0000
@@ -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 @@
 #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 @@
                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 @@
        (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 @@
                nanosleep(&tv, NULL);
                cpureadstats();
                drvreadstats();
+
+               ndrives = selectdrives(argc, argv);
        }
        exit(0);
 }



Home | Main Index | Thread Index | Old Index