Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/vmstat WARNS=3



details:   https://anonhg.NetBSD.org/src/rev/89373b1b6bd7
branches:  trunk
changeset: 574333:89373b1b6bd7
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sat Feb 26 21:19:18 2005 +0000

description:
WARNS=3

diffstat:

 usr.bin/vmstat/Makefile  |   3 ++-
 usr.bin/vmstat/dkstats.c |   8 ++++----
 usr.bin/vmstat/vmstat.c  |  16 ++++++++--------
 3 files changed, 14 insertions(+), 13 deletions(-)

diffs (93 lines):

diff -r e6ba949028f5 -r 89373b1b6bd7 usr.bin/vmstat/Makefile
--- a/usr.bin/vmstat/Makefile   Sat Feb 26 21:16:43 2005 +0000
+++ b/usr.bin/vmstat/Makefile   Sat Feb 26 21:19:18 2005 +0000
@@ -1,7 +1,8 @@
-#      $NetBSD: Makefile,v 1.20 2001/05/06 23:37:36 wiz Exp $
+#      $NetBSD: Makefile,v 1.21 2005/02/26 21:19:18 dsl Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/6/93
 
 PROG=  vmstat
+WARNS=3
 
 SRCS=  dkstats.c vmstat.c
 MAN=   vmstat.1
diff -r e6ba949028f5 -r 89373b1b6bd7 usr.bin/vmstat/dkstats.c
--- a/usr.bin/vmstat/dkstats.c  Sat Feb 26 21:16:43 2005 +0000
+++ b/usr.bin/vmstat/dkstats.c  Sat Feb 26 21:19:18 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dkstats.c,v 1.21 2004/02/13 11:36:24 wiz Exp $ */
+/*     $NetBSD: dkstats.c,v 1.22 2005/02/26 21:19:18 dsl Exp $ */
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -241,7 +241,7 @@
  * track disk statistics.
  */
 int
-dkinit(int select)
+dkinit(int selected)
 {
        struct disklist_head disk_head;
        struct disk     cur_disk, *p;
@@ -351,7 +351,7 @@
                        err(1, "sysctl hw.diskstats failed");
                for (i = 0; i < dk_ndrive; i++) {
                        cur.dk_name[i] = dk_drives[i].dk_name;
-                       cur.dk_select[i] = select;
+                       cur.dk_select[i] = selected;
                }
        } else {
                p = dk_drivehead;
@@ -362,7 +362,7 @@
                        cur.dk_name[i] = strdup(buf);
                        if (!cur.dk_name[i])
                                err(1, "strdup");
-                       cur.dk_select[i] = select;
+                       cur.dk_select[i] = selected;
 
                        p = cur_disk.dk_link.tqe_next;
                }
diff -r e6ba949028f5 -r 89373b1b6bd7 usr.bin/vmstat/vmstat.c
--- a/usr.bin/vmstat/vmstat.c   Sat Feb 26 21:16:43 2005 +0000
+++ b/usr.bin/vmstat/vmstat.c   Sat Feb 26 21:19:18 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.128 2005/01/30 23:38:17 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.129 2005/02/26 21:19:18 dsl Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
 #if 0
 static char sccsid[] = "@(#)vmstat.c   8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.128 2005/01/30 23:38:17 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.129 2005/02/26 21:19:18 dsl Exp $");
 #endif
 #endif /* not lint */
 
@@ -800,19 +800,19 @@
 cpustats(void)
 {
        int state;
-       double pct, total;
+       double pcnt, total;
        double stat_us, stat_sy, stat_id;
 
        total = 0;
        for (state = 0; state < CPUSTATES; ++state)
                total += cur.cp_time[state];
        if (total)
-               pct = 100 / total;
+               pcnt = 100 / total;
        else
-               pct = 0;
-       stat_us = (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * pct;
-       stat_sy = (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * pct;
-       stat_id = cur.cp_time[CP_IDLE] * pct;
+               pcnt = 0;
+       stat_us = (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * pcnt;
+       stat_sy = (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * pcnt;
+       stat_id = cur.cp_time[CP_IDLE] * pcnt;
        (void)printf("%*.0f ", ((stat_sy >= 100) ? 1 : 2), stat_us);
        (void)printf("%*.0f ", ((stat_us >= 100 || stat_id >= 100) ? 1 : 2), stat_sy);
        (void)printf("%2.0f", stat_id);



Home | Main Index | Thread Index | Old Index