Source-Changes-HG archive

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

[src/netbsd-1-5]: src/usr.bin/systat Pull up the following revisions, approve...



details:   https://anonhg.NetBSD.org/src/rev/febb64eb98c3
branches:  netbsd-1-5
changeset: 489348:febb64eb98c3
user:      ad <ad%NetBSD.org@localhost>
date:      Fri Sep 01 16:37:08 2000 +0000

description:
Pull up the following revisions, approved by releng-1-5:

- Add "boot", "run", "time" and "zero" commands to all IP displays. These work
  as in the "vmstat" display mode. The default mode is now "time", not "boot".
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.

icmp.c           1.5
iostat.c         1.16
ip.c             1.8
ip6.c            1.5, 1.7
ipsec.c          1.5
keyboard.c       1.12
main.c           1.26
mbufs.c          1.9
netcmds.c        1.16

diffstat:

 usr.bin/systat/icmp.c     |   94 +++++++++++++++++++++++----
 usr.bin/systat/iostat.c   |   54 ++++++---------
 usr.bin/systat/ip.c       |   96 ++++++++++++++++++++++++++--
 usr.bin/systat/ip6.c      |  155 +++++++++++++++++++++++++++++++++------------
 usr.bin/systat/ipsec.c    |   96 +++++++++++++++++++++++++--
 usr.bin/systat/keyboard.c |    6 +-
 usr.bin/systat/main.c     |   47 +++----------
 usr.bin/systat/mbufs.c    |   17 ++--
 usr.bin/systat/netcmds.c  |   75 ++++++++-------------
 9 files changed, 441 insertions(+), 199 deletions(-)

diffs (truncated from 1245 to 300 lines):

diff -r 275402388dbc -r febb64eb98c3 usr.bin/systat/icmp.c
--- a/usr.bin/systat/icmp.c     Fri Sep 01 16:36:04 2000 +0000
+++ b/usr.bin/systat/icmp.c     Fri Sep 01 16:37:08 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: icmp.c,v 1.4 2000/06/13 13:37:12 ad Exp $      */
+/*     $NetBSD: icmp.c,v 1.4.2.1 2000/09/01 16:37:08 ad Exp $  */
 
 /*
- * Copyright (c) 1999 Andrew Doran <ad%NetBSD.org@localhost>
+ * Copyright (c) 1999, 2000 Andrew Doran <ad%NetBSD.org@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: icmp.c,v 1.4 2000/06/13 13:37:12 ad Exp $");
+__RCSID("$NetBSD: icmp.c,v 1.4.2.1 2000/09/01 16:37:08 ad Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -56,11 +56,20 @@
 #define RHD(row, str) mvwprintw(wnd, row, 45, str);
 #define BD(row, str) LHD(row, str); RHD(row, str)
 #define SHOW(stat, row, col) \
-    mvwprintw(wnd, row, col, "%9llu", (unsigned long long)stats.stat)
+    mvwprintw(wnd, row, col, "%9llu", (unsigned long long)curstat.stat)
 #define SHOW2(type, row) SHOW(icps_inhist[type], row, 0); \
     SHOW(icps_outhist[type], row, 35)
 
-static struct icmpstat stats;
+enum update {
+       UPDATE_TIME,
+       UPDATE_BOOT,
+       UPDATE_RUN,
+};
+
+static enum update update = UPDATE_TIME;
+static struct icmpstat curstat;
+static struct icmpstat newstat;
+static struct icmpstat oldstat;
 
 static struct nlist namelist[] = {
        { "_icmpstat" },
@@ -75,8 +84,7 @@
 }
 
 void
-closeicmp(w)
-       WINDOW *w;
+closeicmp(WINDOW *w)
 {
 
        if (w != NULL) {
@@ -92,11 +100,11 @@
 
        wmove(wnd, 0, 0); wclrtoeol(wnd);
 
-       mvwprintw(wnd, 1, 0,  "------------ ICMP input -------------");
-       mvwprintw(wnd, 1, 38, "------------- ICMP output -------------");
+       mvwprintw(wnd, 1, 0,  "------------ ICMP input -----------");
+       mvwprintw(wnd, 1, 36, "------------- ICMP output ---------------");
 
-       mvwprintw(wnd, 8, 0,  "---------- Input histogram ----------");
-       mvwprintw(wnd, 8, 38, "---------- Output histogram -----------");
+       mvwprintw(wnd, 8, 0,  "---------- Input histogram --------");
+       mvwprintw(wnd, 8, 36, "---------- Output histogram -------------");
        
        LHD(3, "with bad code");
        LHD(4, "with bad length");
@@ -126,12 +134,12 @@
        int i;
 
        for (i = tin = tout = 0; i <= ICMP_MAXTYPE; i++) {
-               tin += stats.icps_inhist[i];
-               tout += stats.icps_outhist[i];
+               tin += curstat.icps_inhist[i];
+               tout += curstat.icps_outhist[i];
        }
 
-       tin += stats.icps_badcode + stats.icps_badlen + stats.icps_checksum + 
-           stats.icps_tooshort;
+       tin += curstat.icps_badcode + curstat.icps_badlen + 
+           curstat.icps_checksum + curstat.icps_tooshort;
        mvwprintw(wnd, 2, 0, "%9lu", tin);
        mvwprintw(wnd, 2, 35, "%9lu", tout);
 
@@ -175,6 +183,60 @@
 void
 fetchicmp(void)
 {
+       int i;
 
-       KREAD((void *)namelist[0].n_value, &stats, sizeof(stats));
+       KREAD((void *)namelist[0].n_value, &newstat, sizeof(newstat));
+
+       ADJINETCTR(curstat, oldstat, newstat, icps_badcode);
+       ADJINETCTR(curstat, oldstat, newstat, icps_badlen);
+       ADJINETCTR(curstat, oldstat, newstat, icps_checksum);
+       ADJINETCTR(curstat, oldstat, newstat, icps_tooshort);
+       ADJINETCTR(curstat, oldstat, newstat, icps_error);
+       ADJINETCTR(curstat, oldstat, newstat, icps_oldshort);
+       ADJINETCTR(curstat, oldstat, newstat, icps_oldicmp);
+       ADJINETCTR(curstat, oldstat, newstat, icps_reflect);
+
+       for (i = 0; i <= ICMP_MAXTYPE; i++) {
+               ADJINETCTR(curstat, oldstat, newstat, icps_inhist[i]);
+               ADJINETCTR(curstat, oldstat, newstat, icps_outhist[i]);
+       }
+
+       if (update == UPDATE_TIME)
+               memcpy(&oldstat, &newstat, sizeof(oldstat));
+}
+
+void
+icmp_boot(char *args)
+{
+
+       memset(&oldstat, 0, sizeof(oldstat));
+       update = UPDATE_BOOT;
 }
+
+void
+icmp_run(char *args)
+{
+
+       if (update != UPDATE_RUN) {
+               memcpy(&oldstat, &newstat, sizeof(oldstat));
+               update = UPDATE_RUN;
+       }
+}
+
+void
+icmp_time(char *args)
+{
+
+       if (update != UPDATE_TIME) {
+               memcpy(&oldstat, &newstat, sizeof(oldstat));
+               update = UPDATE_TIME;
+       }
+}
+
+void
+icmp_zero(char *args)
+{
+
+       if (update == UPDATE_RUN)
+               memcpy(&oldstat, &newstat, sizeof(oldstat));
+}
diff -r 275402388dbc -r febb64eb98c3 usr.bin/systat/iostat.c
--- a/usr.bin/systat/iostat.c   Fri Sep 01 16:36:04 2000 +0000
+++ b/usr.bin/systat/iostat.c   Fri Sep 01 16:37:08 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iostat.c,v 1.15 2000/06/04 18:29:13 mycroft Exp $      */
+/*     $NetBSD: iostat.c,v 1.15.2.1 2000/09/01 16:37:09 ad Exp $       */
 
 /*
  * Copyright (c) 1980, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c   8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: iostat.c,v 1.15 2000/06/04 18:29:13 mycroft Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.15.2.1 2000/09/01 16:37:09 ad Exp $");
 #endif not lint
 
 #include <sys/param.h>
@@ -62,23 +62,22 @@
 static  int numbers = 0;               /* default display bar graphs */
 static  int secs = 0;                  /* default seconds shown */
 
-static int barlabels __P((int));
-static void histogram __P((double, int, double));
-static int numlabels __P((int));
-static int stats __P((int, int, int));
-static void stat1 __P((int, int));
+static int barlabels(int);
+static void histogram(double, int, double);
+static int numlabels(int);
+static int stats(int, int, int);
+static void stat1(int, int);
 
 
 WINDOW *
-openiostat()
+openiostat(void)
 {
 
        return (subwin(stdscr, LINES-1-5, 0, 5, 0));
 }
 
 void
-closeiostat(w)
-       WINDOW *w;
+closeiostat(WINDOW *w)
 {
 
        if (w == NULL)
@@ -89,7 +88,7 @@
 }
 
 int
-initiostat()
+initiostat(void)
 {
        extern gid_t egid;
 
@@ -99,7 +98,7 @@
 }
 
 void
-fetchiostat()
+fetchiostat(void)
 {
 
        if (dk_ndrive == 0)
@@ -110,7 +109,7 @@
 #define        INSET   14
 
 void
-labeliostat()
+labeliostat(void)
 {
        int row;
 
@@ -134,8 +133,7 @@
 }
 
 static int
-numlabels(row)
-       int row;
+numlabels(int row)
 {
        int i, col, regions, ndrives;
 
@@ -173,8 +171,7 @@
 }
 
 static int
-barlabels(row)
-       int row;
+barlabels(int row)
 {
        int i;
 
@@ -193,9 +190,8 @@
        return (row);
 }
 
-
 void
-showiostat()
+showiostat(void)
 {
        int i, row, col;
 
@@ -249,8 +245,7 @@
 }
 
 static int
-stats(row, col, dn)
-       int row, col, dn;
+stats(int row, int col, int dn)
 {
        double atime, words;
 
@@ -277,8 +272,7 @@
 }
 
 static void
-stat1(row, o)
-       int row, o;
+stat1(int row, int o)
 {
        int i;
        double time;
@@ -294,10 +288,7 @@
 }
 
 static void
-histogram(val, colwidth, scale)
-       double val;
-       int colwidth;
-       double scale;
+histogram(double val, int colwidth, double scale)
 {
        char buf[10];
        int k;
@@ -318,8 +309,7 @@
 }
 
 void
-iostat_bars (args)
-       char *args;
+iostat_bars(char *args)
 {
        numbers = 0;
        wclear(wnd);
@@ -328,8 +318,7 @@



Home | Main Index | Thread Index | Old Index