diff options
| author | itojun <itojun@NetBSD.org> | 2000-01-08 23:12:36 +0000 |
|---|---|---|
| committer | itojun <itojun@NetBSD.org> | 2000-01-08 23:12:36 +0000 |
| commit | d7b4ec9207e860162f2dfd45001e7cc8c8d89bc5 (patch) | |
| tree | 99eea04250bf127192bc71083f80a65f6e5d44d9 | |
| parent | 524894d6f2dcab029c535e846348796b6d09f7af (diff) | |
- implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
| -rw-r--r-- | usr.bin/systat/Makefile | 5 | ||||
| -rw-r--r-- | usr.bin/systat/cmdtab.c | 14 | ||||
| -rw-r--r-- | usr.bin/systat/extern.h | 18 | ||||
| -rw-r--r-- | usr.bin/systat/globalcmds.c | 52 | ||||
| -rw-r--r-- | usr.bin/systat/icmp.c | 7 | ||||
| -rw-r--r-- | usr.bin/systat/ip.c | 7 | ||||
| -rw-r--r-- | usr.bin/systat/ip6.c | 215 | ||||
| -rw-r--r-- | usr.bin/systat/ipsec.c | 205 | ||||
| -rw-r--r-- | usr.bin/systat/pigs.c | 8 | ||||
| -rw-r--r-- | usr.bin/systat/ps.c | 10 | ||||
| -rw-r--r-- | usr.bin/systat/systat.1 | 20 |
11 files changed, 540 insertions, 21 deletions
diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile index 37115c62ca4..060308fe40f 100644 --- a/usr.bin/systat/Makefile +++ b/usr.bin/systat/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.21 2000/01/05 11:59:12 itojun Exp $ +# $NetBSD: Makefile,v 1.22 2000/01/08 23:12:36 itojun Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= systat @@ -17,6 +17,7 @@ BINMODE=2555 LINKS= ${BINDIR}/systat ${BINDIR}/sysstat MLINKS+=systat.1 sysstat.1 -CPPFLAGS+=-DINET6 +CPPFLAGS+=-DINET6 -DIPSEC +SRCS+= ip6.c ipsec.c .include <bsd.prog.mk> diff --git a/usr.bin/systat/cmdtab.c b/usr.bin/systat/cmdtab.c index e6c9ad149a6..51b38bf9080 100644 --- a/usr.bin/systat/cmdtab.c +++ b/usr.bin/systat/cmdtab.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmdtab.c,v 1.12 1999/12/22 14:46:14 kleink Exp $ */ +/* $NetBSD: cmdtab.c,v 1.13 2000/01/08 23:12:37 itojun Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: cmdtab.c,v 1.12 1999/12/22 14:46:14 kleink Exp $"); +__RCSID("$NetBSD: cmdtab.c,v 1.13 2000/01/08 23:12:37 itojun Exp $"); #endif /* not lint */ #include "systat.h" @@ -121,6 +121,16 @@ struct mode modes[] = { { "inet.tcpsyn",showtcpsyn, fetchtcp, labeltcpsyn, inittcp, opentcp, closetcp, 0, CF_LOADAV }, +#ifdef INET6 + { "inet6.ip6", showip6, fetchip6, labelip6, + initip6, openip6, closeip6, 0, + CF_LOADAV }, +#endif +#ifdef IPSEC + { "ipsec", showipsec, fetchipsec, labelipsec, + initipsec, openipsec, closeipsec, 0, + CF_LOADAV }, +#endif { "iostat", showiostat, fetchiostat, labeliostat, initiostat, openiostat, closeiostat, iostat_commands, CF_LOADAV }, diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h index fb93e6e0aa5..8b82069edcc 100644 --- a/usr.bin/systat/extern.h +++ b/usr.bin/systat/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.20 2000/01/07 04:47:23 itojun Exp $ */ +/* $NetBSD: extern.h,v 1.21 2000/01/08 23:12:37 itojun Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -172,3 +172,19 @@ void vmstat_boot __P((char *args)); void vmstat_run __P((char *args)); void vmstat_time __P((char *args)); void vmstat_zero __P((char *args)); +#ifdef INET6 +void closeip6 __P ((WINDOW *)); +void fetchip6 __P((void)); +int initip6 __P((void)); +void labelip6 __P((void)); +WINDOW *openip6 __P((void)); +void showip6 __P((void)); +#endif +#ifdef IPSEC +void closeipsec __P ((WINDOW *)); +void fetchipsec __P((void)); +int initipsec __P((void)); +void labelipsec __P((void)); +WINDOW *openipsec __P((void)); +void showipsec __P((void)); +#endif diff --git a/usr.bin/systat/globalcmds.c b/usr.bin/systat/globalcmds.c index a806b329e36..dc0d83697bd 100644 --- a/usr.bin/systat/globalcmds.c +++ b/usr.bin/systat/globalcmds.c @@ -1,4 +1,4 @@ -/* $NetBSD: globalcmds.c,v 1.5 1999/12/20 21:49:11 lukem Exp $ */ +/* $NetBSD: globalcmds.c,v 1.6 2000/01/08 23:12:37 itojun Exp $ */ /*- * Copyright (c) 1999 @@ -40,23 +40,69 @@ #include "extern.h" +static char *shortname __P((const char *, const char *)); + +static char * +shortname(key, s) + const char *key; + const char *s; +{ + char *p, *q; + size_t l; + + if (key == NULL) { + if ((p = strdup(s)) == NULL) + return NULL; + q = strchr(p, '.'); + if (q && strlen(q) > 1) { + q[1] = '*'; + q[2] = '\0'; + } + return p; + } else if (strncmp(key, s, l = strlen(key)) == 0 && s[l] == '.') { + p = strdup(s + l + 1); + return p; + } else + return NULL; +} + void global_help(args) char *args; { int col, len; struct mode *p; + char *cur, *prev; move(CMDLINE, col = 0); + cur = prev = NULL; for (p = modes; p->c_name; p++) { - len = strlen(p->c_name); + if ((cur = shortname(args, p->c_name)) == NULL) + continue; + if (cur && prev && strcmp(cur, prev) == 0) { + free(cur); + continue; + } + len = strlen(cur); if (col + len > COLS) break; - addstr(p->c_name); col += len; + addstr(cur); col += len; if (col + 1 < COLS) addch(' '); + if (prev) + free(prev); + prev = cur; + } + if (col == 0 && args) { + standout(); + addstr("help: no matches"); + standend(); } clrtoeol(); + if (cur) + free(cur); + if (prev) + free(prev); } void diff --git a/usr.bin/systat/icmp.c b/usr.bin/systat/icmp.c index e18c0672de3..0100ba3d537 100644 --- a/usr.bin/systat/icmp.c +++ b/usr.bin/systat/icmp.c @@ -1,4 +1,4 @@ -/* $NetBSD: icmp.c,v 1.1 1999/05/30 20:26:21 ad Exp $ */ +/* $NetBSD: icmp.c,v 1.2 2000/01/08 23:12:37 itojun Exp $ */ /* * Copyright (c) 1999 Andy Doran <ad@NetBSD.org> @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: icmp.c,v 1.1 1999/05/30 20:26:21 ad Exp $"); +__RCSID("$NetBSD: icmp.c,v 1.2 2000/01/08 23:12:37 itojun Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -54,7 +54,8 @@ __RCSID("$NetBSD: icmp.c,v 1.1 1999/05/30 20:26:21 ad Exp $"); #define LHD(row, str) mvwprintw(wnd, row, 10, str) #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, "%9lu", stats.stat) +#define SHOW(stat, row, col) \ + mvwprintw(wnd, row, col, "%9llu", (unsigned long long)stats.stat) #define SHOW2(type, row) SHOW(icps_inhist[type], row, 0); \ SHOW(icps_outhist[type], row, 35) diff --git a/usr.bin/systat/ip.c b/usr.bin/systat/ip.c index 16ca12b9385..b0ce0ca487f 100644 --- a/usr.bin/systat/ip.c +++ b/usr.bin/systat/ip.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip.c,v 1.3 2000/01/04 15:17:00 msaitoh Exp $ */ +/* $NetBSD: ip.c,v 1.4 2000/01/08 23:12:37 itojun Exp $ */ /* * Copyright (c) 1999 Andy Doran <ad@NetBSD.org> @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: ip.c,v 1.3 2000/01/04 15:17:00 msaitoh Exp $"); +__RCSID("$NetBSD: ip.c,v 1.4 2000/01/08 23:12:37 itojun Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -54,7 +54,8 @@ __RCSID("$NetBSD: ip.c,v 1.3 2000/01/04 15:17:00 msaitoh Exp $"); #define LHD(row, str) mvwprintw(wnd, row, 10, str) #define RHD(row, str) mvwprintw(wnd, row, 45, str); -#define SHOW(stat, row, col) mvwprintw(wnd, row, col, "%9llu", curstat.stat) +#define SHOW(stat, row, col) \ + mvwprintw(wnd, row, col, "%9llu", (unsigned long long)curstat.stat) struct mystat { struct ipstat i; diff --git a/usr.bin/systat/ip6.c b/usr.bin/systat/ip6.c new file mode 100644 index 00000000000..454ecf5f595 --- /dev/null +++ b/usr.bin/systat/ip6.c @@ -0,0 +1,215 @@ +/* $NetBSD: ip6.c,v 1.1 2000/01/08 23:12:37 itojun Exp $ */ + +/* + * Copyright (c) 1999 Andy Doran <ad@NetBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include <sys/cdefs.h> +#ifndef lint +__RCSID("$NetBSD: ip6.c,v 1.1 2000/01/08 23:12:37 itojun Exp $"); +#endif /* not lint */ + +#include <sys/param.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/sysctl.h> + +#include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip6.h> +#include <netinet6/ip6_var.h> + +#include <stdlib.h> +#include <string.h> +#include <paths.h> +#include <nlist.h> +#include <kvm.h> +#include "systat.h" +#include "extern.h" + +#define LHD(row, str) mvwprintw(wnd, row, 10, str) +#define RHD(row, str) mvwprintw(wnd, row, 45, str); +#define SHOW(stat, row, col) \ + mvwprintw(wnd, row, col, "%9llu", (unsigned long long)curstat.stat) + +struct mystat { + struct ip6stat i; +}; + +static struct mystat curstat; + +static struct nlist namelist[] = { + { "_ip6stat" }, + { "" } +}; + +WINDOW * +openip6(void) +{ + + return (subwin(stdscr, LINES-5-1, 0, 5, 0)); +} + +void +closeip6(w) + WINDOW *w; +{ + + if (w != NULL) { + wclear(w); + wrefresh(w); + delwin(w); + } +} + +void +labelip6(void) +{ + + wmove(wnd, 0, 0); wclrtoeol(wnd); + + LHD(0, "total packet received"); + LHD(1, " smaller than minimum"); + LHD(2, " data size < data length"); + LHD(3, " bad options"); + LHD(4, " incorrect version no"); + LHD(5, " headers not continuous"); + LHD(6, " packet for this host"); + LHD(7, " multicast we don't join"); + LHD(8, " too many headers"); + LHD(9, " tunneled packet w/o gif"); + + LHD(11, " fragment received"); + LHD(12, " fragment dropped"); + LHD(13, " fragment timeout"); + LHD(14, " fragment exceeded limit"); + LHD(15, " packet reassembled ok"); + +#if 0 + LHD(17, "one mbuf"); + LHD(18, "one ext mbuf"); + LHD(19, "two or more ext mbuf"); + LHD(20, "two or more mbuf"); +#endif + + RHD(0, "packet forwarded"); + RHD(1, " packet not forwardable"); + RHD(2, " redirect sent"); + + RHD(4, "packet sent from this host"); + RHD(5, " fabricated ip header"); + RHD(6, " dropped output (no bufs)"); + RHD(7, " dropped output (no route)"); + RHD(8, " output datagram fragmented"); + RHD(9, " fragment created"); + RHD(10, " can't be fragmented"); + + RHD(12, "violated scope rules"); + RHD(13, "call to m_pulldown"); + RHD(14, "mbuf allocation in m_pulldown"); + RHD(15, "mbuf copy in m_pulldown"); +} + +void +showip6(void) +{ +#if 0 + u_quad_t m2m; + int i; + + m2m = 0; + for (i = 0; + i < sizeof(curstat.i.ip6s_m2m)/sizeof(curstat.i.ip6s_m2m[0]); + i++) { + m2m += curstat.i.ip6s_m2m[i]; + } +#endif + + SHOW(i.ip6s_total, 0, 0); + SHOW(i.ip6s_toosmall, 1, 0); + SHOW(i.ip6s_tooshort, 2, 0); + SHOW(i.ip6s_badoptions, 3, 0); + SHOW(i.ip6s_badvers, 4, 0); + SHOW(i.ip6s_exthdrtoolong, 5, 0); + SHOW(i.ip6s_delivered, 6, 0); + SHOW(i.ip6s_notmember, 7, 0); + SHOW(i.ip6s_toomanyhdr, 8, 0); + SHOW(i.ip6s_nogif, 9, 0); + + SHOW(i.ip6s_fragments, 11, 0); + SHOW(i.ip6s_fragdropped, 12, 0); + SHOW(i.ip6s_fragtimeout, 13, 0); + SHOW(i.ip6s_fragoverflow, 14, 0); + SHOW(i.ip6s_reassembled, 15, 0); + +#if 0 + SHOW(i.ip6s_m1, 17, 0); + SHOW(i.ip6s_mext1, 18, 0); + SHOW(i.ip6s_mext2m, 19, 0); + mvwprintw(wnd, 20, 0, "%9llu", (unsigned long long)m2m); +#endif + + SHOW(i.ip6s_forward, 0, 35); + SHOW(i.ip6s_cantforward, 1, 35); + SHOW(i.ip6s_redirectsent, 2, 35); + + SHOW(i.ip6s_localout, 4, 35); + SHOW(i.ip6s_rawout, 5, 35); + SHOW(i.ip6s_odropped, 6, 35); + SHOW(i.ip6s_noroute, 7, 35); + SHOW(i.ip6s_fragmented, 8, 35); + SHOW(i.ip6s_ofragments, 9, 35); + SHOW(i.ip6s_cantfrag, 10, 35); + + SHOW(i.ip6s_badscope, 12, 35); + SHOW(i.ip6s_pulldown, 13, 35); + SHOW(i.ip6s_pulldown_alloc, 14, 35); + SHOW(i.ip6s_pulldown_copy, 15, 35); +} + +int +initip6(void) +{ + + if (namelist[0].n_type == 0) { + if (kvm_nlist(kd, namelist)) { + nlisterr(namelist); + return(0); + } + if (namelist[0].n_type == 0) { + error("No namelist"); + return(0); + } + } + return 1; +} + +void +fetchip6(void) +{ + + KREAD((void *)namelist[0].n_value, &curstat.i, sizeof(curstat.i)); +} diff --git a/usr.bin/systat/ipsec.c b/usr.bin/systat/ipsec.c new file mode 100644 index 00000000000..0f73662c835 --- /dev/null +++ b/usr.bin/systat/ipsec.c @@ -0,0 +1,205 @@ +/* $NetBSD: ipsec.c,v 1.1 2000/01/08 23:12:37 itojun Exp $ */ + +/* + * Copyright (c) 1999 Andy Doran <ad@NetBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include <sys/cdefs.h> +#ifndef lint +__RCSID("$NetBSD: ipsec.c,v 1.1 2000/01/08 23:12:37 itojun Exp $"); +#endif /* not lint */ + +#include <sys/param.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/sysctl.h> + +#include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet6/ipsec.h> + +#include <stdlib.h> +#include <string.h> +#include <paths.h> +#include <nlist.h> +#include <kvm.h> +#include "systat.h" +#include "extern.h" + +#define LHD(row, str) mvwprintw(wnd, row, 10, str) +#define RHD(row, str) mvwprintw(wnd, row, 45, str); +#define SHOW(stat, row, col) \ + mvwprintw(wnd, row, col, "%9llu", (unsigned long long)curstat.stat) + +struct mystat { + struct ipsecstat i4; +#ifdef INET6 + struct ipsecstat i6; +#endif +}; + +static struct mystat curstat; + +static struct nlist namelist[] = { + { "_ipsecstat" }, +#ifdef INET6 + { "_ipsec6stat" }, +#endif + { "" } +}; + +WINDOW * +openipsec(void) +{ + + return (subwin(stdscr, LINES-5-1, 0, 5, 0)); +} + +void +closeipsec(w) + WINDOW *w; +{ + + if (w != NULL) { + wclear(w); + wrefresh(w); + delwin(w); + } +} + +void +labelipsec(void) +{ + + wmove(wnd, 0, 0); wclrtoeol(wnd); + + mvwprintw(wnd, 0, 0, "------ IPv4 IPsec input ------"); + LHD(1, "processed successfully"); + LHD(2, "violated process policy"); + LHD(3, "with no SA available"); + LHD(4, "failed due to EINVAL"); + LHD(5, "failed getting SPI"); + LHD(6, "failed on AH replay check"); + LHD(7, "failed on ESP replay check"); + LHD(8, "considered authentic"); + LHD(9, "failed on authentication"); + + mvwprintw(wnd, 11, 0, "------ IPv4 IPsec output ------"); + LHD(12, "processed successfully"); + LHD(13, "violated process policy"); + LHD(14, "with no SA available"); + LHD(15, "failed processing due to EINVAL"); + LHD(16, "with no route"); + +#ifdef INET6 + mvwprintw(wnd, 0, 35, "------ IPv6 IPsec input ------"); + RHD(1, "processed successfully"); + RHD(2, "violated process policy"); + RHD(3, "with no SA available"); + RHD(4, "failed due to EINVAL"); + RHD(5, "failed getting SPI"); + RHD(6, "failed on AH replay check"); + RHD(7, "failed on ESP replay check"); + RHD(8, "considered authentic"); + RHD(9, "failed on authentication"); + + mvwprintw(wnd, 11, 35, "------ IPv6 IPsec output ------"); + RHD(12, "processed successfully"); + RHD(13, "violated process policy"); + RHD(14, "with no SA available"); + RHD(15, "failed due to EINVAL"); + RHD(16, "with no route"); +#endif +} + +void +showipsec(void) +{ + + SHOW(i4.in_success, 1, 0); + SHOW(i4.in_polvio, 2, 0); + SHOW(i4.in_nosa, 3, 0); + SHOW(i4.in_inval, 4, 0); + SHOW(i4.in_badspi, 5, 0); + SHOW(i4.in_ahreplay, 6, 0); + SHOW(i4.in_espreplay, 7, 0); + SHOW(i4.in_ahauthsucc, 8, 0); + SHOW(i4.in_ahauthfail, 9, 0); + + SHOW(i4.out_success, 12, 0); + SHOW(i4.out_polvio, 13, 0); + SHOW(i4.out_nosa, 14, 0); + SHOW(i4.out_inval, 15, 0); + SHOW(i4.out_noroute, 16, 0); + +#ifdef INET6 + SHOW(i6.in_success, 1, 35); + SHOW(i6.in_polvio, 2, 35); + SHOW(i6.in_nosa, 3, 35); + SHOW(i6.in_inval, 4, 35); + SHOW(i6.in_badspi, 5, 35); + SHOW(i6.in_ahreplay, 6, 35); + SHOW(i6.in_espreplay, 7, 35); + SHOW(i6.in_ahauthsucc, 8, 35); + SHOW(i6.in_ahauthfail, 9, 35); + + SHOW(i6.out_success, 12, 35); + SHOW(i6.out_polvio, 13, 35); + SHOW(i6.out_nosa, 14, 35); + SHOW(i6.out_inval, 15, 35); + SHOW(i6.out_noroute, 16, 35); +#endif +} + +int +initipsec(void) +{ + int i; + + if (namelist[0].n_type == 0) { + if (kvm_nlist(kd, namelist)) { + nlisterr(namelist); + return(0); + } + for (i = 0; i < sizeof(namelist)/sizeof(namelist[0]) - 1; i++) { + if (namelist[i].n_type == 0) { + error("No namelist"); + return(0); + } + } + } + return 1; +} + +void +fetchipsec(void) +{ + + KREAD((void *)namelist[0].n_value, &curstat.i4, sizeof(curstat.i4)); +#ifdef INET6 + KREAD((void *)namelist[1].n_value, &curstat.i6, sizeof(curstat.i6)); +#endif +} diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c index fe04d064fa2..c7fcc524f90 100644 --- a/usr.bin/systat/pigs.c +++ b/usr.bin/systat/pigs.c @@ -1,4 +1,4 @@ -/* $NetBSD: pigs.c,v 1.15 1999/07/22 18:18:27 thorpej Exp $ */ +/* $NetBSD: pigs.c,v 1.16 2000/01/08 23:12:37 itojun Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93"; #endif -__RCSID("$NetBSD: pigs.c,v 1.15 1999/07/22 18:18:27 thorpej Exp $"); +__RCSID("$NetBSD: pigs.c,v 1.16 2000/01/08 23:12:37 itojun Exp $"); #endif /* not lint */ /* @@ -73,6 +73,10 @@ long mempages; int fscale; double lccpu; +#ifndef P_ZOMBIE +#define P_ZOMBIE(p) ((p)->p_stat == SZOMB) +#endif + WINDOW * openpigs() { diff --git a/usr.bin/systat/ps.c b/usr.bin/systat/ps.c index f67b9684532..1a2e887b94b 100644 --- a/usr.bin/systat/ps.c +++ b/usr.bin/systat/ps.c @@ -1,4 +1,4 @@ -/* $NetBSD: ps.c,v 1.12 1999/12/22 14:46:15 kleink Exp $ */ +/* $NetBSD: ps.c,v 1.13 2000/01/08 23:12:37 itojun Exp $ */ /*- * Copyright (c) 1999 @@ -45,7 +45,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: ps.c,v 1.12 1999/12/22 14:46:15 kleink Exp $"); +__RCSID("$NetBSD: ps.c,v 1.13 2000/01/08 23:12:37 itojun Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -83,6 +83,10 @@ static time_t now; #define SHOWUSER_ANY (uid_t)-1 static uid_t showuser = SHOWUSER_ANY; +#ifndef P_ZOMBIE +#define P_ZOMBIE(p) ((p)->p_stat == SZOMB) +#endif + void labelps () { @@ -187,7 +191,9 @@ state2str(kp) break; case SZOMB: +#ifdef SDEAD case SDEAD: +#endif *cp = 'Z'; break; diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1 index c8085d74236..a3f528243e3 100644 --- a/usr.bin/systat/systat.1 +++ b/usr.bin/systat/systat.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: systat.1,v 1.18 2000/01/07 04:47:24 itojun Exp $ +.\" $NetBSD: systat.1,v 1.19 2000/01/08 23:12:37 itojun Exp $ .\" .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -114,6 +114,8 @@ argument expects to be one of: .Ic inet.ip , .Ic inet.tcp , .Ic inet.tcpsyn , +.Ic inet6.ip6 , +.Ic ipsec , .Ic iostat , .Ic mbufs , .Ic netstat , @@ -159,8 +161,16 @@ may be used. The following commands are interpreted by the ``global'' command interpreter. .Bl -tag -width Fl -.It Ic help +.It Ic help Ar key Print the names of the available displays on the command line. +It will print long names as +.Dq Ic inet.* . +To print items under +.Dq Ic inet , +give +.Ic inet +as +.Ar key . .It Ic load Print the load average over the past 1, 5, and 15 minutes on the command line. @@ -192,13 +202,17 @@ buffers and the total size of the buffers for that filesystem. .It Ic inet.icmp Display ICMP statistics. .It Ic inet.ip -Display IP and UDP statistics. +Display IPv4 and UDP statistics. .It Ic inet.tcp Display TCP statistics. .It Ic inet.tcpsyn Display statistics about the .Tn TCP ``syncache''. +.It Ic inet6.ip6 +Display IPv6 statistics. +.It Ic ipsec +Display IPsec statistics for both IPv4 and v6. .It Ic iostat Display, in the lower window, statistics about processor use and disk throughput. Statistics on processor use appear as |
