CVS commit: src/usr.bin/systat
Module Name:src Committed By: simonb Date: Sat Jul 24 13:42:05 UTC 2021 Modified Files: src/usr.bin/systat: vmstat.c Log Message: Instead of getting an estimate of the number of kernel buffers, allocating memory for them, requesting all the metadata contents of these buffers (and repeating in the unlikely case of the number of buffers increasing too much since the estimate) and then straight away throwing all the contents out just to count how many buffers there were, just get the initial estimate from the kernel and subtract the slop. Reduces system CPU usage of "systat vm" by approx 80% for any system with a reasonable number of buffers. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/usr.bin/systat/vmstat.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.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.88 src/usr.bin/systat/vmstat.c:1.89 --- src/usr.bin/systat/vmstat.c:1.88 Mon Mar 2 09:50:12 2020 +++ src/usr.bin/systat/vmstat.c Sat Jul 24 13:42:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.88 2020/03/02 09:50:12 mrg Exp $ */ +/* $NetBSD: vmstat.c,v 1.89 2021/07/24 13:42:05 simonb Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.88 2020/03/02 09:50:12 mrg Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.89 2021/07/24 13:42:05 simonb Exp $"); #endif /* not lint */ /* @@ -481,10 +481,8 @@ showvmstat(void) static int relabel = 0; static int last_disks = 0; static u_long bufmem; - struct buf_sysctl *buffers; int mib[6]; size_t size; - int extraslop = 0; if (relabel) { labelvmstat(); @@ -528,14 +526,12 @@ showvmstat(void) /* Get number of metadata buffers */ size = 0; - buffers = NULL; mib[0] = CTL_KERN; mib[1] = KERN_BUF; mib[2] = KERN_BUF_ALL; mib[3] = KERN_BUF_ALL; mib[4] = (int)sizeof(struct buf_sysctl); mib[5] = INT_MAX; /* we want them all */ -again: if (sysctl(mib, 6, NULL, &size, NULL, 0) < 0) { error("can't get buffers size: %s\n", strerror(errno)); return; @@ -544,23 +540,8 @@ again: error("buffers size is zero: %s\n", strerror(errno)); return; } - size += extraslop * sizeof(struct buf_sysctl); - buffers = malloc(size); - if (buffers == NULL) { - error("can't allocate buffers: %s\n", strerror(errno)); - return; - } - if (sysctl(mib, 6, buffers, &size, NULL, 0) < 0) { - free(buffers); - if (extraslop < 1000) { - extraslop += 100; - goto again; - } - error("can't get buffers: %s\n", strerror(errno)); - return; - } - free(buffers); /* XXX there must be a better way! */ nbuf = size / sizeof(struct buf_sysctl); + nbuf -= KERN_BUFSLOP; putint((int) (bufmem / 1024), MEMROW + 3, MEMCOL + 5, 12); putint((int) ((bufmem * 100) + 0.5) / s.uvmexp.pagesize / s.uvmexp.npages,
CVS commit: src/usr.bin/systat
Module Name:src Committed By: maya Date: Sat Apr 17 08:34:28 UTC 2021 Modified Files: src/usr.bin/systat: ps.c Log Message: Remove SCCS workarounds. No binary change. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/systat/ps.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.bin/systat/ps.c diff -u src/usr.bin/systat/ps.c:1.39 src/usr.bin/systat/ps.c:1.40 --- src/usr.bin/systat/ps.c:1.39 Wed Aug 26 10:56:01 2020 +++ src/usr.bin/systat/ps.c Sat Apr 17 08:34:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ps.c,v 1.39 2020/08/26 10:56:01 simonb Exp $ */ +/* $NetBSD: ps.c,v 1.40 2021/04/17 08:34:27 maya Exp $ */ /*- * Copyright (c) 1999 @@ -45,7 +45,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ps.c,v 1.39 2020/08/26 10:56:01 simonb Exp $"); +__RCSID("$NetBSD: ps.c,v 1.40 2021/04/17 08:34:27 maya Exp $"); #endif /* not lint */ #include @@ -340,11 +340,9 @@ start2str(struct kinfo_proc2 *kp) if (now == 0) time(&now); if (now - u_start.tv_sec < 24 * SECSPERHOUR) { - /* I *hate* SCCS... */ - strftime(startstr, sizeof(startstr) - 1, "%l:%" "M%p", tp); + strftime(startstr, sizeof(startstr) - 1, "%l:%M%p", tp); } else if (now - u_start.tv_sec < 7 * SECSPERDAY) { - /* I *hate* SCCS... */ - strftime(startstr, sizeof(startstr) - 1, "%a%" "I%p", tp); + strftime(startstr, sizeof(startstr) - 1, "%a%I%p", tp); } else strftime(startstr, sizeof(startstr) - 1, "%e%b%y", tp);
CVS commit: src/usr.bin/systat
Module Name:src Committed By: simonb Date: Fri Dec 11 07:24:38 UTC 2020 Modified Files: src/usr.bin/systat: Makefile Log Message: Add ${LIBUTIL} to DPADD. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.bin/systat/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/Makefile diff -u src/usr.bin/systat/Makefile:1.43 src/usr.bin/systat/Makefile:1.44 --- src/usr.bin/systat/Makefile:1.43 Sun Oct 13 07:28:17 2019 +++ src/usr.bin/systat/Makefile Fri Dec 11 07:24:38 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.43 2019/10/13 07:28:17 mrg Exp $ +# $NetBSD: Makefile,v 1.44 2020/12/11 07:24:38 simonb Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 .include @@ -15,7 +15,7 @@ SRCS= bufcache.c cmds.c cmdtab.c convtbl fetch.c globalcmds.c icmp.c ifcmds.c ifstat.c iostat.c ip.c \ keyboard.c main.c mbufs.c netcmds.c netstat.c pigs.c ps.c swap.c \ tcp.c vmstat.c utmpentry.c syscall.c -DPADD= ${LIBCURSES} ${LIBTERMINFO} ${LIBM} ${LIBKVM} +DPADD= ${LIBUTIL} ${LIBCURSES} ${LIBTERMINFO} ${LIBM} ${LIBKVM} LDADD= -lutil -lcurses -lterminfo -lm -lkvm BINGRP= kmem BINMODE=2555
CVS commit: src/usr.bin/systat
Module Name:src Committed By: simonb Date: Wed Aug 26 10:56:01 UTC 2020 Modified Files: src/usr.bin/systat: ps.c Log Message: Use the vm.uspace sysctl instead of using the USPACE kernel define. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/systat/ps.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.bin/systat/ps.c diff -u src/usr.bin/systat/ps.c:1.38 src/usr.bin/systat/ps.c:1.39 --- src/usr.bin/systat/ps.c:1.38 Sun Feb 3 10:48:47 2019 +++ src/usr.bin/systat/ps.c Wed Aug 26 10:56:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ps.c,v 1.38 2019/02/03 10:48:47 mrg Exp $ */ +/* $NetBSD: ps.c,v 1.39 2020/08/26 10:56:01 simonb Exp $ */ /*- * Copyright (c) 1999 @@ -45,7 +45,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ps.c,v 1.38 2019/02/03 10:48:47 mrg Exp $"); +__RCSID("$NetBSD: ps.c,v 1.39 2020/08/26 10:56:01 simonb Exp $"); #endif /* not lint */ #include @@ -297,14 +297,30 @@ double pmem2float(struct kinfo_proc2 *kp) { double fracmem; - int szptudot = 0; + static int szptudot = -1; + + /* + * XXX want pmap ptpages, segtab, etc. (per architecture), + * not just the uarea. + */ + if (szptudot < 0) { + int mib[2]; + size_t size; + int uspace; + + mib[0] = CTL_VM; + mib[1] = VM_USPACE; + size = sizeof(uspace); + if (sysctl(mib, 2, &uspace, &size, NULL, 0) == 0) { + szptudot = uspace / getpagesize(); + } else { + /* pick a vaguely useful default */ + szptudot = getpagesize(); + } + } -#ifdef USPACE - /* XXX want pmap ptpages, segtab, etc. (per architecture) */ - szptudot = USPACE/getpagesize(); -#endif /* XXX don't have info about shared */ - fracmem = ((double)kp->p_vm_rssize + szptudot)/mempages; + fracmem = ((double)kp->p_vm_rssize + szptudot) / mempages; return (fracmem >= 0) ? 100.0 * fracmem : 0; }
CVS commit: src/usr.bin/systat
Module Name:src Committed By: mrg Date: Mon Mar 2 09:50:12 UTC 2020 Modified Files: src/usr.bin/systat: bufcache.c vmstat.c Log Message: increase slot slop space from 100 to 1000 before giving up. from Paul Ripke on current-users. thanks! To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/systat/bufcache.c cvs rdiff -u -r1.87 -r1.88 src/usr.bin/systat/vmstat.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.bin/systat/bufcache.c diff -u src/usr.bin/systat/bufcache.c:1.29 src/usr.bin/systat/bufcache.c:1.30 --- src/usr.bin/systat/bufcache.c:1.29 Wed Dec 26 01:47:37 2018 +++ src/usr.bin/systat/bufcache.c Mon Mar 2 09:50:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bufcache.c,v 1.29 2018/12/26 01:47:37 sevan Exp $ */ +/* $NetBSD: bufcache.c,v 1.30 2020/03/02 09:50:12 mrg Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: bufcache.c,v 1.29 2018/12/26 01:47:37 sevan Exp $"); +__RCSID("$NetBSD: bufcache.c,v 1.30 2020/03/02 09:50:12 mrg Exp $"); #endif /* not lint */ #include @@ -290,8 +290,8 @@ again: } if (sysctl(mib, 6, buffers, &size, NULL, 0) < 0) { free(buffers); - if (extraslop == 0) { - extraslop = 100; + if (extraslop < 1000) { + extraslop += 100; goto again; } error("can't get buffers: %s\n", strerror(errno)); Index: src/usr.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.87 src/usr.bin/systat/vmstat.c:1.88 --- src/usr.bin/systat/vmstat.c:1.87 Sun Jun 30 19:57:23 2019 +++ src/usr.bin/systat/vmstat.c Mon Mar 2 09:50:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.87 2019/06/30 19:57:23 he Exp $ */ +/* $NetBSD: vmstat.c,v 1.88 2020/03/02 09:50:12 mrg Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.87 2019/06/30 19:57:23 he Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.88 2020/03/02 09:50:12 mrg Exp $"); #endif /* not lint */ /* @@ -552,8 +552,8 @@ again: } if (sysctl(mib, 6, buffers, &size, NULL, 0) < 0) { free(buffers); - if (extraslop == 0) { - extraslop = 100; + if (extraslop < 1000) { + extraslop += 100; goto again; } error("can't get buffers: %s\n", strerror(errno));
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Jan 25 15:34:22 UTC 2019 Modified Files: src/usr.bin/systat: vmstat.c Log Message: no need for curses.h To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/usr.bin/systat/vmstat.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.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.85 src/usr.bin/systat/vmstat.c:1.86 --- src/usr.bin/systat/vmstat.c:1.85 Fri Jan 25 10:31:11 2019 +++ src/usr.bin/systat/vmstat.c Fri Jan 25 10:34:22 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.85 2019/01/25 15:31:11 christos Exp $ */ +/* $NetBSD: vmstat.c,v 1.86 2019/01/25 15:34:22 christos Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.85 2019/01/25 15:31:11 christos Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.86 2019/01/25 15:34:22 christos Exp $"); #endif /* not lint */ /* @@ -53,7 +53,6 @@ __RCSID("$NetBSD: vmstat.c,v 1.85 2019/0 #include #include #include -#include #include "systat.h" #include "extern.h"
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Jan 25 15:31:11 UTC 2019 Modified Files: src/usr.bin/systat: extern.h iostat.c main.c syscall.c vmstat.c Log Message: PR/53906: Paul Ripke: systat(1) vmstat & syscall get "alternate system clock has died" on terminal resize (SIGWINCH) To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.bin/systat/extern.h cvs rdiff -u -r1.38 -r1.39 src/usr.bin/systat/iostat.c cvs rdiff -u -r1.54 -r1.55 src/usr.bin/systat/main.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/systat/syscall.c cvs rdiff -u -r1.84 -r1.85 src/usr.bin/systat/vmstat.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.bin/systat/extern.h diff -u src/usr.bin/systat/extern.h:1.46 src/usr.bin/systat/extern.h:1.47 --- src/usr.bin/systat/extern.h:1.46 Sat Oct 22 18:02:55 2016 +++ src/usr.bin/systat/extern.h Fri Jan 25 10:31:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.46 2016/10/22 22:02:55 christos Exp $ */ +/* $NetBSD: extern.h,v 1.47 2019/01/25 15:31:11 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -33,10 +33,12 @@ #include #include +#include #include #define ADJINETCTR(c, o, n, e) (c.e = n.e - o.e) #define xADJINETCTR(c, o, n, e) (c[e] = n[e] - o[e]) +#define MAXFAIL 5 extern struct command global_commands[]; extern struct mode *curmode; @@ -60,6 +62,8 @@ extern char *memf; extern int allflag; extern int turns; extern gid_t egid; +extern float hertz; +extern double etime; struct inpcb; #ifdef INET6 @@ -210,6 +214,7 @@ void tcp_boot(char *); void tcp_run(char *); void tcp_time(char *); void tcp_zero(char *); +bool toofast(int *); void vmstat_boot(char *); void vmstat_run(char *); void vmstat_time(char *); Index: src/usr.bin/systat/iostat.c diff -u src/usr.bin/systat/iostat.c:1.38 src/usr.bin/systat/iostat.c:1.39 --- src/usr.bin/systat/iostat.c:1.38 Sat Jul 15 04:22:23 2017 +++ src/usr.bin/systat/iostat.c Fri Jan 25 10:31:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: iostat.c,v 1.38 2017/07/15 08:22:23 mlelstv Exp $ */ +/* $NetBSD: iostat.c,v 1.39 2019/01/25 15:31:11 christos Exp $ */ /* * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: iostat.c,v 1.38 2017/07/15 08:22:23 mlelstv Exp $"); +__RCSID("$NetBSD: iostat.c,v 1.39 2019/01/25 15:31:11 christos Exp $"); #endif /* not lint */ #include @@ -46,7 +46,6 @@ __RCSID("$NetBSD: iostat.c,v 1.38 2017/0 #include "drvstats.h" static int linesperregion; -static double etime; static int numbers = 0; /* default display bar graphs */ static int secs = 0; /* default seconds shown */ static int read_write = 0; /* default read/write shown */ Index: src/usr.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.54 src/usr.bin/systat/main.c:1.55 --- src/usr.bin/systat/main.c:1.54 Tue Dec 25 20:47:37 2018 +++ src/usr.bin/systat/main.c Fri Jan 25 10:31:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.54 2018/12/26 01:47:37 sevan Exp $ */ +/* $NetBSD: main.c,v 1.55 2019/01/25 15:31:11 christos Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.54 2018/12/26 01:47:37 sevan Exp $"); +__RCSID("$NetBSD: main.c,v 1.55 2019/01/25 15:31:11 christos Exp $"); #endif /* not lint */ #include @@ -57,6 +57,7 @@ __RCSID("$NetBSD: main.c,v 1.54 2018/12/ #include "systat.h" #include "extern.h" +#include "drvstats.h" static int dellave; @@ -78,6 +79,8 @@ int turns = 2; /* stay how many refr int allflag; int allcounter; sig_atomic_t needsredraw = 0; +float hertz; +double etime; static WINDOW *wload; /* one line window for load average */ @@ -332,7 +335,6 @@ display(int signo) void redraw(void) { - resizeterm(LINES, COLS); CMDLINE = LINES - 1; labels(); @@ -417,3 +419,30 @@ nlisterr(struct nlist name_list[]) endwin(); exit(1); } + +bool +toofast(int *failcnt) +{ + static char pigs[] = "pigs"; + etime = cur.cp_etime; + /* < 1 ticks - sleep for a tick */ + /* this is often triggered by repeated SIGWINCH */ + if ((etime * hertz) >= 1.0) + return false; + + if ((*failcnt)++ <= MAXFAIL) { + struct timespec interval = { 0, 10L / hertz }; + while (nanosleep(&interval, &interval) == -1) + continue; + return true; + } + clear(); + mvprintw(2, 10, "The alternate system clock has died!"); + mvprintw(3, 10, "Reverting to ``pigs'' display."); + move(CMDLINE, 0); + refresh(); + failcnt = 0; + sleep(5); + command(pigs); + return true; +} Index: src/usr.bin/systat/syscall.c diff -u src/usr.bin/systat/syscall.c:1.9 src/usr.bin/systat/syscall.c:1.10 --- src/usr.bin/systat/syscall.c:1.9 Wed Feb 19 15:42:14 2014 +++ src/usr.bin/systat/syscall.c Fri Jan 25 10:31:11 2019 @@ -1,4 +1,4 @@ -
CVS commit: src/usr.bin/systat
Module Name:src Committed By: tih Date: Tue Jan 8 08:22:20 UTC 2019 Modified Files: src/usr.bin/systat: vmstat.c Log Message: Remove a format character from a non-format string. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/usr.bin/systat/vmstat.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.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.83 src/usr.bin/systat/vmstat.c:1.84 --- src/usr.bin/systat/vmstat.c:1.83 Wed Dec 26 01:47:37 2018 +++ src/usr.bin/systat/vmstat.c Tue Jan 8 08:22:20 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.83 2018/12/26 01:47:37 sevan Exp $ */ +/* $NetBSD: vmstat.c,v 1.84 2019/01/08 08:22:20 tih Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.83 2018/12/26 01:47:37 sevan Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.84 2019/01/08 08:22:20 tih Exp $"); #endif /* not lint */ /* @@ -365,7 +365,7 @@ labelvmstat(void) mvprintw(DISKROW, DISKCOL + 1 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "seeks"); mvprintw(DISKROW, DISKCOL + 2 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "xfers"); mvprintw(DISKROW, DISKCOL + 3 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "bytes"); - mvprintw(DISKROW, DISKCOL + 4 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "%%busy"); + mvprintw(DISKROW, DISKCOL + 4 * DISKCOLWIDTH, "%*s", DISKCOLWIDTH, "%busy"); } /* Middle column */
CVS commit: src/usr.bin/systat
Module Name:src Committed By: wiz Date: Fri Dec 28 12:21:53 UTC 2018 Modified Files: src/usr.bin/systat: systat.1 Log Message: Fix some macro usage. Fix a typo. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/usr.bin/systat/systat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/systat.1 diff -u src/usr.bin/systat/systat.1:1.50 src/usr.bin/systat/systat.1:1.51 --- src/usr.bin/systat/systat.1:1.50 Wed Dec 26 01:54:09 2018 +++ src/usr.bin/systat/systat.1 Fri Dec 28 12:21:53 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: systat.1,v 1.50 2018/12/26 01:54:09 sevan Exp $ +.\" $NetBSD: systat.1,v 1.51 2018/12/28 12:21:53 wiz Exp $ .\" .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -67,9 +67,7 @@ Other displays show more detailed proces swap space usage, disk usage statistics (a la .Xr df 1 ) , -disk -.Tn I/O -statistics (a la +disk I/O statistics (a la .Xr iostat 8 ) , virtual memory statistics (a la .Xr vmstat 1 ) , @@ -276,7 +274,6 @@ interfaces, all .Ic bge interfaces and the loopback interface. .El -.Pp .It Ic inet.icmp Display ICMP statistics. .It Ic inet.ip @@ -284,9 +281,7 @@ Display IPv4 and UDP statistics. .It Ic inet.tcp Display TCP statistics. .It Ic inet.tcpsyn -Display statistics about the -.Tn TCP -``syncache''. +Display statistics about the TCP ``syncache''. .It Ic inet6.ip6 Display IPv6 statistics. .It Ic iostat @@ -309,15 +304,11 @@ display; the minimum unambiguous prefix .Pp .Bl -tag -width Fl -compact .It Cm numbers -Show the disk -.Tn I/O -statistics in numeric form. +Show the disk I/O statistics in numeric form. Values are displayed in numeric columns which scroll downward. .It Cm bars -Show the disk -.Tn I/O -statistics in bar graph form (default). +Show the disk I/O statistics in bar graph form (default). .It Cm secs Toggle the display of time in disk activity (the default is to not display time). @@ -447,9 +438,7 @@ the syscall. .It Ic vmstat Take over the entire display and show a (rather crowded) compendium of statistics related to virtual memory usage, process scheduling, -device interrupts, system name translation caching, disk -.Tn I/O -etc. +device interrupts, system name translation caching, disk I/O etc. .Pp The upper left quadrant of the screen shows the number of users logged in and the load average over the last one, five, @@ -527,40 +516,50 @@ Below the paging statistics is another c From top to bottom, these represent: .Pp .Bl -tag -width Fl -compact -.It Ic Sq forks -number of fork() calls -.It Ic Sq fkppw -number of fork() calls where parent waits -.It Ic Sq fksvm -number of fork() calls where vmspace is shared -.It Ic Sq pwait +.It Sq Ic forks +number of +.Fn fork +calls +.It Sq Ic fkppw +number of +.Fn fork +calls where parent waits +.It Sq Ic fksvm +number of +.Fn fork +calls where vmspace is shared +.It Sq Ic pwait number of times fault had to wait on a page -.It Ic Sq relck -number of times uvmfault_relock() is called -.It Ic Sq rlkok -number of times uvmfault_relock() is a success -.It Ic Sq noram +.It Sq Ic relck +number of times +.Fn uvmfault_relock +is called +.It Sq Ic rlkok +number of times +.Fn uvmfault_relock +is a success +.It Sq Ic noram number of times fault was out of RAM -.It Ic Sq ndcpy +.It Sq Ic ndcpy number of times fault clears ``needs copy'' -.It Ic Sq fltcp +.It Sq Ic fltcp number of times fault promotes with copy (2b) -.It Ic Sq zfod +.It Sq Ic zfod number of times fault promotes with zerofill (2b) -.It Ic Sq cow +.It Sq Ic cow number of times faulted for anonymous for Copy-On-Write (case 1b) -.It Ic Sq fmin +.It Sq Ic fmin min number of free pages -.It Ic Sq ftarg +.It Sq Ic ftarg target number of free pages -.It Ic Sq itarg +.It Sq Ic itarg target number of inactive pages -.It Ic Sq flnan +.It Sq Ic flnan number of times fault was out of anonymous pages -.It Ic Sq pdfre +.It Sq Ic pdfre number of pages daemon freed since boot -.It Ic Sq pdscn -number of pages daemon scaned since boot +.It Sq Ic pdscn +number of pages daemon scanned since boot .El .Pp Note that the `%zfod' percentage is usually less than 100%,
CVS commit: src/usr.bin/systat
Module Name:src Committed By: sevan Date: Wed Dec 26 01:54:09 UTC 2018 Modified Files: src/usr.bin/systat: systat.1 Log Message: Remove commentd out options for fields no longer present in source. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/usr.bin/systat/systat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/systat.1 diff -u src/usr.bin/systat/systat.1:1.49 src/usr.bin/systat/systat.1:1.50 --- src/usr.bin/systat/systat.1:1.49 Wed Dec 26 01:47:37 2018 +++ src/usr.bin/systat/systat.1 Wed Dec 26 01:54:09 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: systat.1,v 1.49 2018/12/26 01:47:37 sevan Exp $ +.\" $NetBSD: systat.1,v 1.50 2018/12/26 01:54:09 sevan Exp $ .\" .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -555,38 +555,8 @@ min number of free pages target number of free pages .It Ic Sq itarg target number of inactive pages -.\".It Ic Sq objlk -.\"object cache lookups -.\".It Ic Sq objht -.\"object cache hits -.\".It Ic Sq zfodw -.\"pages zero filled on demand -.\".It Ic Sq nzfod -.\"number of zfod's created -.\".It Ic Sq %zfod -.\"percentage of zfod's used -.\".It Ic Sq kern -.\"number of kernel pages .It Ic Sq flnan number of times fault was out of anonymous pages -.\".It Ic Sq act -.\"number of active pages -.\".It Ic Sq inact -.\"number of inactive pages -.\".It Ic Sq free -.\"number of free pages -.\".It Ic Sq daefr -.\"pages freed by daemon -.\".It Ic Sq prcfr -.\"pages freed by exiting processes -.\".It Ic Sq react -.\"number of pages reactivated from freelist -.\".It Ic Sq scan -.\"scans in page out daemon -.\".It Ic Sq hdrev -.\"revolutions of the hand -.\".It Ic Sq intrn -.\"in-transit blocking page faults per second over the refresh period. .It Ic Sq pdfre number of pages daemon freed since boot .It Ic Sq pdscn
CVS commit: src/usr.bin/systat
Module Name:src Committed By: sevan Date: Wed Dec 26 01:47:37 UTC 2018 Modified Files: src/usr.bin/systat: bufcache.c cmdtab.c main.c systat.1 systat.h vmstat.c Log Message: Extend "systat vm" output to provide better insight about buffercache and document it. >From Greg A. Woods in PR bin/36542 To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/systat/bufcache.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/systat/cmdtab.c cvs rdiff -u -r1.53 -r1.54 src/usr.bin/systat/main.c cvs rdiff -u -r1.48 -r1.49 src/usr.bin/systat/systat.1 cvs rdiff -u -r1.11 -r1.12 src/usr.bin/systat/systat.h cvs rdiff -u -r1.82 -r1.83 src/usr.bin/systat/vmstat.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.bin/systat/bufcache.c diff -u src/usr.bin/systat/bufcache.c:1.28 src/usr.bin/systat/bufcache.c:1.29 --- src/usr.bin/systat/bufcache.c:1.28 Fri Jun 9 00:13:29 2017 +++ src/usr.bin/systat/bufcache.c Wed Dec 26 01:47:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bufcache.c,v 1.28 2017/06/09 00:13:29 chs Exp $ */ +/* $NetBSD: bufcache.c,v 1.29 2018/12/26 01:47:37 sevan Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: bufcache.c,v 1.28 2017/06/09 00:13:29 chs Exp $"); +__RCSID("$NetBSD: bufcache.c,v 1.29 2018/12/26 01:47:37 sevan Exp $"); #endif /* not lint */ #include @@ -117,8 +117,8 @@ labelbufcache(void) wmove(wnd, i, 0); wclrtoeol(wnd); } - mvwaddstr(wnd, PAGEINFO_ROWS + 1, 0, "File System Bufs used" - " % kB in use % Bufsize kB % Util %"); + mvwaddstr(wnd, PAGEINFO_ROWS + 1, 0, +"File System Bufs used % kB in use % Bufsize kB % Util %"); wclrtoeol(wnd); } Index: src/usr.bin/systat/cmdtab.c diff -u src/usr.bin/systat/cmdtab.c:1.25 src/usr.bin/systat/cmdtab.c:1.26 --- src/usr.bin/systat/cmdtab.c:1.25 Tue Aug 2 15:56:09 2016 +++ src/usr.bin/systat/cmdtab.c Wed Dec 26 01:47:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cmdtab.c,v 1.25 2016/08/02 15:56:09 scole Exp $ */ +/* $NetBSD: cmdtab.c,v 1.26 2018/12/26 01:47:37 sevan Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: cmdtab.c,v 1.25 2016/08/02 15:56:09 scole Exp $"); +__RCSID("$NetBSD: cmdtab.c,v 1.26 2018/12/26 01:47:37 sevan Exp $"); #endif /* not lint */ #include "systat.h" @@ -52,6 +52,7 @@ struct command global_commands[] = { { "quit", global_quit, "exit systat"}, { "start", global_interval, "restart updating display"}, { "stop", global_stop, "stop updating display"}, + { "?", global_help, "show help"}, { .c_name = NULL } }; @@ -114,7 +115,7 @@ struct command netstat_commands[] = { { "names", netstat_names, "show names instead of addresses"}, { "numbers", netstat_numbers, "show addresses instead of names"}, { "reset", netstat_reset, "return to default display"}, - { "show", netstat_show, "show current display/ignore settings"}, + { "show", netstat_show, "show current display/ignore settings"}, { "tcp", netstat_tcp, "show only tcp connections"}, { "udp", netstat_udp, "show only udp connections"}, { .c_name = NULL } Index: src/usr.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.53 src/usr.bin/systat/main.c:1.54 --- src/usr.bin/systat/main.c:1.53 Wed Nov 22 02:52:42 2017 +++ src/usr.bin/systat/main.c Wed Dec 26 01:47:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.53 2017/11/22 02:52:42 snj Exp $ */ +/* $NetBSD: main.c,v 1.54 2018/12/26 01:47:37 sevan Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.53 2017/11/22 02:52:42 snj Exp $"); +__RCSID("$NetBSD: main.c,v 1.54 2018/12/26 01:47:37 sevan Exp $"); #endif /* not lint */ #include @@ -66,7 +66,7 @@ char *nlistf = NULL; sig_t sigtstpdfl; double avenrun[3]; int col; -double naptime = 5; +double naptime = 1; int verbose = 1;/* to report kvm read errs */ int hz, stathz, maxslp; charc; @@ -173,10 +173,8 @@ main(int argc, char **argv) (void)setegid(egid); kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf); - if (kd == NULL) { - error("%s", errbuf); - exit(1); - } + if (kd == NULL) + errx(1, "%s", errbuf); /* Get rid of privs for now. */ if (nlistf == NULL && memf == NULL) @@ -194,19 +192,24 @@ main(int argc, char **argv) * routines to minimize update work by curses. */ if (initscr() == NULL) - { - warnx("couldn't initialize screen"); - exit(0); - } + errx(1, "couldn't initialize screen"); CMDLINE = LINES - 1; wnd = (*curmode->c_open)(); if (wnd == NULL) { + move(CMDLINE, 0); + clrtoeol(); + refresh(); + endwin(); warnx("couldn't initialize
CVS commit: src/usr.bin/systat
Module Name:src Committed By: snj Date: Wed Nov 22 02:52:42 UTC 2017 Modified Files: src/usr.bin/systat: main.c Log Message: add -b to usage. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.bin/systat/main.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.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.52 src/usr.bin/systat/main.c:1.53 --- src/usr.bin/systat/main.c:1.52 Fri Nov 17 20:43:08 2017 +++ src/usr.bin/systat/main.c Wed Nov 22 02:52:42 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.52 2017/11/17 20:43:08 mrg Exp $ */ +/* $NetBSD: main.c,v 1.53 2017/11/22 02:52:42 snj Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.52 2017/11/17 20:43:08 mrg Exp $"); +__RCSID("$NetBSD: main.c,v 1.53 2017/11/22 02:52:42 snj Exp $"); #endif /* not lint */ #include @@ -242,7 +242,7 @@ main(int argc, char **argv) static void usage(void) { - fprintf(stderr, "usage: systat [-n] [-M core] [-N system] [-w wait] " + fprintf(stderr, "usage: systat [-bn] [-M core] [-N system] [-w wait] " "[-t turns]\n\t\t[display] [refresh-interval]\n"); exit(1); }
CVS commit: src/usr.bin/systat
Module Name:src Committed By: mrg Date: Fri Nov 17 20:43:08 UTC 2017 Modified Files: src/usr.bin/systat: main.c Log Message: add missing 'b' to the optstring. alpha-sort the option handling. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/usr.bin/systat/main.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.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.51 src/usr.bin/systat/main.c:1.52 --- src/usr.bin/systat/main.c:1.51 Sat Dec 3 03:26:27 2016 +++ src/usr.bin/systat/main.c Fri Nov 17 20:43:08 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.51 2016/12/03 03:26:27 mrg Exp $ */ +/* $NetBSD: main.c,v 1.52 2017/11/17 20:43:08 mrg Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.51 2016/12/03 03:26:27 mrg Exp $"); +__RCSID("$NetBSD: main.c,v 1.52 2017/11/17 20:43:08 mrg Exp $"); #endif /* not lint */ #include @@ -102,7 +102,7 @@ main(int argc, char **argv) egid = getegid(); (void)setegid(getgid()); - while ((ch = getopt(argc, argv, "M:N:nw:t:")) != -1) + while ((ch = getopt(argc, argv, "M:N:bnw:t:")) != -1) switch(ch) { case 'M': memf = optarg; @@ -110,19 +110,19 @@ main(int argc, char **argv) case 'N': nlistf = optarg; break; + case 'b': + bflag = !bflag; + break; case 'n': nflag = !nflag; break; - case 'w': - if ((naptime = strtod(optarg, NULL)) <= 0) -errx(1, "interval <= 0."); - break; case 't': if ((turns = atoi(optarg)) <= 0) errx(1, "turns <= 0."); break; - case 'b': - bflag = !bflag; + case 'w': + if ((naptime = strtod(optarg, NULL)) <= 0) +errx(1, "interval <= 0."); break; case '?': default:
CVS commit: src/usr.bin/systat
Module Name:src Committed By: mlelstv Date: Sat Jul 15 08:22:23 UTC 2017 Modified Files: src/usr.bin/systat: iostat.c vmstat.c Log Message: Use I/O timestamps to compute disk statistics for better precisison. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/systat/iostat.c cvs rdiff -u -r1.81 -r1.82 src/usr.bin/systat/vmstat.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.bin/systat/iostat.c diff -u src/usr.bin/systat/iostat.c:1.37 src/usr.bin/systat/iostat.c:1.38 --- src/usr.bin/systat/iostat.c:1.37 Mon Apr 13 23:20:27 2009 +++ src/usr.bin/systat/iostat.c Sat Jul 15 08:22:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: iostat.c,v 1.37 2009/04/13 23:20:27 lukem Exp $ */ +/* $NetBSD: iostat.c,v 1.38 2017/07/15 08:22:23 mlelstv Exp $ */ /* * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: iostat.c,v 1.37 2009/04/13 23:20:27 lukem Exp $"); +__RCSID("$NetBSD: iostat.c,v 1.38 2017/07/15 08:22:23 mlelstv Exp $"); #endif /* not lint */ #include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: iostat.c,v 1.37 2009/0 #include "drvstats.h" static int linesperregion; -static double etime; +static double etime; static int numbers = 0; /* default display bar graphs */ static int secs = 0; /* default seconds shown */ static int read_write = 0; /* default read/write shown */ @@ -252,9 +252,15 @@ showiostat(void) static int stats(int row, int col, int dn) { - double atime, rwords, wwords; + double atime, dtime, rwords, wwords; uint64_t rxfer; + /* elapsed time for disk stats */ + dtime = etime; + if (cur.timestamp[dn].tv_sec || cur.timestamp[dn].tv_usec) + dtime = (double)cur.timestamp[dn].tv_sec + + ((double)cur.timestamp[dn].tv_usec / (double)100); + /* time busy in disk activity */ atime = (double)cur.time[dn].tv_sec + ((double)cur.time[dn].tv_usec / (double)100); @@ -269,30 +275,30 @@ stats(int row, int col, int dn) } if (numbers) { mvwprintw(wnd, row, col, "%5.0f%4.0f", - rwords / etime, rxfer / etime); + rwords / dtime, rxfer / dtime); if (secs) - wprintw(wnd, "%5.1f", atime / etime); + wprintw(wnd, "%5.1f", atime / dtime); if (read_write) wprintw(wnd, " %5.0f%4.0f", - wwords / etime, cur.wxfer[dn] / etime); + wwords / dtime, cur.wxfer[dn] / dtime); return (row); } wmove(wnd, row++, col); - histogram(rwords / etime, 50, 0.5); + histogram(rwords / dtime, 50, 0.5); wmove(wnd, row++, col); - histogram(rxfer / etime, 50, 0.5); + histogram(rxfer / dtime, 50, 0.5); if (read_write) { wmove(wnd, row++, col); - histogram(wwords / etime, 50, 0.5); + histogram(wwords / dtime, 50, 0.5); wmove(wnd, row++, col); - histogram(cur.wxfer[dn] / etime, 50, 0.5); + histogram(cur.wxfer[dn] / dtime, 50, 0.5); } if (secs) { wmove(wnd, row++, col); atime *= 1000; /* In milliseconds */ - histogram(atime / etime, 50, 0.5); + histogram(atime / dtime, 50, 0.5); } return (row); } Index: src/usr.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.81 src/usr.bin/systat/vmstat.c:1.82 --- src/usr.bin/systat/vmstat.c:1.81 Wed Dec 24 20:01:22 2014 +++ src/usr.bin/systat/vmstat.c Sat Jul 15 08:22:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.81 2014/12/24 20:01:22 dennis Exp $ */ +/* $NetBSD: vmstat.c,v 1.82 2017/07/15 08:22:23 mlelstv Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.81 2014/12/24 20:01:22 dennis Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.82 2017/07/15 08:22:23 mlelstv Exp $"); #endif /* not lint */ /* @@ -827,24 +827,31 @@ copyinfo(struct Info *from, struct Info static void dinfo(int dn, int r, int c) { - double atime; + double atime, dtime; #define ADV if (disk_horiz) r++; else c += DISKCOLWIDTH + /* elapsed time for disk stats */ + dtime = etime; + if (cur.timestamp[dn].tv_sec || cur.timestamp[dn].tv_usec) { + dtime = (double)cur.timestamp[dn].tv_sec + + ((double)cur.timestamp[dn].tv_usec / (double)100); + } + mvprintw(r, c, "%*.*s", DISKCOLWIDTH, DISKCOLWIDTH, dr_name[dn]); ADV; - putint((int)(cur.seek[dn]/etime+0.5), r, c, DISKCOLWIDTH); + putint((int)(cur.seek[dn]/dtime+0.5), r, c, DISKCOLWIDTH); ADV; - putint((int)((cur.rxfer[dn]+cur.wxfer[dn])/etime+0.5), + putint((int)((cur.rxfer[dn]+cur.wxfer[dn])/dtime+0.5), r, c, DISKCOLWIDTH); ADV; - puthumanint((cur.rbytes[dn] + cur.wbytes[dn]) / etime + 0.5, + puthumanint((cur.rbytes[dn] + cur.wbytes[dn]) / dtime + 0.5, r, c, DISKCOLWIDTH); ADV; /* time busy in disk activity */ atime = cur.time[dn].tv_sec + cur.time[dn].tv_usec / 100.0; - atime = atime * 100.0 / etime; + atime = atime * 100.0 / dtime; if (atime >= 100) putint(100, r,
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Tue Jan 10 21:14:51 UTC 2017 Modified Files: src/usr.bin/systat: ps.c Log Message: need To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.bin/systat/ps.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.bin/systat/ps.c diff -u src/usr.bin/systat/ps.c:1.36 src/usr.bin/systat/ps.c:1.37 --- src/usr.bin/systat/ps.c:1.36 Wed Feb 19 15:42:14 2014 +++ src/usr.bin/systat/ps.c Tue Jan 10 16:14:51 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ps.c,v 1.36 2014/02/19 20:42:14 dsl Exp $ */ +/* $NetBSD: ps.c,v 1.37 2017/01/10 21:14:51 christos Exp $ */ /*- * Copyright (c) 1999 @@ -45,12 +45,13 @@ #include #ifndef lint -__RCSID("$NetBSD: ps.c,v 1.36 2014/02/19 20:42:14 dsl Exp $"); +__RCSID("$NetBSD: ps.c,v 1.37 2017/01/10 21:14:51 christos Exp $"); #endif /* not lint */ #include #include #include +#include #include #include
CVS commit: src/usr.bin/systat
Module Name:src Committed By: mrg Date: Sat Dec 3 03:26:27 UTC 2016 Modified Files: src/usr.bin/systat: main.c systat.1 Log Message: add a basic "-b" option - that outputs one display and exits. inspired by "top -b". still requires a curses-capable output without some fairly significant internal restructuring. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/usr.bin/systat/main.c cvs rdiff -u -r1.46 -r1.47 src/usr.bin/systat/systat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.50 src/usr.bin/systat/main.c:1.51 --- src/usr.bin/systat/main.c:1.50 Sat Oct 22 22:02:55 2016 +++ src/usr.bin/systat/main.c Sat Dec 3 03:26:27 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.50 2016/10/22 22:02:55 christos Exp $ */ +/* $NetBSD: main.c,v 1.51 2016/12/03 03:26:27 mrg Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.50 2016/10/22 22:02:55 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.51 2016/12/03 03:26:27 mrg Exp $"); #endif /* not lint */ #include @@ -96,6 +96,7 @@ main(int argc, char **argv) const char *all; struct clockinfo clk; size_t len; + int bflag = 0; all = "all"; egid = getegid(); @@ -120,6 +121,9 @@ main(int argc, char **argv) if ((turns = atoi(optarg)) <= 0) errx(1, "turns <= 0."); break; + case 'b': + bflag = !bflag; + break; case '?': default: usage(); @@ -226,9 +230,12 @@ main(int argc, char **argv) dellave = 0.0; display(0); - noecho(); - cbreak(); - keyboard(); + if (!bflag) { + noecho(); + cbreak(); + keyboard(); + } else + die(0); /*NOTREACHED*/ } Index: src/usr.bin/systat/systat.1 diff -u src/usr.bin/systat/systat.1:1.46 src/usr.bin/systat/systat.1:1.47 --- src/usr.bin/systat/systat.1:1.46 Wed Aug 3 13:09:43 2016 +++ src/usr.bin/systat/systat.1 Sat Dec 3 03:26:27 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: systat.1,v 1.46 2016/08/03 13:09:43 wiz Exp $ +.\" $NetBSD: systat.1,v 1.47 2016/12/03 03:26:27 mrg Exp $ .\" .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)systat.1 8.2 (Berkeley) 12/30/93 .\" -.Dd August 2, 2016 +.Dd November 16, 2016 .Dt SYSTAT 1 .Os .Sh NAME @@ -37,7 +37,7 @@ .Nd display system statistics in a full-screen view .Sh SYNOPSIS .Nm -.Op Fl n +.Op Fl bn .Op Fl M Ar core .Op Fl N Ar system .Op Fl t Ar turns @@ -94,6 +94,8 @@ Extract the name list from .Ar system instead of the default .Pa /netbsd . +.It Fl b +Show the chosen display once and exit. .It Fl n Do not resolve IP addresses into string hostnames .Pq FQDNs @@ -626,3 +628,8 @@ The .Ic vmstat display looks out of place because it is (it was added in as a separate display from what used to be a different program). +.Pp +The +.Fl b +option requires a real terminal and could be converted to +simply output to standard output.
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Mon Oct 24 00:40:17 UTC 2016 Modified Files: src/usr.bin/systat: bufcache.c Log Message: sysctlbyname is convenient, but ain't cheap. Cache it. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.bin/systat/bufcache.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.bin/systat/bufcache.c diff -u src/usr.bin/systat/bufcache.c:1.26 src/usr.bin/systat/bufcache.c:1.27 --- src/usr.bin/systat/bufcache.c:1.26 Fri Oct 18 16:47:07 2013 +++ src/usr.bin/systat/bufcache.c Sun Oct 23 20:40:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: bufcache.c,v 1.26 2013/10/18 20:47:07 christos Exp $ */ +/* $NetBSD: bufcache.c,v 1.27 2016/10/24 00:40:17 christos Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: bufcache.c,v 1.26 2013/10/18 20:47:07 christos Exp $"); +__RCSID("$NetBSD: bufcache.c,v 1.27 2016/10/24 00:40:17 christos Exp $"); #endif /* not lint */ #include @@ -128,10 +128,17 @@ showbufcache(void) double tvalid, tsize; struct ml_entry *ml; size_t len; + static int mib[] = { -1, 0 }; + if (mib[0] == -1) { + len = __arraycount(mib); + if (sysctlnametomib("vm.bufmem", mib, &len) == -1) + error("can't get \"vm.bufmem\" mib: %s", + strerror(errno)); + } len = sizeof(bufmem); - if (sysctlbyname("vm.bufmem", &bufmem, &len, NULL, 0)) - error("can't get \"vm.bufmmem\": %s", strerror(errno)); + if (sysctl(mib, 2, &bufmem, &len, NULL, 0) == -1) + error("can't get \"vm.bufmem\": %s", strerror(errno)); mvwprintw(wnd, 0, 0, " %*d metadata buffers using %*"PRIu64" kBytes of "
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Sat Oct 22 22:02:55 UTC 2016 Modified Files: src/usr.bin/systat: cmds.c extern.h main.c Log Message: allow fractional intervals To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/systat/cmds.c cvs rdiff -u -r1.45 -r1.46 src/usr.bin/systat/extern.h cvs rdiff -u -r1.49 -r1.50 src/usr.bin/systat/main.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.bin/systat/cmds.c diff -u src/usr.bin/systat/cmds.c:1.29 src/usr.bin/systat/cmds.c:1.30 --- src/usr.bin/systat/cmds.c:1.29 Tue Aug 2 11:56:09 2016 +++ src/usr.bin/systat/cmds.c Sat Oct 22 18:02:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cmds.c,v 1.29 2016/08/02 15:56:09 scole Exp $ */ +/* $NetBSD: cmds.c,v 1.30 2016/10/22 22:02:55 christos Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95"; #endif -__RCSID("$NetBSD: cmds.c,v 1.29 2016/08/02 15:56:09 scole Exp $"); +__RCSID("$NetBSD: cmds.c,v 1.30 2016/10/22 22:02:55 christos Exp $"); #endif /* not lint */ #include @@ -150,7 +150,7 @@ switch_mode(struct mode *p) void status(void) { - error("Showing %s, refresh every %d seconds.", curmode->c_name, naptime); + error("Showing %s, refresh every %g seconds.", curmode->c_name, naptime); } int Index: src/usr.bin/systat/extern.h diff -u src/usr.bin/systat/extern.h:1.45 src/usr.bin/systat/extern.h:1.46 --- src/usr.bin/systat/extern.h:1.45 Tue Aug 2 11:56:09 2016 +++ src/usr.bin/systat/extern.h Sat Oct 22 18:02:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.45 2016/08/02 15:56:09 scole Exp $ */ +/* $NetBSD: extern.h,v 1.46 2016/10/22 22:02:55 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -50,7 +50,7 @@ extern kvm_t *kd; extern long ntext, textp; extern int CMDLINE; extern int hz, stathz, maxslp; -extern int naptime; +extern double naptime; extern int nhosts; extern int nports; extern int protos; Index: src/usr.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.49 src/usr.bin/systat/main.c:1.50 --- src/usr.bin/systat/main.c:1.49 Sun Aug 23 14:33:15 2015 +++ src/usr.bin/systat/main.c Sat Oct 22 18:02:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.49 2015/08/23 18:33:15 mrg Exp $ */ +/* $NetBSD: main.c,v 1.50 2016/10/22 22:02:55 christos Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.49 2015/08/23 18:33:15 mrg Exp $"); +__RCSID("$NetBSD: main.c,v 1.50 2016/10/22 22:02:55 christos Exp $"); #endif /* not lint */ #include @@ -66,7 +66,7 @@ char *nlistf = NULL; sig_t sigtstpdfl; double avenrun[3]; int col; -int naptime = 5; +double naptime = 5; int verbose = 1;/* to report kvm read errs */ int hz, stathz, maxslp; charc; @@ -113,7 +113,7 @@ main(int argc, char **argv) nflag = !nflag; break; case 'w': - if ((naptime = atoi(optarg)) <= 0) + if ((naptime = strtod(optarg, NULL)) <= 0) errx(1, "interval <= 0."); break; case 't': @@ -133,7 +133,7 @@ main(int argc, char **argv) int modefound = 0; if (isdigit((unsigned char)argv[0][0])) { - naptime = atoi(argv[0]); + naptime = strtod(argv[0], NULL); if (naptime <= 0) naptime = 5; continue;
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Aug 5 07:22:17 UTC 2016 Modified Files: src/usr.bin/systat: ifstat.c Log Message: Avoid string gymnastics in an olympic year. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/systat/ifstat.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.bin/systat/ifstat.c diff -u src/usr.bin/systat/ifstat.c:1.3 src/usr.bin/systat/ifstat.c:1.4 --- src/usr.bin/systat/ifstat.c:1.3 Thu Aug 4 08:56:31 2016 +++ src/usr.bin/systat/ifstat.c Fri Aug 5 03:22:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ifstat.c,v 1.3 2016/08/04 12:56:31 jakllsch Exp $ */ +/* $NetBSD: ifstat.c,v 1.4 2016/08/05 07:22:17 christos Exp $ */ /* * Copyright (c) 2003, Trent Nelson, . @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ifstat.c,v 1.3 2016/08/04 12:56:31 jakllsch Exp $"); +__RCSID("$NetBSD: ifstat.c,v 1.4 2016/08/05 07:22:17 christos Exp $"); #endif /* not lint */ #include @@ -350,24 +350,11 @@ fetchifstat(void) static void right_align_string(struct if_stat *ifp) { - int str_len = 0, pad_len = 0; - char *newstr = NULL, *ptr = NULL; - if (ifp == NULL || ifp->if_mib.ifdr_name[0] == '\0') return; - else { - /* string length + '\0' */ - str_len = strlen(ifp->if_mib.ifdr_name)+1; - pad_len = IF_NAMESIZE-(str_len); - - newstr = ifp->if_name; - ptr = newstr + pad_len; - (void)memset((void *)newstr, (int)' ', IF_NAMESIZE); - (void)strncpy(ptr, (const char *)&ifp->if_mib.ifdr_name, - str_len); - } - return; + snprintf(ifp->if_name, IF_NAMESIZE, "%*s", IF_NAMESIZE - 1, + ifp->if_mib.ifdr_name); } static int
CVS commit: src/usr.bin/systat
Module Name:src Committed By: jakllsch Date: Thu Aug 4 12:56:31 UTC 2016 Modified Files: src/usr.bin/systat: ifstat.c Log Message: Make this build with clang: - Remove unused static const variables - Adjust impossibleish comparision. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/systat/ifstat.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.bin/systat/ifstat.c diff -u src/usr.bin/systat/ifstat.c:1.2 src/usr.bin/systat/ifstat.c:1.3 --- src/usr.bin/systat/ifstat.c:1.2 Tue Aug 2 17:53:46 2016 +++ src/usr.bin/systat/ifstat.c Thu Aug 4 12:56:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ifstat.c,v 1.2 2016/08/02 17:53:46 scole Exp $ */ +/* $NetBSD: ifstat.c,v 1.3 2016/08/04 12:56:31 jakllsch Exp $ */ /* * Copyright (c) 2003, Trent Nelson, . @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ifstat.c,v 1.2 2016/08/02 17:53:46 scole Exp $"); +__RCSID("$NetBSD: ifstat.c,v 1.3 2016/08/04 12:56:31 jakllsch Exp $"); #endif /* not lint */ #include @@ -60,12 +60,9 @@ __RCSID("$NetBSD: ifstat.c,v 1.2 2016/08 #define C4 60 /* 60-80 */ #define C5 80 /* Used for label positioning. */ -static const int col0 = 0; -static const int col1 = C1; static const int col2 = C2; static const int col3 = C3; static const int col4 = C4; -static const int col5 = C5; SLIST_HEAD(, if_stat) curlist; @@ -356,7 +353,7 @@ right_align_string(struct if_stat *ifp) int str_len = 0, pad_len = 0; char *newstr = NULL, *ptr = NULL; - if (ifp == NULL || ifp->if_mib.ifdr_name == NULL) + if (ifp == NULL || ifp->if_mib.ifdr_name[0] == '\0') return; else { /* string length + '\0' */
CVS commit: src/usr.bin/systat
Module Name:src Committed By: wiz Date: Wed Aug 3 13:09:44 UTC 2016 Modified Files: src/usr.bin/systat: systat.1 Log Message: Bump date for new ifstat command. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/usr.bin/systat/systat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/systat.1 diff -u src/usr.bin/systat/systat.1:1.45 src/usr.bin/systat/systat.1:1.46 --- src/usr.bin/systat/systat.1:1.45 Tue Aug 2 15:56:09 2016 +++ src/usr.bin/systat/systat.1 Wed Aug 3 13:09:43 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: systat.1,v 1.45 2016/08/02 15:56:09 scole Exp $ +.\" $NetBSD: systat.1,v 1.46 2016/08/03 13:09:43 wiz Exp $ .\" .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)systat.1 8.2 (Berkeley) 12/30/93 .\" -.Dd October 19, 2012 +.Dd August 2, 2016 .Dt SYSTAT 1 .Os .Sh NAME
CVS commit: src/usr.bin/systat
Module Name:src Committed By: scole Date: Tue Aug 2 17:53:46 UTC 2016 Modified Files: src/usr.bin/systat: convtbl.c convtbl.h ifcmds.c ifstat.c Log Message: Add $NetBSD$ tag for new files To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/systat/convtbl.c \ src/usr.bin/systat/convtbl.h src/usr.bin/systat/ifcmds.c \ src/usr.bin/systat/ifstat.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.bin/systat/convtbl.c diff -u src/usr.bin/systat/convtbl.c:1.1 src/usr.bin/systat/convtbl.c:1.2 --- src/usr.bin/systat/convtbl.c:1.1 Tue Aug 2 15:56:09 2016 +++ src/usr.bin/systat/convtbl.c Tue Aug 2 17:53:46 2016 @@ -1,3 +1,5 @@ +/* $NetBSD: convtbl.c,v 1.2 2016/08/02 17:53:46 scole Exp $ */ + /* * Copyright (c) 2003, Trent Nelson, . * All rights reserved. @@ -30,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: convtbl.c,v 1.1 2016/08/02 15:56:09 scole Exp $"); +__RCSID("$NetBSD: convtbl.c,v 1.2 2016/08/02 17:53:46 scole Exp $"); #endif /* not lint */ #include Index: src/usr.bin/systat/convtbl.h diff -u src/usr.bin/systat/convtbl.h:1.1 src/usr.bin/systat/convtbl.h:1.2 --- src/usr.bin/systat/convtbl.h:1.1 Tue Aug 2 15:56:09 2016 +++ src/usr.bin/systat/convtbl.h Tue Aug 2 17:53:46 2016 @@ -1,3 +1,5 @@ +/* $NetBSD: convtbl.h,v 1.2 2016/08/02 17:53:46 scole Exp $ */ + /* * Copyright (c) 2003, Trent Nelson, . * All rights reserved. Index: src/usr.bin/systat/ifcmds.c diff -u src/usr.bin/systat/ifcmds.c:1.1 src/usr.bin/systat/ifcmds.c:1.2 --- src/usr.bin/systat/ifcmds.c:1.1 Tue Aug 2 15:56:09 2016 +++ src/usr.bin/systat/ifcmds.c Tue Aug 2 17:53:46 2016 @@ -1,3 +1,5 @@ +/* $NetBSD: ifcmds.c,v 1.2 2016/08/02 17:53:46 scole Exp $ */ + /* * Copyright (c) 2003, Trent Nelson, . * All rights reserved. @@ -30,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ifcmds.c,v 1.1 2016/08/02 15:56:09 scole Exp $"); +__RCSID("$NetBSD: ifcmds.c,v 1.2 2016/08/02 17:53:46 scole Exp $"); #endif /* not lint */ #include Index: src/usr.bin/systat/ifstat.c diff -u src/usr.bin/systat/ifstat.c:1.1 src/usr.bin/systat/ifstat.c:1.2 --- src/usr.bin/systat/ifstat.c:1.1 Tue Aug 2 15:56:09 2016 +++ src/usr.bin/systat/ifstat.c Tue Aug 2 17:53:46 2016 @@ -1,3 +1,5 @@ +/* $NetBSD: ifstat.c,v 1.2 2016/08/02 17:53:46 scole Exp $ */ + /* * Copyright (c) 2003, Trent Nelson, . * All rights reserved. @@ -30,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ifstat.c,v 1.1 2016/08/02 15:56:09 scole Exp $"); +__RCSID("$NetBSD: ifstat.c,v 1.2 2016/08/02 17:53:46 scole Exp $"); #endif /* not lint */ #include
CVS commit: src/usr.bin/systat
Module Name:src Committed By: scole Date: Tue Aug 2 15:56:09 UTC 2016 Modified Files: src/usr.bin/systat: Makefile cmds.c cmdtab.c extern.h systat.1 Added Files: src/usr.bin/systat: convtbl.c convtbl.h ifcmds.c ifstat.c Log Message: PR bin/51204 Add ifstat command to systat. Imported from FreeBSD To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/systat/Makefile cvs rdiff -u -r1.28 -r1.29 src/usr.bin/systat/cmds.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/systat/cmdtab.c cvs rdiff -u -r0 -r1.1 src/usr.bin/systat/convtbl.c \ src/usr.bin/systat/convtbl.h src/usr.bin/systat/ifcmds.c \ src/usr.bin/systat/ifstat.c cvs rdiff -u -r1.44 -r1.45 src/usr.bin/systat/extern.h \ src/usr.bin/systat/systat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/Makefile diff -u src/usr.bin/systat/Makefile:1.38 src/usr.bin/systat/Makefile:1.39 --- src/usr.bin/systat/Makefile:1.38 Sat Jan 23 21:22:50 2016 +++ src/usr.bin/systat/Makefile Tue Aug 2 15:56:09 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.38 2016/01/23 21:22:50 christos Exp $ +# $NetBSD: Makefile,v 1.39 2016/08/02 15:56:09 scole Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 .include @@ -11,10 +11,10 @@ PROG= systat CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin/vmstat -DSUPPORT_UTMP -DSUPPORT_UTMPX \ -I${NETBSDSRCDIR}/usr.bin/who -D_KMEMUSER CWARNFLAGS+=-Wno-format-y2k -SRCS= bufcache.c cmds.c cmdtab.c disks.c df.c drvstats.c fetch.c \ - globalcmds.c icmp.c iostat.c ip.c keyboard.c main.c mbufs.c \ - netcmds.c netstat.c pigs.c ps.c swap.c tcp.c vmstat.c utmpentry.c \ - syscall.c +SRCS= bufcache.c cmds.c cmdtab.c convtbl.c disks.c df.c drvstats.c \ + fetch.c globalcmds.c icmp.c ifcmds.c ifstat.c iostat.c ip.c \ + keyboard.c main.c mbufs.c netcmds.c netstat.c pigs.c ps.c swap.c \ + tcp.c vmstat.c utmpentry.c syscall.c DPADD= ${LIBCURSES} ${LIBTERMINFO} ${LIBM} ${LIBKVM} LDADD= -lutil -lcurses -lterminfo -lm -lkvm BINGRP= kmem Index: src/usr.bin/systat/cmds.c diff -u src/usr.bin/systat/cmds.c:1.28 src/usr.bin/systat/cmds.c:1.29 --- src/usr.bin/systat/cmds.c:1.28 Thu Nov 4 07:18:47 2004 +++ src/usr.bin/systat/cmds.c Tue Aug 2 15:56:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cmds.c,v 1.28 2004/11/04 07:18:47 dsl Exp $ */ +/* $NetBSD: cmds.c,v 1.29 2016/08/02 15:56:09 scole Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95"; #endif -__RCSID("$NetBSD: cmds.c,v 1.28 2004/11/04 07:18:47 dsl Exp $"); +__RCSID("$NetBSD: cmds.c,v 1.29 2016/08/02 15:56:09 scole Exp $"); #endif /* not lint */ #include @@ -152,3 +152,15 @@ status(void) { error("Showing %s, refresh every %d seconds.", curmode->c_name, naptime); } + +int +prefix(const char *s1, const char *s2) +{ + + while (*s1 == *s2) { + if (*s1 == '\0') + return (1); + s1++, s2++; + } + return (*s1 == '\0'); +} Index: src/usr.bin/systat/cmdtab.c diff -u src/usr.bin/systat/cmdtab.c:1.24 src/usr.bin/systat/cmdtab.c:1.25 --- src/usr.bin/systat/cmdtab.c:1.24 Fri Jan 6 14:08:08 2012 +++ src/usr.bin/systat/cmdtab.c Tue Aug 2 15:56:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cmdtab.c,v 1.24 2012/01/06 14:08:08 drochner Exp $ */ +/* $NetBSD: cmdtab.c,v 1.25 2016/08/02 15:56:09 scole Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: cmdtab.c,v 1.24 2012/01/06 14:08:08 drochner Exp $"); +__RCSID("$NetBSD: cmdtab.c,v 1.25 2016/08/02 15:56:09 scole Exp $"); #endif /* not lint */ #include "systat.h" @@ -69,6 +69,13 @@ struct command icmp_commands[] = { { .c_name = NULL } }; +struct command ifstat_commands[] = { + { "scale", ifstat_scale, "modify scale of display"}, + { "pps", ifstat_pps, "toggle packets per second display"}, + { "match", ifstat_match, "display matching interfaces"}, + { .c_name = NULL } +}; + struct command iostat_commands[] = { { "bars", iostat_bars, "show io stats as a bar graph"}, { "numbers", iostat_numbers, "show io stats numerically"}, @@ -159,6 +166,9 @@ struct mode modes[] = { { "df", showdf, fetchdf, labeldf, initdf, opendf, closedf, df_commands, CF_LOADAV }, + { "ifstat", showifstat, fetchifstat, labelifstat, + initifstat, openifstat, closeifstat, ifstat_commands, + CF_LOADAV }, { "inet.icmp", showicmp, fetchicmp, labelicmp, initicmp, openicmp, closeicmp, icmp_commands, CF_LOADAV }, Index: src/usr.bin/systat/extern.h diff -u src/usr.bin/systat/extern.h:1.44 src/usr.bin/systat/extern.h:1.45 --- src/usr.bin/systat/extern.h:1.44 Sun Aug 23 18:33:15 2015 +++ src/usr.bin/systat/extern.h Tue Aug 2 15:56:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.44 2015/08/23 18:33:15 mrg Exp $ */ +/* $NetBSD: extern.h,v 1.45 2016/08/02 15:56:09 scole Exp $ */ /*- * Copyright (c) 1991, 1993 @@
CVS commit: src/usr.bin/systat
Module Name:src Committed By: dholland Date: Sat Mar 12 02:39:01 UTC 2016 Modified Files: src/usr.bin/systat: systat.1 Log Message: NetBSD does actually support flat-panel displays. Even for systat(1). (noted by tnn) To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.bin/systat/systat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/systat.1 diff -u src/usr.bin/systat/systat.1:1.43 src/usr.bin/systat/systat.1:1.44 --- src/usr.bin/systat/systat.1:1.43 Fri Oct 18 22:42:31 2013 +++ src/usr.bin/systat/systat.1 Sat Mar 12 02:39:01 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: systat.1,v 1.43 2013/10/18 22:42:31 bad Exp $ +.\" $NetBSD: systat.1,v 1.44 2016/03/12 02:39:01 dholland Exp $ .\" .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -34,7 +34,7 @@ .Os .Sh NAME .Nm systat -.Nd display system statistics on a CRT +.Nd display system statistics in a full-screen view .Sh SYNOPSIS .Nm .Op Fl n
CVS commit: src/usr.bin/systat
Module Name:src Committed By: mrg Date: Sun Aug 23 18:33:15 UTC 2015 Modified Files: src/usr.bin/systat: extern.h keyboard.c main.c Log Message: if you change display types, the "Showing %s, refresh every %d seconds." message is retained, and you can't get rid of it. since it's dispalyed in inverse, it feels like there's always an error happening (which is really what the code has -- the above string is displayed via the error() function.) for several types of key press that largely are just "redraw" operation (space, ^L, etc.), clear the error string as well. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.bin/systat/extern.h cvs rdiff -u -r1.25 -r1.26 src/usr.bin/systat/keyboard.c cvs rdiff -u -r1.48 -r1.49 src/usr.bin/systat/main.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.bin/systat/extern.h diff -u src/usr.bin/systat/extern.h:1.43 src/usr.bin/systat/extern.h:1.44 --- src/usr.bin/systat/extern.h:1.43 Tue Jun 3 22:22:41 2014 +++ src/usr.bin/systat/extern.h Sun Aug 23 18:33:15 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.43 2014/06/03 22:22:41 joerg Exp $ */ +/* $NetBSD: extern.h,v 1.44 2015/08/23 18:33:15 mrg Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -93,6 +93,7 @@ void disks_remove(char *); void disks_drives(char *); void display(int); void error(const char *, ...) __printflike(1, 2); +void clearerror(void); void fetchbufcache(void); void fetchdf(void); void fetchicmp(void); Index: src/usr.bin/systat/keyboard.c diff -u src/usr.bin/systat/keyboard.c:1.25 src/usr.bin/systat/keyboard.c:1.26 --- src/usr.bin/systat/keyboard.c:1.25 Mon Oct 14 22:23:22 2013 +++ src/usr.bin/systat/keyboard.c Sun Aug 23 18:33:15 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: keyboard.c,v 1.25 2013/10/14 22:23:22 bad Exp $ */ +/* $NetBSD: keyboard.c,v 1.26 2015/08/23 18:33:15 mrg Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: keyboard.c,v 1.25 2013/10/14 22:23:22 bad Exp $"); +__RCSID("$NetBSD: keyboard.c,v 1.26 2015/08/23 18:33:15 mrg Exp $"); #endif /* not lint */ #include @@ -94,9 +94,11 @@ keyboard(void) case '\n': case '\r': case ' ': + clearerror(); display(0); break; case CTRL('l'): + clearerror(); wrefresh(curscr); break; case CTRL('g'): Index: src/usr.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.48 src/usr.bin/systat/main.c:1.49 --- src/usr.bin/systat/main.c:1.48 Tue Jun 3 22:22:41 2014 +++ src/usr.bin/systat/main.c Sun Aug 23 18:33:15 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.48 2014/06/03 22:22:41 joerg Exp $ */ +/* $NetBSD: main.c,v 1.49 2015/08/23 18:33:15 mrg Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.48 2014/06/03 22:22:41 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.49 2015/08/23 18:33:15 mrg Exp $"); #endif /* not lint */ #include @@ -383,6 +383,13 @@ error(const char *fmt, ...) } void +clearerror(void) +{ + + error("%s", ""); +} + +void nlisterr(struct nlist name_list[]) { int i, n;
CVS commit: src/usr.bin/systat
Module Name:src Committed By: njoly Date: Fri Jun 20 07:08:15 UTC 2014 Modified Files: src/usr.bin/systat: vmstat.c Log Message: Remove fagile test which ensured that first namelist element (was X_NCHSTATS) had a known type. Make disk stats available again for vmstat display. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/usr.bin/systat/vmstat.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.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.79 src/usr.bin/systat/vmstat.c:1.80 --- src/usr.bin/systat/vmstat.c:1.79 Sat Jun 14 20:10:42 2014 +++ src/usr.bin/systat/vmstat.c Fri Jun 20 07:08:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.79 2014/06/14 20:10:42 joerg Exp $ */ +/* $NetBSD: vmstat.c,v 1.80 2014/06/20 07:08:15 njoly Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.79 2014/06/14 20:10:42 joerg Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.80 2014/06/20 07:08:15 njoly Exp $"); #endif /* not lint */ /* @@ -212,10 +212,6 @@ initvmstat(void) nlisterr(namelist); return(0); } - if (namelist[0].n_type == 0) { - error("No namelist"); - return(0); - } } hertz = stathz ? stathz : hz; if (!drvinit(1))
CVS commit: src/usr.bin/systat
Module Name:src Committed By: joerg Date: Sat Jun 14 20:10:42 UTC 2014 Modified Files: src/usr.bin/systat: vmstat.c Log Message: GC X_NCHSTATS To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/systat/vmstat.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.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.78 src/usr.bin/systat/vmstat.c:1.79 --- src/usr.bin/systat/vmstat.c:1.78 Tue Jun 3 21:16:15 2014 +++ src/usr.bin/systat/vmstat.c Sat Jun 14 20:10:42 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.78 2014/06/03 21:16:15 joerg Exp $ */ +/* $NetBSD: vmstat.c,v 1.79 2014/06/14 20:10:42 joerg Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.78 2014/06/03 21:16:15 joerg Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.79 2014/06/14 20:10:42 joerg Exp $"); #endif /* not lint */ /* @@ -106,17 +106,15 @@ closevmstat(WINDOW *w) static struct nlist namelist[] = { -#define X_NCHSTATS 0 - { .n_name = "_nchstats" }, -#define X_INTRNAMES 1 +#define X_INTRNAMES 0 { .n_name = "_intrnames" }, -#define X_EINTRNAMES 2 +#define X_EINTRNAMES 1 { .n_name = "_eintrnames" }, -#define X_INTRCNT 3 +#define X_INTRCNT 2 { .n_name = "_intrcnt" }, -#define X_EINTRCNT 4 +#define X_EINTRCNT 3 { .n_name = "_eintrcnt" }, -#define X_ALLEVENTS 5 +#define X_ALLEVENTS 4 { .n_name = "_allevents" }, { .n_name = NULL } }; @@ -210,8 +208,7 @@ initvmstat(void) if (namelist[0].n_type == 0) { if (kvm_nlist(kd, namelist) && - (namelist[X_NCHSTATS].n_type == 0 || - namelist[X_ALLEVENTS].n_type == 0)) { + namelist[X_ALLEVENTS].n_type == 0) { nlisterr(namelist); return(0); }
CVS commit: src/usr.bin/systat
Module Name:src Committed By: joerg Date: Tue Jun 3 22:22:41 UTC 2014 Modified Files: src/usr.bin/systat: extern.h icmp.c ip.c ip6.c main.c tcp.c Log Message: Always use_sysctl in preparation of removing all kvm code. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.bin/systat/extern.h cvs rdiff -u -r1.12 -r1.13 src/usr.bin/systat/icmp.c cvs rdiff -u -r1.17 -r1.18 src/usr.bin/systat/ip.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/systat/ip6.c src/usr.bin/systat/tcp.c cvs rdiff -u -r1.47 -r1.48 src/usr.bin/systat/main.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.bin/systat/extern.h diff -u src/usr.bin/systat/extern.h:1.42 src/usr.bin/systat/extern.h:1.43 --- src/usr.bin/systat/extern.h:1.42 Fri Jan 6 14:08:08 2012 +++ src/usr.bin/systat/extern.h Tue Jun 3 22:22:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.42 2012/01/06 14:08:08 drochner Exp $ */ +/* $NetBSD: extern.h,v 1.43 2014/06/03 22:22:41 joerg Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -60,7 +60,6 @@ extern char *memf; extern int allflag; extern int turns; extern gid_t egid; -extern int use_sysctl; struct inpcb; #ifdef INET6 Index: src/usr.bin/systat/icmp.c diff -u src/usr.bin/systat/icmp.c:1.12 src/usr.bin/systat/icmp.c:1.13 --- src/usr.bin/systat/icmp.c:1.12 Thu Apr 10 17:16:39 2008 +++ src/usr.bin/systat/icmp.c Tue Jun 3 22:22:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: icmp.c,v 1.12 2008/04/10 17:16:39 thorpej Exp $ */ +/* $NetBSD: icmp.c,v 1.13 2014/06/03 22:22:41 joerg Exp $ */ /* * Copyright (c) 1999, 2000 Andrew Doran @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: icmp.c,v 1.12 2008/04/10 17:16:39 thorpej Exp $"); +__RCSID("$NetBSD: icmp.c,v 1.13 2014/06/03 22:22:41 joerg Exp $"); #endif /* not lint */ #include @@ -65,11 +65,6 @@ static uint64_t curstat[ICMP_NSTATS]; static uint64_t newstat[ICMP_NSTATS]; static uint64_t oldstat[ICMP_NSTATS]; -static struct nlist namelist[] = { - { .n_name = "_icmpstat" }, - { .n_name = NULL } -}; - WINDOW * openicmp(void) { @@ -160,36 +155,16 @@ int initicmp(void) { - if (! use_sysctl) { - 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 fetchicmp(void) { - int i; - - if (use_sysctl) { - size_t size = sizeof(newstat); + size_t i, size = sizeof(newstat); - if (sysctlbyname("net.inet.icmp.stats", newstat, &size, - NULL, 0) == -1) - return; - } else { - KREAD((void *)namelist[0].n_value, newstat, sizeof(newstat)); - } + if (sysctlbyname("net.inet.icmp.stats", newstat, &size, NULL, 0) == -1) + return; xADJINETCTR(curstat, oldstat, newstat, ICMP_STAT_BADCODE); xADJINETCTR(curstat, oldstat, newstat, ICMP_STAT_BADLEN); Index: src/usr.bin/systat/ip.c diff -u src/usr.bin/systat/ip.c:1.17 src/usr.bin/systat/ip.c:1.18 --- src/usr.bin/systat/ip.c:1.17 Thu Apr 10 17:16:39 2008 +++ src/usr.bin/systat/ip.c Tue Jun 3 22:22:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ip.c,v 1.17 2008/04/10 17:16:39 thorpej Exp $ */ +/* $NetBSD: ip.c,v 1.18 2014/06/03 22:22:41 joerg Exp $ */ /* * Copyright (c) 1999, 2000 Andrew Doran @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ip.c,v 1.17 2008/04/10 17:16:39 thorpej Exp $"); +__RCSID("$NetBSD: ip.c,v 1.18 2014/06/03 22:22:41 joerg Exp $"); #endif /* not lint */ #include @@ -68,12 +68,6 @@ static struct mystat curstat; static struct mystat oldstat; static struct mystat newstat; -static struct nlist namelist[] = { - { .n_name = "_ipstat" }, - { .n_name = "_udpstat" }, - { .n_name = NULL } -}; - WINDOW * openip(void) { @@ -186,42 +180,20 @@ int initip(void) { - if (! use_sysctl) { - if (namelist[0].n_type == 0) { - if (kvm_nlist(kd, namelist)) { -nlisterr(namelist); -return(0); - } - if ((namelist[0].n_type | namelist[1].n_type) == 0) { -error("No namelist"); -return(0); - } - } - } return 1; } void fetchip(void) { + size_t size; - if (use_sysctl) { - size_t size; - - size = sizeof(newstat.i); - if (sysctlbyname("net.inet.ip.stats", newstat.i, &size, - NULL, 0) == -1) - return; - size = sizeof(newstat.u); - if (sysctlbyname("net.inet.udp.stats", newstat.u, &size, - NULL, 0) == -1) - return; - } else { - KREAD((void *)namelist[0].n_value, newstat.i, - sizeof(newstat.i)); - KREAD((void *)namelist[1].n_value, newstat.u, - sizeof(newstat.u)); - } + size = sizeof(newstat.i); + if (sysctlbyname("net.inet.ip.stats", newstat.i, &size, NULL, 0) == -1) + return; + size = sizeof(newstat.u); + if (sysctlbyname("net.inet.udp.stats", newstat.u, &size, NULL, 0) == -1) + return; ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_TOTAL]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_DELIVERED]); Index: s
CVS commit: src/usr.bin/systat
Module Name:src Committed By: jdc Date: Sat Mar 8 20:51:20 UTC 2014 Modified Files: src/usr.bin/systat: disks.c Log Message: Restore lost break. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/systat/disks.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.bin/systat/disks.c diff -u src/usr.bin/systat/disks.c:1.18 src/usr.bin/systat/disks.c:1.19 --- src/usr.bin/systat/disks.c:1.18 Fri Oct 18 22:42:31 2013 +++ src/usr.bin/systat/disks.c Sat Mar 8 20:51:20 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.18 2013/10/18 22:42:31 bad Exp $ */ +/* $NetBSD: disks.c,v 1.19 2014/03/08 20:51:20 jdc Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: disks.c,v 1.18 2013/10/18 22:42:31 bad Exp $"); +__RCSID("$NetBSD: disks.c,v 1.19 2014/03/08 20:51:20 jdc Exp $"); #endif /* not lint */ #include @@ -102,6 +102,7 @@ drvselect(char *args, int truefalse, int for (i = 0; i < ndrive; i++) if (fnmatch(args, dr_name[i], 0) == 0) { selections[i] = truefalse; +break; } if (i >= ndrive) error("%s: unknown drive", args);
CVS commit: src/usr.bin/systat
Module Name:src Committed By: bad Date: Fri Oct 18 22:42:31 UTC 2013 Modified Files: src/usr.bin/systat: disks.c systat.1 Log Message: Make :drives, :display, :ignore accept fnmatch(3) patterns to specify drives. Bump man page date. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.bin/systat/disks.c cvs rdiff -u -r1.42 -r1.43 src/usr.bin/systat/systat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/disks.c diff -u src/usr.bin/systat/disks.c:1.17 src/usr.bin/systat/disks.c:1.18 --- src/usr.bin/systat/disks.c:1.17 Mon Apr 13 23:20:27 2009 +++ src/usr.bin/systat/disks.c Fri Oct 18 22:42:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.17 2009/04/13 23:20:27 lukem Exp $ */ +/* $NetBSD: disks.c,v 1.18 2013/10/18 22:42:31 bad Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,11 +34,12 @@ #if 0 static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: disks.c,v 1.17 2009/04/13 23:20:27 lukem Exp $"); +__RCSID("$NetBSD: disks.c,v 1.18 2013/10/18 22:42:31 bad Exp $"); #endif /* not lint */ #include #include +#include #include "systat.h" #include "extern.h" @@ -99,9 +100,8 @@ drvselect(char *args, int truefalse, int if (cp - args == 0) break; for (i = 0; i < ndrive; i++) - if (strcmp(args, dr_name[i]) == 0) { + if (fnmatch(args, dr_name[i], 0) == 0) { selections[i] = truefalse; -break; } if (i >= ndrive) error("%s: unknown drive", args); Index: src/usr.bin/systat/systat.1 diff -u src/usr.bin/systat/systat.1:1.42 src/usr.bin/systat/systat.1:1.43 --- src/usr.bin/systat/systat.1:1.42 Thu Mar 22 07:58:20 2012 +++ src/usr.bin/systat/systat.1 Fri Oct 18 22:42:31 2013 @@ -1,4 +1,4 @@ -.\" $NetBSD: systat.1,v 1.42 2012/03/22 07:58:20 wiz Exp $ +.\" $NetBSD: systat.1,v 1.43 2013/10/18 22:42:31 bad Exp $ .\" .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)systat.1 8.2 (Berkeley) 12/30/93 .\" -.Dd January 5, 2012 +.Dd October 19, 2012 .Dt SYSTAT 1 .Os .Sh NAME @@ -500,6 +500,9 @@ information about disk drives. These commands are used to select a set of drives to report on, should your system have more drives configured than can normally be displayed on the screen. +Drives may be specified as drive names or as patterns specified in the +notation described by +.Xr fnmatch 3 . .Pp .Bl -tag -width Ar -compact .It Cm display Op Ar drives
CVS commit: src/usr.bin/systat
Module Name:src Committed By: bad Date: Mon Oct 14 22:23:22 UTC 2013 Modified Files: src/usr.bin/systat: keyboard.c Log Message: No David, '\?' is not the del character. Broken in rev 1.21. XXX pullup-5, pullup-6. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/systat/keyboard.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.bin/systat/keyboard.c diff -u src/usr.bin/systat/keyboard.c:1.24 src/usr.bin/systat/keyboard.c:1.25 --- src/usr.bin/systat/keyboard.c:1.24 Mon Dec 31 00:22:14 2007 +++ src/usr.bin/systat/keyboard.c Mon Oct 14 22:23:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: keyboard.c,v 1.24 2007/12/31 00:22:14 christos Exp $ */ +/* $NetBSD: keyboard.c,v 1.25 2013/10/14 22:23:22 bad Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: keyboard.c,v 1.24 2007/12/31 00:22:14 christos Exp $"); +__RCSID("$NetBSD: keyboard.c,v 1.25 2013/10/14 22:23:22 bad Exp $"); #endif /* not lint */ #include @@ -121,7 +121,7 @@ keyboard(void) } continue; } - if (ch == '\b' || ch == '\?' || ch == erasechar()) { + if (ch == '\b' || ch == '\177' || ch == erasechar()) { if (col > 0) col--; goto doerase;
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Nov 23 15:35:57 UTC 2012 Modified Files: src/usr.bin/systat: bufcache.c Log Message: bufmem is unsigned. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/systat/bufcache.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.bin/systat/bufcache.c diff -u src/usr.bin/systat/bufcache.c:1.24 src/usr.bin/systat/bufcache.c:1.25 --- src/usr.bin/systat/bufcache.c:1.24 Fri Nov 23 01:44:38 2012 +++ src/usr.bin/systat/bufcache.c Fri Nov 23 10:35:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: bufcache.c,v 1.24 2012/11/23 06:44:38 pgoyette Exp $ */ +/* $NetBSD: bufcache.c,v 1.25 2012/11/23 15:35:57 christos Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: bufcache.c,v 1.24 2012/11/23 06:44:38 pgoyette Exp $"); +__RCSID("$NetBSD: bufcache.c,v 1.25 2012/11/23 15:35:57 christos Exp $"); #endif /* not lint */ #include @@ -134,7 +134,7 @@ showbufcache(void) error("can't get \"vm.bufmmem\": %s", strerror(errno)); mvwprintw(wnd, 0, 0, - " %*d metadata buffers using %*"PRId64" kBytes of " + " %*d metadata buffers using %*"PRIu64" kBytes of " "memory (%2.0f%%).", pgwidth, nbuf, kbwidth, bufmem / 1024, ((bufmem * 100.0) + 0.5) / getpagesize() / uvmexp.npages);
CVS commit: src/usr.bin/systat
Module Name:src Committed By: pgoyette Date: Fri Nov 23 06:44:39 UTC 2012 Modified Files: src/usr.bin/systat: bufcache.c Log Message: Fix format string to resolve build break To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/systat/bufcache.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.bin/systat/bufcache.c diff -u src/usr.bin/systat/bufcache.c:1.23 src/usr.bin/systat/bufcache.c:1.24 --- src/usr.bin/systat/bufcache.c:1.23 Fri Nov 23 03:37:27 2012 +++ src/usr.bin/systat/bufcache.c Fri Nov 23 06:44:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: bufcache.c,v 1.23 2012/11/23 03:37:27 christos Exp $ */ +/* $NetBSD: bufcache.c,v 1.24 2012/11/23 06:44:38 pgoyette Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: bufcache.c,v 1.23 2012/11/23 03:37:27 christos Exp $"); +__RCSID("$NetBSD: bufcache.c,v 1.24 2012/11/23 06:44:38 pgoyette Exp $"); #endif /* not lint */ #include @@ -134,7 +134,7 @@ showbufcache(void) error("can't get \"vm.bufmmem\": %s", strerror(errno)); mvwprintw(wnd, 0, 0, - " %*d metadata buffers using %*ld kBytes of " + " %*d metadata buffers using %*"PRId64" kBytes of " "memory (%2.0f%%).", pgwidth, nbuf, kbwidth, bufmem / 1024, ((bufmem * 100.0) + 0.5) / getpagesize() / uvmexp.npages);
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Nov 23 03:47:36 UTC 2012 Modified Files: src/usr.bin/systat: main.c Log Message: use more sysctl To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.bin/systat/main.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.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.46 src/usr.bin/systat/main.c:1.47 --- src/usr.bin/systat/main.c:1.46 Tue Sep 6 14:31:44 2011 +++ src/usr.bin/systat/main.c Thu Nov 22 22:47:36 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.46 2011/09/06 18:31:44 joerg Exp $ */ +/* $NetBSD: main.c,v 1.47 2012/11/23 03:47:36 christos Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,13 +36,16 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.46 2011/09/06 18:31:44 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.47 2012/11/23 03:47:36 christos Exp $"); #endif /* not lint */ #include +#include +#include #include #include +#include #include #include #include @@ -51,21 +54,10 @@ __RCSID("$NetBSD: main.c,v 1.46 2011/09/ #include #include #include -#include #include "systat.h" #include "extern.h" -static struct nlist namelist[] = { -#define X_FIRST 0 -#define X_HZ 0 - { .n_name = "_hz" }, -#define X_STATHZ 1 - { .n_name = "_stathz" }, -#define X_MAXSLP 2 - { .n_name = "_maxslp" }, - { .n_name = NULL } -}; static int dellave; kvm_t *kd; @@ -103,6 +95,8 @@ main(int argc, char **argv) int ch; char errbuf[_POSIX2_LINE_MAX]; const char *all; + struct clockinfo clk; + size_t len; all = "all"; egid = getegid(); @@ -186,13 +180,6 @@ main(int argc, char **argv) if (nlistf == NULL && memf == NULL) (void)setegid(getgid()); - if (kvm_nlist(kd, namelist)) { - if (nlistf) - errx(1, "%s: no namelist", nlistf); - else - errx(1, "no namelist"); - } - signal(SIGINT, die); signal(SIGQUIT, die); signal(SIGTERM, die); @@ -223,9 +210,17 @@ main(int argc, char **argv) } gethostname(hostname, sizeof (hostname)); hostname[sizeof(hostname) - 1] = '\0'; - NREAD(X_HZ, &hz, sizeof hz); - NREAD(X_STATHZ, &stathz, sizeof stathz); - NREAD(X_MAXSLP, &maxslp, sizeof maxslp); + + len = sizeof(clk); + if (sysctlbyname("kern.clockrate", &clk, &len, NULL, 0)) + error("can't get \"kern.clockrate\": %s", strerror(errno)); + hz = clk.hz; + stathz = clk.stathz; + + len = sizeof(maxslp); + if (sysctlbyname("vm.maxslp", &maxslp, &len, NULL, 0)) + error("can't get \"vm.maxslp\": %s", strerror(errno)); + (*curmode->c_init)(); curmode->c_flags |= CF_INIT; labels();
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Nov 23 03:46:35 UTC 2012 Modified Files: src/usr.bin/systat: pigs.c Log Message: fix wrong sysctl To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/systat/pigs.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.bin/systat/pigs.c diff -u src/usr.bin/systat/pigs.c:1.32 src/usr.bin/systat/pigs.c:1.33 --- src/usr.bin/systat/pigs.c:1.32 Thu Nov 22 22:33:05 2012 +++ src/usr.bin/systat/pigs.c Thu Nov 22 22:46:35 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pigs.c,v 1.32 2012/11/23 03:33:05 christos Exp $ */ +/* $NetBSD: pigs.c,v 1.33 2012/11/23 03:46:35 christos Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93"; #endif -__RCSID("$NetBSD: pigs.c,v 1.32 2012/11/23 03:33:05 christos Exp $"); +__RCSID("$NetBSD: pigs.c,v 1.33 2012/11/23 03:46:35 christos Exp $"); #endif /* not lint */ /* @@ -150,8 +150,8 @@ initpigs(void) (void) fetch_cptime(stime); len = sizeof(mempages); - if (sysctlbyname("kern.physmem64", &mempages, &len, NULL, 0)) - error("can't get \"kern.physmem64\": %s", strerror(errno)); + if (sysctlbyname("hw.physmem64", &mempages, &len, NULL, 0)) + error("can't get \"hw.physmem64\": %s", strerror(errno)); len = sizeof(ccpu); if (sysctlbyname("kern.ccpu", &ccpu, &len, NULL, 0))
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Nov 23 03:37:27 UTC 2012 Modified Files: src/usr.bin/systat: bufcache.c Log Message: use more sysctl To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/systat/bufcache.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.bin/systat/bufcache.c diff -u src/usr.bin/systat/bufcache.c:1.22 src/usr.bin/systat/bufcache.c:1.23 --- src/usr.bin/systat/bufcache.c:1.22 Mon Apr 28 16:24:15 2008 +++ src/usr.bin/systat/bufcache.c Thu Nov 22 22:37:27 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: bufcache.c,v 1.22 2008/04/28 20:24:15 martin Exp $ */ +/* $NetBSD: bufcache.c,v 1.23 2012/11/23 03:37:27 christos Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: bufcache.c,v 1.22 2008/04/28 20:24:15 martin Exp $"); +__RCSID("$NetBSD: bufcache.c,v 1.23 2012/11/23 03:37:27 christos Exp $"); #endif /* not lint */ #include @@ -74,16 +74,10 @@ struct ml_entry { struct mount ml_mount; }; -static struct nlist namelist[] = { -#define X_BUFMEM 0 - { .n_name = "_bufmem" }, - { .n_name = NULL }, -}; - static struct vcache vcache[VCACHE_SIZE]; static LIST_HEAD(mount_list, ml_entry) mount_list; -static u_long bufmem; +static uint64_t bufmem; static u_int nbuf, pgwidth, kbwidth; static struct uvmexp_sysctl uvmexp; @@ -133,8 +127,11 @@ showbufcache(void) int tbuf, i, lastrow; double tvalid, tsize; struct ml_entry *ml; + size_t len; - NREAD(X_BUFMEM, &bufmem, sizeof(bufmem)); + len = sizeof(bufmem); + if (sysctlbyname("vm.bufmem", &bufmem, &len, NULL, 0)) + error("can't get \"vm.bufmmem\": %s", strerror(errno)); mvwprintw(wnd, 0, 0, " %*d metadata buffers using %*ld kBytes of " @@ -218,13 +215,6 @@ showbufcache(void) int initbufcache(void) { - if (namelist[0].n_type == 0) { - if (kvm_nlist(kd, namelist)) { - nlisterr(namelist); - return(0); - } - } - fetchuvmexp(); pgwidth = (int)(floor(log10((double)uvmexp.npages)) + 1); kbwidth = (int)(floor(log10(uvmexp.npages * getpagesize() / 1024.0)) +
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Nov 23 03:33:05 UTC 2012 Modified Files: src/usr.bin/systat: pigs.c ps.h Log Message: use sysctl To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/systat/pigs.c cvs rdiff -u -r1.3 -r1.4 src/usr.bin/systat/ps.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/pigs.c diff -u src/usr.bin/systat/pigs.c:1.31 src/usr.bin/systat/pigs.c:1.32 --- src/usr.bin/systat/pigs.c:1.31 Wed Oct 21 17:12:07 2009 +++ src/usr.bin/systat/pigs.c Thu Nov 22 22:33:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pigs.c,v 1.31 2009/10/21 21:12:07 rmind Exp $ */ +/* $NetBSD: pigs.c,v 1.32 2012/11/23 03:33:05 christos Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93"; #endif -__RCSID("$NetBSD: pigs.c,v 1.31 2009/10/21 21:12:07 rmind Exp $"); +__RCSID("$NetBSD: pigs.c,v 1.32 2012/11/23 03:33:05 christos Exp $"); #endif /* not lint */ /* @@ -48,6 +48,7 @@ __RCSID("$NetBSD: pigs.c,v 1.31 2009/10/ #include #include #include +#include #include #include @@ -60,8 +61,8 @@ int compare_pctcpu(const void *, const v int nproc; struct p_times *pt; -u_int64_t stime[CPUSTATES]; -long mempages; +uint64_t stime[CPUSTATES]; +uint64_t mempages; int fscale; double lccpu; @@ -140,36 +141,26 @@ showpigs(void) wmove(wnd, y, 0); wclrtobot(wnd); } -static struct nlist namelist[] = { -#define X_FIRST 0 -#define X_CCPU 0 - { .n_name = "_ccpu" }, -#define X_FSCALE1 - { .n_name = "_fscale" }, -#define X_PHYSMEM 2 - { .n_name = "_physmem" }, - { .n_name = NULL } -}; - int initpigs(void) { fixpt_t ccpu; + size_t len; - if (namelist[X_FIRST].n_type == 0) { - if (kvm_nlist(kd, namelist)) { - nlisterr(namelist); - return(0); - } - if (namelist[X_FIRST].n_type == 0) { - error("namelist failed"); - return(0); - } - } (void) fetch_cptime(stime); - KREAD(NPTR(X_PHYSMEM), &mempages, sizeof (mempages)); - NREAD(X_CCPU, &ccpu, sizeof ccpu); - NREAD(X_FSCALE, &fscale, sizeof fscale); + + len = sizeof(mempages); + if (sysctlbyname("kern.physmem64", &mempages, &len, NULL, 0)) + error("can't get \"kern.physmem64\": %s", strerror(errno)); + + len = sizeof(ccpu); + if (sysctlbyname("kern.ccpu", &ccpu, &len, NULL, 0)) + error("can't get \"kern.ccpu\": %s", strerror(errno)); + + len = sizeof(fscale); + if (sysctlbyname("kern.fscale", &fscale, &len, NULL, 0)) + error("can't get \"kern.fscale\": %s", strerror(errno)); + lccpu = log((double) ccpu / fscale); return(1); @@ -185,8 +176,6 @@ fetchpigs(void) double t; static int lastnproc = 0; - if (namelist[X_FIRST].n_type == 0) - return; if ((kpp = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(*kpp), &nproc)) == NULL) { error("%s", kvm_geterr(kd)); Index: src/usr.bin/systat/ps.h diff -u src/usr.bin/systat/ps.h:1.3 src/usr.bin/systat/ps.h:1.4 --- src/usr.bin/systat/ps.h:1.3 Sat May 4 14:44:27 2002 +++ src/usr.bin/systat/ps.h Thu Nov 22 22:33:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ps.h,v 1.3 2002/05/04 18:44:27 thorpej Exp $ */ +/* $NetBSD: ps.h,v 1.4 2012/11/23 03:33:05 christos Exp $ */ /*- * Copyright (c) 1999 @@ -42,4 +42,4 @@ extern struct p_times { extern u_int64_t stime[CPUSTATES]; extern int fscale; extern double lccpu; -extern long mempages; +extern uint64_t mempages;
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Nov 23 01:43:10 UTC 2012 Modified Files: src/usr.bin/systat: mbufs.c Log Message: mbufs display was broken since the time we moved to percpu stats. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/systat/mbufs.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.bin/systat/mbufs.c diff -u src/usr.bin/systat/mbufs.c:1.15 src/usr.bin/systat/mbufs.c:1.16 --- src/usr.bin/systat/mbufs.c:1.15 Mon Apr 13 19:20:27 2009 +++ src/usr.bin/systat/mbufs.c Thu Nov 22 20:43:10 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mbufs.c,v 1.15 2009/04/13 23:20:27 lukem Exp $ */ +/* $NetBSD: mbufs.c,v 1.16 2012/11/23 01:43:10 christos Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,37 +34,24 @@ #if 0 static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: mbufs.c,v 1.15 2009/04/13 23:20:27 lukem Exp $"); +__RCSID("$NetBSD: mbufs.c,v 1.16 2012/11/23 01:43:10 christos Exp $"); #endif /* not lint */ #include +#define MBUFTYPES #include +#include #include +#include +#include #include "systat.h" #include "extern.h" static struct mbstat *mb; -const char *mtnames[] = { - "free", - "data", - "headers", - "sockets", - "pcbs", - "routes", - "hosts", - "arps", - "socknames", - "zombies", - "sockopts", - "frags", - "rights", - "ifaddrs", -}; - -#define NNAMES (sizeof (mtnames) / sizeof (mtnames[0])) +#define NNAMES __arraycount(mbuftypes) WINDOW * openmbufs(void) @@ -101,7 +88,7 @@ showmbufs(void) if (mb == 0) return; - for (j = 0; j < getmaxy(wnd); j++) { + for (j = 1; j <= getmaxy(wnd); j++) { max = 0, idx = -1; for (i = 0; i < getmaxy(wnd); i++) if (mb->m_mtypes[i] > max) { @@ -110,11 +97,11 @@ showmbufs(void) } if (max == 0) break; - if (j > (int)NNAMES) - mvwprintw(wnd, 1+j, 0, "%10d", idx); + if (j >= (int)NNAMES) + mvwprintw(wnd, j, 0, "%10d", idx); else - mvwprintw(wnd, 1+j, 0, "%-10.10s", mtnames[idx]); - wmove(wnd, 1 + j, 10); + mvwprintw(wnd, j, 0, "%-10.10s", &mbuftypes[idx][2]); + wmove(wnd, j, 10); if (max > 60) { snprintf(buf, sizeof buf, " %5d", max); max = 60; @@ -127,39 +114,22 @@ showmbufs(void) } mb->m_mtypes[idx] = 0; } - wmove(wnd, 1+j, 0); wclrtobot(wnd); + wmove(wnd, j, 0); + wclrtobot(wnd); } -static struct nlist namelist[] = { -#define X_MBSTAT 0 - { .n_name = "_mbstat" }, - { .n_name = NULL } -}; - int initmbufs(void) { - - if (namelist[X_MBSTAT].n_type == 0) { - if (kvm_nlist(kd, namelist)) { - nlisterr(namelist); - return(0); - } - if (namelist[X_MBSTAT].n_type == 0) { - error("No namelist"); - return(0); - } - } if (mb == 0) - mb = (struct mbstat *)calloc(1, sizeof (*mb)); + mb = calloc(1, sizeof (*mb)); return(1); } void fetchmbufs(void) { - - if (namelist[X_MBSTAT].n_type == 0) - return; - NREAD(X_MBSTAT, mb, sizeof (*mb)); + size_t len = sizeof(*mb); + if (sysctlbyname("kern.mbuf.stats", mb, &len, NULL, 0)) + error("error getting \"kern.mbuf.stats\": %s", strerror(errno)); }
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Fri Nov 23 00:05:19 UTC 2012 Modified Files: src/usr.bin/systat: syscall.c Log Message: PR/47222: Manuel Bouyer: Fix syscall display to show something reasonable. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/systat/syscall.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.bin/systat/syscall.c diff -u src/usr.bin/systat/syscall.c:1.7 src/usr.bin/systat/syscall.c:1.8 --- src/usr.bin/systat/syscall.c:1.7 Wed Oct 21 09:56:36 2009 +++ src/usr.bin/systat/syscall.c Thu Nov 22 19:05:18 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.7 2009/10/21 13:56:36 wiz Exp $ */ +/* $NetBSD: syscall.c,v 1.8 2012/11/23 00:05:18 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: syscall.c,v 1.7 2009/10/21 13:56:36 wiz Exp $"); +__RCSID("$NetBSD: syscall.c,v 1.8 2012/11/23 00:05:18 christos Exp $"); /* System call stats */ @@ -55,8 +55,6 @@ __RCSID("$NetBSD: syscall.c,v 1.7 2009/1 #include #include <../../sys/kern/syscalls.c> -#define nelem(x) (sizeof (x) / sizeof *(x)) - static struct Info { struct uvmexp_sysctl uvmexp; struct vmtotal Total; @@ -117,11 +115,12 @@ initsyscall(void) /* drvinit gets number of cpus! */ drvinit(1); - counts_mib_len = nelem(counts_mib); - if (sysctlnametomib("kern.syscalls.counts", counts_mib, &counts_mib_len)) + counts_mib_len = __arraycount(counts_mib); + if (sysctlnametomib("kern.syscalls.counts", counts_mib, + &counts_mib_len)) counts_mib_len = 0; - times_mib_len = nelem(times_mib); + times_mib_len = __arraycount(times_mib); if (sysctlnametomib("kern.syscalls.times", times_mib, ×_mib_len)) times_mib_len = 0; @@ -222,7 +221,7 @@ showsyscall(void) show_vmstat_top(&s.Total, &s.uvmexp, &s1.uvmexp); /* Sort out the values we are going to display */ - for (i = 0; i < (int)nelem(s.counts); i++) { + for (i = 0; i < (int)__arraycount(s.counts); i++) { switch (show) { default: case SHOW_COUNTS: @@ -256,19 +255,28 @@ showsyscall(void) if (sort_order == COUNTS) { /* mergesort() doesn't swap equal values about... */ - mergesort(syscall_sort, nelem(syscall_sort), + mergesort(syscall_sort, __arraycount(syscall_sort), sizeof syscall_sort[0], compare_irf); } l = SYSCALLROW; c = 0; move(l, c); - for (ii = 0; ii < (int)nelem(s.counts); ii++) { +#define FMT "compile kernel with \"options SYSCALL_%s\" to get syscall %s" + if (counts_mib_len == 0) { + mvprintw(l, c, FMT, "STATS", "counts"); + l++; + } + if (times_mib_len == 0) { + mvprintw(l, c, FMT, "TIMES", "times"); + l++; + } + for (ii = 0; ii < (int)__arraycount(s.counts); ii++) { i = syscall_sort[ii]; if (val[i] == 0 && irf[i] == 0) continue; - if (i < (int)nelem(syscallnames)) { + if (i < (int)__arraycount(syscallnames)) { const char *name = syscallnames[i]; while (name[0] == '_') name++; @@ -360,12 +368,12 @@ syscall_order(char *args) goto usage; /* Undo all the sorting */ - for (i = 0; i < (int)nelem(syscall_sort); i++) + for (i = 0; i < (int)__arraycount(syscall_sort); i++) syscall_sort[i] = i; if (sort_order == NAMES) { /* Only sort the entries we have names for */ - qsort(syscall_sort, nelem(syscallnames), sizeof syscall_sort[0], + qsort(syscall_sort, __arraycount(syscallnames), sizeof syscall_sort[0], compare_names); } return; @@ -415,21 +423,25 @@ getinfo(struct Info *stats, int get_what if (get_what & SHOW_COUNTS) { size = sizeof stats->counts; - if (!counts_mib_len || - sysctl(counts_mib, counts_mib_len, &stats->counts, &size, - NULL, 0)) { - error("can't get syscall counts: %s\n", strerror(errno)); - memset(&stats->counts, 0, sizeof stats->counts); + if (counts_mib_len != 0) { + if (sysctl(counts_mib, counts_mib_len, &stats->counts, + &size, NULL, 0)) { +error("can't get syscall counts: %s\n", +strerror(errno)); +memset(&stats->counts, 0, sizeof stats->counts); + } } } if (get_what & SHOW_TIMES) { size = sizeof stats->times; - if (!times_mib_len || - sysctl(times_mib, times_mib_len, &stats->times, &size, - NULL, 0)) { - error("can't get syscall times: %s\n", strerror(errno)); - memset(&stats->times, 0, sizeof stats->times); + if (times_mib_len != 0) { + if (sysctl(times_mib, times_mib_len, &stats->times, + &size, NULL, 0)) { +error("can't get syscall times: %s\n", +strerror(errno)); +memset(&stats->times, 0, sizeof stats->times); + } } }
CVS commit: src/usr.bin/systat
Module Name:src Committed By: drochner Date: Fri Jan 6 14:08:09 UTC 2012 Modified Files: src/usr.bin/systat: Makefile cmdtab.c extern.h systat.1 Removed Files: src/usr.bin/systat: ipsec.c Log Message: kill ipsec support which hasn't been working for a long time (neither for KAME nor for FAST_IPSEC) To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.bin/systat/Makefile cvs rdiff -u -r1.23 -r1.24 src/usr.bin/systat/cmdtab.c cvs rdiff -u -r1.41 -r1.42 src/usr.bin/systat/extern.h cvs rdiff -u -r1.10 -r0 src/usr.bin/systat/ipsec.c cvs rdiff -u -r1.40 -r1.41 src/usr.bin/systat/systat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/systat/Makefile diff -u src/usr.bin/systat/Makefile:1.36 src/usr.bin/systat/Makefile:1.37 --- src/usr.bin/systat/Makefile:1.36 Sat Feb 6 23:45:26 2010 +++ src/usr.bin/systat/Makefile Fri Jan 6 14:08:08 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.36 2010/02/06 23:45:26 he Exp $ +# $NetBSD: Makefile,v 1.37 2012/01/06 14:08:08 drochner Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 .include @@ -22,9 +22,6 @@ BINMODE=2555 LINKS= ${BINDIR}/systat ${BINDIR}/sysstat MLINKS+=systat.1 sysstat.1 -CPPFLAGS+=-DIPSEC -SRCS+= ipsec.c - .if (${USE_INET6} != "no") CPPFLAGS+=-DINET6 SRCS+= ip6.c Index: src/usr.bin/systat/cmdtab.c diff -u src/usr.bin/systat/cmdtab.c:1.23 src/usr.bin/systat/cmdtab.c:1.24 --- src/usr.bin/systat/cmdtab.c:1.23 Sun Feb 18 17:00:08 2007 +++ src/usr.bin/systat/cmdtab.c Fri Jan 6 14:08:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cmdtab.c,v 1.23 2007/02/18 17:00:08 dsl Exp $ */ +/* $NetBSD: cmdtab.c,v 1.24 2012/01/06 14:08:08 drochner Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: cmdtab.c,v 1.23 2007/02/18 17:00:08 dsl Exp $"); +__RCSID("$NetBSD: cmdtab.c,v 1.24 2012/01/06 14:08:08 drochner Exp $"); #endif /* not lint */ #include "systat.h" @@ -100,16 +100,6 @@ struct command ip6_commands[] = { }; #endif -#ifdef IPSEC -struct command ipsec_commands[] = { - { "boot", ipsec_boot, "show total stats since boot"}, - { "run", ipsec_run, "show running total stats"}, - { "time", ipsec_time, "show stats for each sample time"}, - { "zero", ipsec_zero, "re-zero running totals"}, - { .c_name = NULL } -}; -#endif - struct command netstat_commands[] = { { "all", netstat_all, "include server sockets"}, { "display", netstat_display, "show specified hosts or ports"}, @@ -186,11 +176,6 @@ struct mode modes[] = { initip6, openip6, closeip6, ip6_commands, CF_LOADAV }, #endif -#ifdef IPSEC - { "ipsec", showipsec, fetchipsec, labelipsec, - initipsec, openipsec, closeipsec, ipsec_commands, - CF_LOADAV }, -#endif { "iostat", showiostat, fetchiostat, labeliostat, initiostat, openiostat, closeiostat, iostat_commands, CF_LOADAV }, Index: src/usr.bin/systat/extern.h diff -u src/usr.bin/systat/extern.h:1.41 src/usr.bin/systat/extern.h:1.42 --- src/usr.bin/systat/extern.h:1.41 Tue Sep 6 18:31:44 2011 +++ src/usr.bin/systat/extern.h Fri Jan 6 14:08:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.41 2011/09/06 18:31:44 joerg Exp $ */ +/* $NetBSD: extern.h,v 1.42 2012/01/06 14:08:08 drochner Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -221,16 +221,3 @@ void ip6_run(char *); void ip6_time(char *); void ip6_zero(char *); #endif - -#ifdef IPSEC -void closeipsec(WINDOW *); -void fetchipsec(void); -int initipsec(void); -void labelipsec(void); -WINDOW *openipsec(void); -void showipsec(void); -void ipsec_boot(char *); -void ipsec_run(char *); -void ipsec_time(char *); -void ipsec_zero(char *); -#endif Index: src/usr.bin/systat/systat.1 diff -u src/usr.bin/systat/systat.1:1.40 src/usr.bin/systat/systat.1:1.41 --- src/usr.bin/systat/systat.1:1.40 Wed Oct 21 22:18:37 2009 +++ src/usr.bin/systat/systat.1 Fri Jan 6 14:08:08 2012 @@ -1,4 +1,4 @@ -.\" $NetBSD: systat.1,v 1.40 2009/10/21 22:18:37 wiz Exp $ +.\" $NetBSD: systat.1,v 1.41 2012/01/06 14:08:08 drochner Exp $ .\" .\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)systat.1 8.2 (Berkeley) 12/30/93 .\" -.Dd October 22, 2009 +.Dd January 5, 2012 .Dt SYSTAT 1 .Os .Sh NAME @@ -120,7 +120,6 @@ argument expects to be one of: .Ic inet.tcp , .Ic inet.tcpsyn , .Ic inet6.ip6 , -.Ic ipsec , .Ic iostat , .Ic mbufs , .Ic netstat , @@ -239,8 +238,6 @@ Display statistics about the ``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. @@ -520,7 +517,6 @@ with the ones specified. The following commands are specific to the .Ic inet.* , .Ic inet6.* , -.Ic ipsec , .Ic syscall and
CVS commit: src/usr.bin/systat
Module Name:src Committed By: joerg Date: Tue Sep 6 18:31:44 UTC 2011 Modified Files: src/usr.bin/systat: extern.h main.c Log Message: Consistently use __dead and __printflike. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.bin/systat/extern.h cvs rdiff -u -r1.45 -r1.46 src/usr.bin/systat/main.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.bin/systat/extern.h diff -u src/usr.bin/systat/extern.h:1.40 src/usr.bin/systat/extern.h:1.41 --- src/usr.bin/systat/extern.h:1.40 Thu Apr 10 17:14:25 2008 +++ src/usr.bin/systat/extern.h Tue Sep 6 18:31:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.40 2008/04/10 17:14:25 thorpej Exp $ */ +/* $NetBSD: extern.h,v 1.41 2011/09/06 18:31:44 joerg Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -88,13 +88,12 @@ void command(char *); void df_all(char *); void df_some(char *); -void die(int); +void die(int) __dead; void disks_add(char *); void disks_remove(char *); void disks_drives(char *); void display(int); -void error(const char *, ...) - __attribute__((__format__(__printf__, 1, 2))); +void error(const char *, ...) __printflike(1, 2); void fetchbufcache(void); void fetchdf(void); void fetchicmp(void); @@ -111,7 +110,7 @@ void global_help(char *); void global_interval(char *); void global_load(char *); -void global_quit(char *); +void global_quit(char *) __dead; void global_stop(char *); void icmp_boot(char *); void icmp_run(char *); @@ -138,7 +137,7 @@ void ip_run(char *); void ip_time(char *); void ip_zero(char *); -void keyboard(void) __attribute__((__noreturn__)); +void keyboard(void) __dead; ssize_t kvm_ckread(const void *, void *, size_t, const char *); void labelbufcache(void); void labeldf(void); @@ -164,7 +163,7 @@ void netstat_show(char *); void netstat_tcp(char *); void netstat_udp(char *); -void nlisterr(struct nlist []) __attribute__((__noreturn__)); +void nlisterr(struct nlist []) __dead; WINDOW *openbufcache(void); WINDOW *opendf(void); WINDOW *openicmp(void); Index: src/usr.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.45 src/usr.bin/systat/main.c:1.46 --- src/usr.bin/systat/main.c:1.45 Wed Nov 4 21:46:24 2009 +++ src/usr.bin/systat/main.c Tue Sep 6 18:31:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.45 2009/11/04 21:46:24 dsl Exp $ */ +/* $NetBSD: main.c,v 1.46 2011/09/06 18:31:44 joerg Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.45 2009/11/04 21:46:24 dsl Exp $"); +__RCSID("$NetBSD: main.c,v 1.46 2011/09/06 18:31:44 joerg Exp $"); #endif /* not lint */ #include @@ -93,8 +93,7 @@ static void (*sv_stop_handler)(int); static void stop(int); -static void usage(void); -int main(int, char **); +__dead static void usage(void); gid_t egid; /* XXX needed by initiostat() and initkre() */
CVS commit: src/usr.bin/systat
Module Name:src Committed By: christos Date: Wed Aug 17 13:26:49 UTC 2011 Modified Files: src/usr.bin/systat: ps.c Log Message: eliminate non-literal format strings. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/systat/ps.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.bin/systat/ps.c diff -u src/usr.bin/systat/ps.c:1.34 src/usr.bin/systat/ps.c:1.35 --- src/usr.bin/systat/ps.c:1.34 Wed Oct 21 17:12:07 2009 +++ src/usr.bin/systat/ps.c Wed Aug 17 09:26:49 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ps.c,v 1.34 2009/10/21 21:12:07 rmind Exp $ */ +/* $NetBSD: ps.c,v 1.35 2011/08/17 13:26:49 christos Exp $ */ /*- * Copyright (c) 1999 @@ -45,7 +45,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ps.c,v 1.34 2009/10/21 21:12:07 rmind Exp $"); +__RCSID("$NetBSD: ps.c,v 1.35 2011/08/17 13:26:49 christos Exp $"); #endif /* not lint */ #include @@ -282,11 +282,12 @@ * they are printed within parentheses. */ if (kp->p_flag & P_SYSTEM) - fmt = "[%s]"; + fmt = "[]"; else - fmt = "(%s)"; + fmt = "()"; - snprintf(commstr, sizeof(commstr), fmt, kp->p_comm); + snprintf(commstr, sizeof(commstr), "%c%s%c", fmt[0], + kp->p_comm, fmt[1]); } return commstr; @@ -324,12 +325,10 @@ time(&now); if (now - u_start.tv_sec < 24 * SECSPERHOUR) { /* I *hate* SCCS... */ - static char fmt[] = "%l:%" "M%p"; - strftime(startstr, sizeof(startstr) - 1, fmt, tp); + strftime(startstr, sizeof(startstr) - 1, "%l:%" "M%p", tp); } else if (now - u_start.tv_sec < 7 * SECSPERDAY) { /* I *hate* SCCS... */ - static char fmt[] = "%a%" "I%p"; - strftime(startstr, sizeof(startstr) - 1, fmt, tp); + strftime(startstr, sizeof(startstr) - 1, "%a%" "I%p", tp); } else strftime(startstr, sizeof(startstr) - 1, "%e%b%y", tp);
CVS commit: src/usr.bin/systat
Module Name:src Committed By: njoly Date: Fri Apr 30 16:21:05 UTC 2010 Modified Files: src/usr.bin/systat: vmstat.c Log Message: Add per process cache values to the total name translations count. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/usr.bin/systat/vmstat.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.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.76 src/usr.bin/systat/vmstat.c:1.77 --- src/usr.bin/systat/vmstat.c:1.76 Fri Apr 30 13:49:22 2010 +++ src/usr.bin/systat/vmstat.c Fri Apr 30 16:21:05 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.76 2010/04/30 13:49:22 njoly Exp $ */ +/* $NetBSD: vmstat.c,v 1.77 2010/04/30 16:21:05 njoly Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.76 2010/04/30 13:49:22 njoly Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.77 2010/04/30 16:21:05 njoly Exp $"); #endif /* not lint */ /* @@ -530,7 +530,8 @@ Z(s, s1, ncs_goodhits); Z(s, s1, ncs_badhits); Z(s, s1, ncs_miss); Z(s, s1, ncs_long); Z(s, s1, ncs_pass2); Z(s, s1, ncs_2passes); s.nchcount = s.nchstats.ncs_goodhits + s.nchstats.ncs_badhits + - s.nchstats.ncs_miss + s.nchstats.ncs_long; + s.nchstats.ncs_miss + s.nchstats.ncs_long + + s.nchstats.ncs_pass2 + s.nchstats.ncs_2passes; if (display_mode == TIME) s1.nchcount = s.nchcount;
CVS commit: src/usr.bin/systat
Module Name:src Committed By: njoly Date: Fri Apr 30 13:49:22 UTC 2010 Modified Files: src/usr.bin/systat: vmstat.c Log Message: In vmstat display, add one more column to output memory values. Avoid overflow with more than 100GB. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/usr.bin/systat/vmstat.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.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.75 src/usr.bin/systat/vmstat.c:1.76 --- src/usr.bin/systat/vmstat.c:1.75 Wed Oct 21 21:12:07 2009 +++ src/usr.bin/systat/vmstat.c Fri Apr 30 13:49:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.75 2009/10/21 21:12:07 rmind Exp $ */ +/* $NetBSD: vmstat.c,v 1.76 2010/04/30 13:49:22 njoly Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.75 2009/10/21 21:12:07 rmind Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.76 2010/04/30 13:49:22 njoly Exp $"); #endif /* not lint */ /* @@ -350,8 +350,8 @@ /* Left hand column */ - mvprintw(MEMROW, MEMCOL, " memory totals (in kB)"); - mvprintw(MEMROW + 1, MEMCOL, " real virtual free"); + mvprintw(MEMROW, MEMCOL, " memory totals (in kB)"); + mvprintw(MEMROW + 1, MEMCOL, " real virtual free"); mvprintw(MEMROW + 2, MEMCOL, "Active"); mvprintw(MEMROW + 3, MEMCOL, "All"); @@ -514,15 +514,16 @@ /* Memory totals */ #define pgtokb(pg) ((pg) * (s.uvmexp.pagesize / 1024)) - putint(pgtokb(s.uvmexp.active), MEMROW + 2, MEMCOL + 6, 8); + putint(pgtokb(s.uvmexp.active), MEMROW + 2, MEMCOL + 6, 9); putint(pgtokb(s.uvmexp.active + s.uvmexp.swpginuse), /* XXX */ - MEMROW + 2, MEMCOL + 15, 8); - putint(pgtokb(s.uvmexp.npages - s.uvmexp.free), MEMROW + 3, MEMCOL + 6, 8); + MEMROW + 2, MEMCOL + 16, 9); + putint(pgtokb(s.uvmexp.npages - s.uvmexp.free), + MEMROW + 3, MEMCOL + 6, 9); putint(pgtokb(s.uvmexp.npages - s.uvmexp.free + s.uvmexp.swpginuse), - MEMROW + 3, MEMCOL + 15, 8); - putint(pgtokb(s.uvmexp.free), MEMROW + 2, MEMCOL + 24, 8); + MEMROW + 3, MEMCOL + 16, 9); + putint(pgtokb(s.uvmexp.free), MEMROW + 2, MEMCOL + 26, 9); putint(pgtokb(s.uvmexp.free + s.uvmexp.swpages - s.uvmexp.swpginuse), - MEMROW + 3, MEMCOL + 24, 8); + MEMROW + 3, MEMCOL + 26, 9); #undef pgtokb /* Namei cache */
CVS commit: src/usr.bin/systat
Module Name:src Committed By: dsl Date: Wed Nov 4 21:46:24 UTC 2009 Modified Files: src/usr.bin/systat: main.c Log Message: Allow display intervals > 25 seconds. Fixes PR/36999 I did contemplate chaging curses - but the code is replicated and warped. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/usr.bin/systat/main.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.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.44 src/usr.bin/systat/main.c:1.45 --- src/usr.bin/systat/main.c:1.44 Tue Jul 14 21:08:31 2009 +++ src/usr.bin/systat/main.c Wed Nov 4 21:46:24 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.44 2009/07/14 21:08:31 apb Exp $ */ +/* $NetBSD: main.c,v 1.45 2009/11/04 21:46:24 dsl Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.44 2009/07/14 21:08:31 apb Exp $"); +__RCSID("$NetBSD: main.c,v 1.45 2009/11/04 21:46:24 dsl Exp $"); #endif /* not lint */ #include @@ -267,8 +267,14 @@ void display(int signo) { + static int skip; int j; struct mode *p; + int ms_delay; + + if (signo == SIGALRM && skip-- > 0) + /* Don't display on this timeout */ + return; /* Get the load average over the last minute. */ (void)getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])); @@ -308,9 +314,17 @@ allcounter=0; } else allcounter++; - } + } - timeout(naptime * 1000); + /* curses timeout() uses VTIME, limited to 255 1/10th secs */ + ms_delay = naptime * 1000; + if (ms_delay < 25500) { + timeout(ms_delay); + skip = 0; + } else { + skip = ms_delay / 25500; + timeout(ms_delay / (skip + 1)); + } } void
CVS commit: src/usr.bin/systat
Module Name:src Committed By: dsl Date: Sun Nov 1 22:08:14 UTC 2009 Modified Files: src/usr.bin/systat: globalcmds.c Log Message: Correctly count number of chars output so that help isn't blank if the terminal is too narrow. Not ideal since the last command isn't shown on 80 column terminals. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.bin/systat/globalcmds.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.bin/systat/globalcmds.c diff -u src/usr.bin/systat/globalcmds.c:1.14 src/usr.bin/systat/globalcmds.c:1.15 --- src/usr.bin/systat/globalcmds.c:1.14 Mon Apr 13 23:20:27 2009 +++ src/usr.bin/systat/globalcmds.c Sun Nov 1 22:08:14 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: globalcmds.c,v 1.14 2009/04/13 23:20:27 lukem Exp $ */ +/* $NetBSD: globalcmds.c,v 1.15 2009/11/01 22:08:14 dsl Exp $ */ /*- * Copyright (c) 1999 @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: globalcmds.c,v 1.14 2009/04/13 23:20:27 lukem Exp $"); +__RCSID("$NetBSD: globalcmds.c,v 1.15 2009/11/01 22:08:14 dsl Exp $"); #endif /* not lint */ #include @@ -94,7 +94,8 @@ len = strlen(name); if (col + len > COLS) break; - addstr(name); col += len; + addstr(name); + col += len + 1; if (col + 1 < COLS) addch(' '); if (prev)
CVS commit: src/usr.bin/systat
Module Name:src Committed By: wiz Date: Wed Oct 21 13:56:36 UTC 2009 Modified Files: src/usr.bin/systat: syscall.c vmstat.c Log Message: Fix problems with SIGWINCH. From Paul Ripke in PR 42161. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.bin/systat/syscall.c cvs rdiff -u -r1.73 -r1.74 src/usr.bin/systat/vmstat.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.bin/systat/syscall.c diff -u src/usr.bin/systat/syscall.c:1.6 src/usr.bin/systat/syscall.c:1.7 --- src/usr.bin/systat/syscall.c:1.6 Mon Apr 13 23:20:27 2009 +++ src/usr.bin/systat/syscall.c Wed Oct 21 13:56:36 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.6 2009/04/13 23:20:27 lukem Exp $ */ +/* $NetBSD: syscall.c,v 1.7 2009/10/21 13:56:36 wiz Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: syscall.c,v 1.6 2009/04/13 23:20:27 lukem Exp $"); +__RCSID("$NetBSD: syscall.c,v 1.7 2009/10/21 13:56:36 wiz Exp $"); /* System call stats */ @@ -201,9 +201,8 @@ etime = cur.cp_etime; /* < 5 ticks - ignore this trash */ if ((etime * hertz) < 1.0) { - if (failcnt++ > MAXFAIL) + if (failcnt++ <= MAXFAIL) return; - failcnt = 0; clear(); mvprintw(2, 10, "The alternate system clock has died!"); mvprintw(3, 10, "Reverting to ``pigs'' display."); Index: src/usr.bin/systat/vmstat.c diff -u src/usr.bin/systat/vmstat.c:1.73 src/usr.bin/systat/vmstat.c:1.74 --- src/usr.bin/systat/vmstat.c:1.73 Mon Apr 13 23:20:27 2009 +++ src/usr.bin/systat/vmstat.c Wed Oct 21 13:56:36 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.73 2009/04/13 23:20:27 lukem Exp $ */ +/* $NetBSD: vmstat.c,v 1.74 2009/10/21 13:56:36 wiz Exp $ */ /*- * Copyright (c) 1983, 1989, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -__RCSID("$NetBSD: vmstat.c,v 1.73 2009/04/13 23:20:27 lukem Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.74 2009/10/21 13:56:36 wiz Exp $"); #endif /* not lint */ /* @@ -498,7 +498,7 @@ etime = cur.cp_etime; /* < 5 ticks - ignore this trash */ if ((etime * hertz) < 1.0) { - if (failcnt++ > MAXFAIL) + if (failcnt++ <= MAXFAIL) return; clear(); mvprintw(2, 10, "The alternate system clock has died!");
CVS commit: src/usr.bin/systat
Module Name:src Committed By: apb Date: Tue Jul 14 21:08:31 UTC 2009 Modified Files: src/usr.bin/systat: main.c Log Message: Don't assume that two identical-looking string literals will have the same address and will therefore be comparable with the == operator. Instead, use a const variable. Inspired by PR 41255 from Kurt Lidl. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.bin/systat/main.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.bin/systat/main.c diff -u src/usr.bin/systat/main.c:1.43 src/usr.bin/systat/main.c:1.44 --- src/usr.bin/systat/main.c:1.43 Mon Jul 21 14:19:26 2008 +++ src/usr.bin/systat/main.c Tue Jul 14 21:08:31 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.43 2008/07/21 14:19:26 lukem Exp $ */ +/* $NetBSD: main.c,v 1.44 2009/07/14 21:08:31 apb Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.43 2008/07/21 14:19:26 lukem Exp $"); +__RCSID("$NetBSD: main.c,v 1.44 2009/07/14 21:08:31 apb Exp $"); #endif /* not lint */ #include @@ -103,7 +103,9 @@ { int ch; char errbuf[_POSIX2_LINE_MAX]; + const char *all; + all = "all"; egid = getegid(); (void)setegid(getgid()); @@ -153,7 +155,7 @@ break; } - if(strstr("all",argv[0]) == "all"){ + if (strstr(all, argv[0]) == all) { allcounter=0; allflag=1; }
CVS commit: src/usr.bin/systat
Module Name:src Committed By: lukem Date: Mon Apr 13 23:20:27 UTC 2009 Modified Files: src/usr.bin/systat: disks.c fetch.c globalcmds.c iostat.c mbufs.c ps.c syscall.c vmstat.c Log Message: Fix -Wsign-compare issues To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/systat/disks.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/systat/fetch.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/systat/globalcmds.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/systat/iostat.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/systat/mbufs.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/systat/ps.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/systat/syscall.c cvs rdiff -u -r1.72 -r1.73 src/usr.bin/systat/vmstat.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.bin/systat/disks.c diff -u src/usr.bin/systat/disks.c:1.16 src/usr.bin/systat/disks.c:1.17 --- src/usr.bin/systat/disks.c:1.16 Fri Apr 14 13:14:06 2006 +++ src/usr.bin/systat/disks.c Mon Apr 13 23:20:27 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.16 2006/04/14 13:14:06 blymn Exp $ */ +/* $NetBSD: disks.c,v 1.17 2009/04/13 23:20:27 lukem Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: disks.c,v 1.16 2006/04/14 13:14:06 blymn Exp $"); +__RCSID("$NetBSD: disks.c,v 1.17 2009/04/13 23:20:27 lukem Exp $"); #endif /* not lint */ #include @@ -65,7 +65,7 @@ void disks_drives(char *args) { - int i; + size_t i; if (args) { for (i = 0; i < ndrive; i++) @@ -83,7 +83,7 @@ drvselect(char *args, int truefalse, int selections[]) { char *cp; - int i; + size_t i; cp = strchr(args, '\n'); if (cp) Index: src/usr.bin/systat/fetch.c diff -u src/usr.bin/systat/fetch.c:1.12 src/usr.bin/systat/fetch.c:1.13 --- src/usr.bin/systat/fetch.c:1.12 Sun Dec 7 07:27:09 2003 +++ src/usr.bin/systat/fetch.c Mon Apr 13 23:20:27 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: fetch.c,v 1.12 2003/12/07 07:27:09 christos Exp $ */ +/* $NetBSD: fetch.c,v 1.13 2009/04/13 23:20:27 lukem Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)fetch.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: fetch.c,v 1.12 2003/12/07 07:27:09 christos Exp $"); +__RCSID("$NetBSD: fetch.c,v 1.13 2009/04/13 23:20:27 lukem Exp $"); #endif /* not lint */ #include @@ -50,7 +50,7 @@ ssize_t kvm_ckread(const void *a, void *b, size_t l, const char *name) { - if (kvm_read(kd, (u_long)a, b, l) != l) { + if ((size_t)kvm_read(kd, (u_long)a, b, l) != l) { if (verbose) error("error reading kmem for %s at %p (%s)\n", name, a, strerror(errno)); Index: src/usr.bin/systat/globalcmds.c diff -u src/usr.bin/systat/globalcmds.c:1.13 src/usr.bin/systat/globalcmds.c:1.14 --- src/usr.bin/systat/globalcmds.c:1.13 Sun Feb 5 08:51:03 2006 +++ src/usr.bin/systat/globalcmds.c Mon Apr 13 23:20:27 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: globalcmds.c,v 1.13 2006/02/05 08:51:03 dsl Exp $ */ +/* $NetBSD: globalcmds.c,v 1.14 2009/04/13 23:20:27 lukem Exp $ */ /*- * Copyright (c) 1999 @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: globalcmds.c,v 1.13 2006/02/05 08:51:03 dsl Exp $"); +__RCSID("$NetBSD: globalcmds.c,v 1.14 2009/04/13 23:20:27 lukem Exp $"); #endif /* not lint */ #include @@ -104,7 +104,7 @@ } if (col == 0 && args) { standout(); - if (strlen(args) < COLS - 25) + if ((int)strlen(args) < COLS - 25) printw("help: no matches for `%s.*'", args); else printw("help: no matches"); Index: src/usr.bin/systat/iostat.c diff -u src/usr.bin/systat/iostat.c:1.36 src/usr.bin/systat/iostat.c:1.37 --- src/usr.bin/systat/iostat.c:1.36 Fri Apr 14 13:14:06 2006 +++ src/usr.bin/systat/iostat.c Mon Apr 13 23:20:27 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: iostat.c,v 1.36 2006/04/14 13:14:06 blymn Exp $ */ +/* $NetBSD: iostat.c,v 1.37 2009/04/13 23:20:27 lukem Exp $ */ /* * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: iostat.c,v 1.36 2006/04/14 13:14:06 blymn Exp $"); +__RCSID("$NetBSD: iostat.c,v 1.37 2009/04/13 23:20:27 lukem Exp $"); #endif /* not lint */ #include @@ -125,7 +125,8 @@ static int numlabels(int row) { - int i, col, regions, ndrives; + int col, regions; + size_t i, ndrives; #define COLWIDTH (9 + secs * 5 + 1 + read_write * 9 + 1) #define DRIVESPERLINE ((getmaxx(wnd) + 1) / COLWIDTH) @@ -174,7 +175,7 @@ static int barlabels(int row) { - int i; + size_t i; mvwaddstr(wnd, row++, INSET, "/0 /10 /20 /30 /40 /50 /60 /70 /80 /90 /100"); @@ -201,7 +202,8 @@ void showiostat(void) { - int i, row, col; + int row, col; + size_t i; if (ndrive == 0) return; @@ -298,7 +300,7 @@ static void stat1(int row, int o) { - int i; + size_t i; double total_time; total_t