Home | History | Annotate | only in /src/usr.bin/systat
History log of /src/usr.bin/systat
RevisionDateAuthorComments
 1.45 03-Jun-2023  lukem bsd.own.mk: rename GCC_NO_* to CC_WNO_*

Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.44 11-Dec-2020  simonb Add ${LIBUTIL} to DPADD.
 1.43 13-Oct-2019  mrg introduce some common variables for use in GCC warning disables:

GCC_NO_FORMAT_TRUNCATION -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints. many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
 1.42 29-Sep-2019  mrg convert HAVE_GCC == 7 to HAVE_GCC >= 7.
 1.41 04-Feb-2019  mrg - use -Wno-error=format-truncation
 1.40 23-Dec-2016  mrg branches: 1.40.14;
for 64 bit mips platforms where we built userland largely as n32 by
default, build a handful of tools as n64 so they work properly.

unfortunately, they're also static as dynamic n64 has a problem.

of these tools pstat is probably the lowest hanging fruit to convert
to sysctl. systat would be close were it not for the netstat screen,
which includes netstat itself.

the rest are difficult to perhaps foolish.


the upside is that netstat, pmap and fstat all work properly now.
 1.39 02-Aug-2016  scole PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.38 23-Jan-2016  christos branches: 1.38.2;
Define _KERNTYPES for things that need it.
 1.37 06-Jan-2012  drochner kill ipsec support which hasn't been working for a long time
(neither for KAME nor for FAST_IPSEC)
 1.36 06-Feb-2010  he branches: 1.36.6;
When using -lcurses, you also need -lterminfo.
This fixes the build for sun2, and also builds with LDSTATIC=-static,
since archive libraries don't record inter-library dependencies.
 1.35 14-Apr-2009  lukem Enable WARNS=4 by default for usr.bin, except for:
awk bdes checknr compile_et error gss hxtool kgetcred kinit
klist ldd less lex locale login m4 man menuc mk_cmds
mklocale msgc openssl rpcgen rpcinfo sdiff spell ssh
string2key telnet tn3270 verify_krb5_conf xlint
 1.34 28-May-2007  tls branches: 1.34.20;
Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry. RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros. Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default. Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
 1.33 18-Feb-2007  dsl Include code to display per system call counts and times.
 1.32 14-Apr-2006  blymn Update to use new kernel io statistics.
 1.31 07-Aug-2005  blymn Add tape statistics.
 1.30 26-Feb-2005  dsl WARNS=3
 1.29 16-Feb-2005  hubertf Add "df" display to give information about filesystems, available diskspace
and used disk capacity, similar to df(1):

Filesystem Avail Capacity
/0% /10% /20% /30% /40% /50% /60% /70% /80% /90% /100%
/ 359M |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/tmp 180M |
/home 146G |XXXXXXXXXXXXXXXX
 1.28 10-Jan-2005  lukem Only compile in IPv6 support if ${USE_INET6} != "no"

MKINET6 is for providing IPv6 infrastructure.
USE_INET6 is for compiling IPv6 support into the programs (needs MKINET6).
 1.27 18-Sep-2002  lukem makefile delint. use NETBSDSRCDIR as appropriate
 1.26 08-Aug-2002  abs introduce puthumanint() which calls humanize_number(), and use to
display disk transfer values (Suggested by Simon Burge). Also clip
%busy to 100 and display as an int which has the useful side effect
of stopping it overflowing into the next column (100.0).
 1.25 01-Aug-2002  christos scan utmpx/utmp.
 1.24 28-Mar-2002  jmc branches: 1.24.2;
Remove check for sparc64 which adds -msoft-quad-float as that is now the
default for the compiler on sparc64.
 1.23 04-Feb-2001  mrg use -msoft-quad-float on the sparc64.
 1.22 08-Jan-2000  itojun - implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.21 05-Jan-2000  itojun support IPv6. commands under "netstat" are IPv6 ready.
IPv6 is supported by filters (":ignore ssh") as well.
TODO: do something about line truncation?
TODO: inet6.icmp6? ":help" will not fit into single line...
 1.20 16-Dec-1999  jwise Rototill global command matching -- switch from ad-hoc tomfoolery to a
table lookup. This will make prefix matching and so on easier.

Expect a similar change for mode-specific commands before too long.

While there, rename some structures with misleading names.

Watch this space for more changes soon.
 1.19 15-Nov-1999  simonb - Add `bufcache' display which shows buffer cache usage per filesystem,
ala the monitor(1) command for Ultrix.
- Allow `h' or `?' to show the command list (same as `:help').
- Sort commands in cmdtab.c and systat.1
 1.18 12-Sep-1999  chs branches: 1.18.4;
the PMAP_NEW option is gone as the new interface is no longer optional.
 1.17 30-May-1999  ad Add 4 new modes: ip, icmp, tcp, tcpsyn. XXX still some work to be done
on aesthetics and update modes.
 1.16 29-Apr-1999  lukem also install as `sysstat'.
rationale: `nfsstat' is not `nfstat', and
other systems have a `sysstat' but not a `systat'.
 1.15 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.14 21-Feb-1999  jwise Add a new `ps' view to systat, which shows process information. This
view is identical to the output of `ps aux' except that a.) the RSS and VSZ
fields are one character wider and b.) it shows a zero value for the RSS
and %MEM columns of processes which report a negative RSS.
 1.13 18-Feb-1998  jtc Simply include -lcurses instead of -lcurses -ltermcap
 1.12 18-Feb-1998  perry add -DPMAP_NEW if PMAP_NEW is on in mk.conf
 1.11 09-Feb-1998  mrg add -DUVM to CPPFLAGS if defined(UVM)
 1.10 24-Oct-1997  lukem use CPPFLAGS instead of CFLAGS
 1.9 19-Oct-1997  lukem branches: 1.9.2;
fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.8 21-Jul-1997  mrg WARNS?=1
 1.7 08-May-1997  gwr Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.
 1.6 06-May-1997  gwr Use .PATH.c: ...
 1.5 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.4 22-Dec-1995  jonathan Update Makefiles for usr.bin/systat and usr.sbin/iostat to be
consistent with usr.bin/vmstat/Makefile wrt CLFAGS and -I, since
all three compile vmstat/names.c. (Now compiles on a pmax.)
 1.3 22-Mar-1995  mycroft Alphabetize.
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.9.2.1 08-Nov-1997  lukem sync with trunk (approved by thorpej)
 1.18.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.24.2.2 12-Nov-2002  skrll Catch up to -current.
 1.24.2.1 28-Mar-2002  skrll file Makefile was added on branch nathanw_sa on 2002-11-12 16:54:58 +0000
 1.34.20.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.36.6.1 17-Apr-2012  yamt sync with head
 1.38.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.38.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.40.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.40.14.1 10-Jun-2019  christos Sync with HEAD
 1.30 02-Mar-2020  mrg increase slot slop space from 100 to 1000 before giving up.

from Paul Ripke on current-users. thanks!
 1.29 26-Dec-2018  sevan Extend "systat vm" output to provide better insight about buffercache and
document it.

From Greg A. Woods in PR bin/36542
 1.28 09-Jun-2017  chs branches: 1.28.4; 1.28.6;
rearrange sys/mount.h so that all of the kernel-only parts are together
and not exposed to userland, except do expose struct mount if __EXPOSE_MOUNT
is defined. define __EXPOSE_MOUNT in the kmem grovellers that want
the definition. needed for ZFS.
 1.27 24-Oct-2016  christos sysctlbyname is convenient, but ain't cheap. Cache it.
 1.26 18-Oct-2013  christos branches: 1.26.8;
fix unused variable warnings
 1.25 23-Nov-2012  christos bufmem is unsigned.
 1.24 23-Nov-2012  pgoyette Fix format string to resolve build break
 1.23 23-Nov-2012  christos use more sysctl
 1.22 28-Apr-2008  martin branches: 1.22.4; 1.22.26;
Remove clause 3 and 4 from TNF licenses
 1.21 24-Jan-2008  ad branches: 1.21.4;
specfs changes for PR kern/37717 (raidclose() is no longer called on
shutdown). There are still problems with device access and a PR will be
filed.

- Kill checkalias(). Allow multiple vnodes to reference a single device.

- Don't play dangerous tricks with block vnodes to ensure that only one
vnode can describe a block device. Instead, prohibit concurrent opens of
block devices. As a bonus remove the unreliable code that prevents
multiple file system mounts on the same device. It's no longer needed.

- Track opens by vnode and by device. Issue cdev_close() when the last open
goes away, instead of abusing vnode::v_usecount to tell if the device is
open.
 1.20 22-Oct-2006  christos branches: 1.20.8;
use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.19 26-Feb-2005  dsl WARNS=3
 1.18 23-Nov-2004  simonb Show more information about page types in use, and free pages.
 1.17 11-May-2004  martin "bufmem" is unsigned long inside the kernel, so don't try to grovel it out
of kmem as a unsigned int.
Also avoid overrunning VCACHE_SIZE, thus scribling over unrelated memory.
Fixes PR port-sparc64/25537.
 1.16 19-Feb-2004  atatat branches: 1.16.2;
Add PTRTOUINT64() and UINT64TOPTR() macros to sys/sysctl.h for use by
kern.proc, kern.proc2, kern.lwp, and kern.buf.

Define more MIB for kern.buf so that specific buffers can be selected
(only all/all is supported right now), and use a 32/64 bit agnostic
structure for communcating buffer information to userland.

Convert systat to the new kern.buf method.

Clean up the vm.buf* handling a little. There's no actual need to
record the dynamically assigned OIDs, since sysctl_data can tell us
what we're looking at.

Oh, and fix a typo in a comment.
 1.15 30-Dec-2003  pk Adapt to kernel buffer cache memort allocation changes.

Since the buffer headers do no longer exist as an array in the kernel anymore,
use the new CTL_KERN.KERN_BUF mib to fetch them from kernel space.

Also look at a vnode's specinfo field to properly associate an opened
block device special file with a mounted filesystem.
 1.14 07-Dec-2003  christos - avoid coredump by returning NULL when read fails and don't keep following
the list.
- avoid zerodivide.
XXX: still does not work, but at least it does not core-dump.
 1.13 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.12 09-Dec-2001  chs branches: 1.12.2;
replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names.
 1.11 09-Mar-2001  simonb Show pages used by executables.
Align the numbers in the summary lines.
 1.10 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.9 30-Nov-2000  simonb Show the vnode page cache memory usage on the "bufcache" display.
 1.8 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.7 27-Apr-2000  jdc branches: 1.7.4;
Fix arguments to *printw().
 1.6 14-Feb-2000  soren Prevent percentage overflows by keeping score in kilobytes.
 1.5 20-Dec-1999  jwise branches: 1.5.2;
Fix error handling throughout. First off, it is not true as claimed in swap.c
that `systat doesn't handle errors'. Second off, errx should not be used directly, since
the terminal should be cleaned up before bailing. Third off, whatever we do we need
to be consistent.

There, I feel better now.
 1.4 27-Nov-1999  mrg add some percentages in here.
 1.3 15-Nov-1999  simonb Don't free "buf" in closebufcache() - initbufcache() only gets called
once per systat invocation, not each time we switch to the bufcache
display.

Fixes core dump noted by Andy Doran when switching back and forth to
bufcache display.
 1.2 15-Nov-1999  mrg avoid using CLBYTES (which is based on NBPG).
 1.1 15-Nov-1999  simonb - Add `bufcache' display which shows buffer cache usage per filesystem,
ala the monitor(1) command for Ultrix.
- Allow `h' or `?' to show the command list (same as `:help').
- Sort commands in cmdtab.c and systat.1
 1.5.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.4.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

bufcache.c 1.8
cmds.c 1.22
cmdtab.c 1.16
disks.c 1.11
extern.h 1.23
fetch.c 1.7
globalcmds.c 1.8
 1.12.2.2 09-Dec-2001  chs replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names.
 1.12.2.1 09-Dec-2001  chs file bufcache.c was added on branch nathanw_sa on 2001-12-09 03:07:59 +0000
 1.16.2.1 12-May-2004  jmc Pullup rev 1.17 (requested by martin in ticket #313)

"bufmem" is unsigned long inside the kernel, so dont try to grovel it out
of kmem as a unsigned int.
Also avoid overrunning VCACHE_SIZE, thus scribling over unrelated memory.
PR#/25537
 1.20.8.1 23-Mar-2008  matt sync with HEAD
 1.21.4.1 18-May-2008  yamt sync with head.
 1.22.26.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.26.1 25-Feb-2013  tls resync with head
 1.22.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.22.4.1 16-Jan-2013  yamt sync with (a bit old) head
 1.26.8.1 04-Nov-2016  pgoyette Sync with HEAD
 1.28.6.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.28.6.1 10-Jun-2019  christos Sync with HEAD
 1.28.4.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.30 22-Oct-2016  christos allow fractional intervals
 1.29 02-Aug-2016  scole PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.28 04-Nov-2004  dsl branches: 1.28.74;
Add (unsigned char) cast to ctype functions
Although, IIRC, there is another PR on all commands being converted to
lower case.
 1.27 03-Jul-2004  mycroft Using timeout() to control refresh gets rid of a whole pile of signal-related
lossage.
Making ungetch() signal-safe, as ncurses seems to, would be better, though.
 1.26 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.25 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.24 04-Sep-2000  ad - Ignore null commands, instead of inventing a bogus match. See PR 10596.
- In switch_mode(), display status line even if switching to the same mode.
 1.23 25-Aug-2000  hubertf Add "all" mode to systat to cycle between all modes,
sort of like VMS' "MONITOR ALL"-command.

Code was submitted by Jarkko Teppo <jate@uwasa.fi> in PR 10851,
cleaned up and added 'turns' handling by me.
 1.22 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.21 05-Jun-2000  mycroft branches: 1.21.2;
Fix bogons in command parsing for >1 arg.
 1.20 11-Apr-2000  jwise branches: 1.20.2;
Two UI changes:

a.) restore the capability to enter a substring of a mode or command
name. Pointed out by Soren Jorvang.

b.) (capital) Q now exits systat immediately
 1.19 10-Jan-2000  itojun don't choke on non-INET6 kernel, or non-IPSEC kernel.
cleanup error handling on mode change failure.

TODO: non-IPv4 kernel support should be improved. "netstat" should be okay,
"inet.ip" and "inet.icmp" needs more trick.

NetBSD PR: 9157
 1.18 20-Dec-1999  jwise Fix error handling throughout. First off, it is not true as claimed in swap.c
that `systat doesn't handle errors'. Second off, errx should not be used directly, since
the terminal should be cleaned up before bailing. Third off, whatever we do we need
to be consistent.

There, I feel better now.
 1.17 20-Dec-1999  jwise Nuke assignment unneeded after last commit
 1.16 20-Dec-1999  jwise More cleanup -- use strtok() rather than rolling our own not-quite-correct version.
 1.15 20-Dec-1999  jwise G/C function used in old command parsing
 1.14 20-Dec-1999  jwise Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.13 16-Dec-1999  jwise End special-casing of `start' and `interval' global commands.
Vastly simplify handling of mode switches, and short-syntax interval
changes. Substring matching of mode names and commands will come
shortly, however the previous method of substring matching modes (it was
not available for commands) is currently not working.

TODO: implement table lookups for mode-specific commands.
 1.12 16-Dec-1999  jwise Handle arguments to global commands. Note that the `interval' and
`start' global commands are still special cased, which will change
 1.11 16-Dec-1999  jwise Rototill global command matching -- switch from ad-hoc tomfoolery to a
table lookup. This will make prefix matching and so on easier.

Expect a similar change for mode-specific commands before too long.

While there, rename some structures with misleading names.

Watch this space for more changes soon.
 1.10 02-Aug-1999  sommerfeld branches: 1.10.4;
Fix from PR7655: translation of keyboard command in systat is Wrong.
(breaks netstat's :ignore command for upper-case service names)
 1.9 19-Dec-1998  christos branches: 1.9.2;
char -> unsigned char
 1.8 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.7 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.6 21-Dec-1996  matthias * revert broken handling of subcommands to the (working) 4.4Lite version.
 1.5 13-Dec-1996  scottr Freshen up a bit:

- Replace deprecated sigblock() with sigprocmask()
- Redraw the current display if SIGWINCH is caught
- Style police
 1.4 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.3 31-Aug-1995  jtc Sync with 4.4lite2
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.2 31-Aug-1995  jtc imported from 44lite2
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.9.2.1 26-Sep-1999  he Pull up revision 1.10 (requested by he):
Do not downcase input, which prevented "ignore X11" in the
"netstat" display from working. Fixes PR#7655.
 1.10.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.20.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.21.2.2 04-Sep-2000  ad Pull up revision 1.24 (approved by releng-1-5):
- Ignore null commands, instead of inventing a bogus match. See PR 10596.
- In switch_mode(), display status line even if switching to the same mode.
 1.21.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

bufcache.c 1.8
cmds.c 1.22
cmdtab.c 1.16
disks.c 1.11
extern.h 1.23
fetch.c 1.7
globalcmds.c 1.8
 1.28.74.2 04-Nov-2016  pgoyette Sync with HEAD
 1.28.74.1 06-Aug-2016  pgoyette Sync with HEAD
 1.26 26-Dec-2018  sevan Extend "systat vm" output to provide better insight about buffercache and
document it.

From Greg A. Woods in PR bin/36542
 1.25 02-Aug-2016  scole branches: 1.25.12; 1.25.14;
PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.24 06-Jan-2012  drochner branches: 1.24.22;
kill ipsec support which hasn't been working for a long time
(neither for KAME nor for FAST_IPSEC)
 1.23 18-Feb-2007  dsl branches: 1.23.34;
Include code to display per system call counts and times.
 1.22 22-Oct-2006  christos use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.21 26-Feb-2005  dsl Always treat ^h and ^? as erase chars (as well as stty erase).
Make the ':' erasable.
Fix typo in unviewable help message.
No point in having 'else' after 'return'...
 1.20 16-Feb-2005  hubertf Add "df" display to give information about filesystems, available diskspace
and used disk capacity, similar to df(1):

Filesystem Avail Capacity
/0% /10% /20% /30% /40% /50% /60% /70% /80% /90% /100%
/ 359M |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/tmp 180M |
/home 146G |XXXXXXXXXXXXXXXX
 1.19 12-Sep-2003  mycroft WRT disk commands, make the man page consistent with the program, and add the
feature I expected.
 1.18 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.17 01-Nov-2002  mrg iostat(8) and systat(8) support for separate read/write disk statistics.
"iostat -x" now shows these (ala linux/solaris), but this is only splitting
the read/write bytes/transactions, not adding any new metrics. "systat
iostat" now has two new commands to switch between combined/separate mode
for both it's numbers & bar modes.
 1.16 05-Jul-2000  ad branches: 1.16.2;
- Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.15 11-Apr-2000  jwise branches: 1.15.4;
Reorder two commands so that substring matching doesn't make one shadow
the other.
 1.14 11-Apr-2000  jwise Two UI changes:

a.) restore the capability to enter a substring of a mode or command
name. Pointed out by Soren Jorvang.

b.) (capital) Q now exits systat immediately
 1.13 08-Jan-2000  itojun - implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.12 22-Dec-1999  kleink * Fix a display buglet: if the process list is exhausted before the window's
bottom is reached, clear the remaining lines, lest there be stale process
entries if the process list shrinks.
* Implement a top(1)-like `user' command in the ps display.
 1.11 20-Dec-1999  jwise Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.10 16-Dec-1999  jwise End special-casing of `start' and `interval' global commands.
Vastly simplify handling of mode switches, and short-syntax interval
changes. Substring matching of mode names and commands will come
shortly, however the previous method of substring matching modes (it was
not available for commands) is currently not working.

TODO: implement table lookups for mode-specific commands.
 1.9 16-Dec-1999  jwise Rototill global command matching -- switch from ad-hoc tomfoolery to a
table lookup. This will make prefix matching and so on easier.

Expect a similar change for mode-specific commands before too long.

While there, rename some structures with misleading names.

Watch this space for more changes soon.
 1.8 15-Nov-1999  simonb - Add `bufcache' display which shows buffer cache usage per filesystem,
ala the monitor(1) command for Ultrix.
- Allow `h' or `?' to show the command list (same as `:help').
- Sort commands in cmdtab.c and systat.1
 1.7 02-Aug-1999  ad branches: 1.7.4;
Add 'inet.' prefix to 'tcp', 'ip', 'tcpsyn' and 'icmp' displays.
Fixes PR: bin/8130 (Geoff C. Wing)
 1.6 30-May-1999  ad Add 4 new modes: ip, icmp, tcp, tcpsyn. XXX still some work to be done
on aesthetics and update modes.
 1.5 21-Feb-1999  jwise Add a new `ps' view to systat, which shows process information. This
view is identical to the output of `ps aux' except that a.) the RSS and VSZ
fields are one character wider and b.) it shows a zero value for the RSS
and %MEM columns of processes which report a negative RSS.
 1.4 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.3 13-Dec-1996  scottr Freshen up a bit:

- Replace deprecated sigblock() with sigprocmask()
- Redraw the current display if SIGWINCH is caught
- Style police
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.7.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.4.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

bufcache.c 1.8
cmds.c 1.22
cmdtab.c 1.16
disks.c 1.11
extern.h 1.23
fetch.c 1.7
globalcmds.c 1.8
 1.16.2.1 12-Nov-2002  skrll Catch up to -current.
 1.23.34.1 17-Apr-2012  yamt sync with head
 1.24.22.1 06-Aug-2016  pgoyette Sync with HEAD
 1.25.14.1 10-Jun-2019  christos Sync with HEAD
 1.25.12.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.2 02-Aug-2016  scole branches: 1.2.2;
Add $NetBSD$ tag for new files
 1.1 02-Aug-2016  scole PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.2.2.2 06-Aug-2016  pgoyette Sync with HEAD
 1.2.2.1 02-Aug-2016  pgoyette file convtbl.c was added on branch pgoyette-localcount on 2016-08-06 00:19:12 +0000
 1.2 02-Aug-2016  scole branches: 1.2.2;
Add $NetBSD$ tag for new files
 1.1 02-Aug-2016  scole PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.2.2.2 06-Aug-2016  pgoyette Sync with HEAD
 1.2.2.1 02-Aug-2016  pgoyette file convtbl.h was added on branch pgoyette-localcount on 2016-08-06 00:19:12 +0000
 1.4 24-Dec-2005  matt Appease gcc 4.x
 1.3 01-Aug-2005  xtraeme Don't show ptyfs in the display, it's useless.
 1.2 26-Feb-2005  dsl WARNS=3
 1.1 16-Feb-2005  hubertf Add "df" display to give information about filesystems, available diskspace
and used disk capacity, similar to df(1):

Filesystem Avail Capacity
/0% /10% /20% /30% /40% /50% /60% /70% /80% /90% /100%
/ 359M |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/tmp 180M |
/home 146G |XXXXXXXXXXXXXXXX
 1.20 27-Mar-2023  kre Undo previous "restore lost break" and fix the issue that seems to
have been intending to correct properly (or at least, more rationally).

This makes adding/deleting drives for "vmstat" (and "iostat", though
the man page doesn't say that it also works there) using the :display
:ignore and :drive sub-commands work sensibly using fnmatch()
rather than what was there most of the time since it was added.

Previously ":ignore dk*" would ignore the first dk (wedge) found in
the system (whether or not it was ignored already) and that was it.
[":ignore dk* dk*" would just do that twice.]

Now the same command will ignore all dk* drives (all wedges), which
is what I would anticipate almost anyone would expect it to do.

Similarly for ":display" (to add drives) and ":drives" to explictly
list particular ones.

When the fnmatch() code was added, almost 9 and a half years ago now,
it was almost correct - except always resulted in an error occurring
(though that was little more than a minor inconvenience).

That was "fixed" 5 months later (9 years and almost a month ago now)
with the cvs log message "restore lost break" - which was absolutely
the wrong thing to do (the break was fine when no patterns were used,
and so a name could only ever match one drive - but wrong when the
whole point is to match many).

Somehow in the past 9+ years, no-one noticed that this functionality
had been rendered almost useless.

While here, fix a related problem ... just above I referred to the
error that occurred as a "minor inconvenience" - that's because while
an error would be shown on the screen, it would then immediately be
removed again, an observant user might notice the quick flash, but
that would be it.

Handle that by detecting whether any changes are actually made, and
don't go completely redrawing the screen (removing the error message
that was just placed there) if there is no point. This doesn't
entirely fix this problem, as if we do

:drives foo wd*

and there is no "foo" drive in the system, we'd get an error message
from that, but adding the wd* drives (assuming there are some, of course)
counts as a change, so that error message will still not last very long.
The order of that command line makes no difference, it isn't that wd drives
were found after foo wasn't, but that the whole line matched (at least one)
drive (and changed its state - for the "drives" command, that is equivalent
to matched) - but also contained an entry which did not match at all.
That's a harder problem to fix.

No pullups planned, as no-one seems to mind how it has been all this time.
 1.19 08-Mar-2014  jdc Restore lost break.
 1.18 18-Oct-2013  bad Make :drives, :display, :ignore accept fnmatch(3) patterns to specify drives.
Bump man page date.
 1.17 13-Apr-2009  lukem branches: 1.17.6; 1.17.12;
Fix -Wsign-compare issues
 1.16 14-Apr-2006  blymn branches: 1.16.30;
Update to use new kernel io statistics.
 1.15 26-Feb-2005  dsl Refresh labels and display after changing displayed disks
 1.14 12-Sep-2003  mycroft WRT disk commands, make the man page consistent with the program, and add the
feature I expected.
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.12 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.11 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.10 05-Jun-2000  mycroft branches: 1.10.2;
Fix bogons in command parsing for >1 arg.
 1.9 20-Dec-1999  jwise branches: 1.9.2;
Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.8 19-Dec-1998  christos branches: 1.8.6;
char -> unsigned char
 1.7 12-Jul-1998  mrg - KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.6 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.5 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.4 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.3 15-Mar-1996  ragge Removed a couple of #ifdef vax causing systat to malfunction.
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.8.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

bufcache.c 1.8
cmds.c 1.22
cmdtab.c 1.16
disks.c 1.11
extern.h 1.23
fetch.c 1.7
globalcmds.c 1.8
 1.16.30.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.17.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.49 28-Oct-2022  ozaki-r Adjust userland commands for struct inpcb integration

Only kvm users are affected.
 1.48 21-Aug-2021  christos PR/56331: Paul Goyette: Add -z option to display 0 instead of ' ' in vmstat.
 1.47 25-Jan-2019  christos PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.46 22-Oct-2016  christos branches: 1.46.6; 1.46.12; 1.46.14;
allow fractional intervals
 1.45 02-Aug-2016  scole PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.44 23-Aug-2015  mrg branches: 1.44.2;
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.
 1.43 03-Jun-2014  joerg Always use_sysctl in preparation of removing all kvm code.
 1.42 06-Jan-2012  drochner branches: 1.42.6; 1.42.16;
kill ipsec support which hasn't been working for a long time
(neither for KAME nor for FAST_IPSEC)
 1.41 06-Sep-2011  joerg branches: 1.41.2;
Consistently use __dead and __printflike.
 1.40 10-Apr-2008  thorpej Use sysctl to fetch network statistics unless a memory file is specified
on the command line.
 1.39 07-Apr-2008  thorpej Update for ICMP and UDP stats changes.
 1.38 31-Dec-2007  christos don't call curses from a signal handler!
 1.37 18-Feb-2007  dsl branches: 1.37.4;
Include code to display per system call counts and times.
 1.36 26-Feb-2005  dsl branches: 1.36.12; 1.36.14;
WARNS=3
 1.35 16-Feb-2005  hubertf Add "df" display to give information about filesystems, available diskspace
and used disk capacity, similar to df(1):

Filesystem Avail Capacity
/0% /10% /20% /30% /40% /50% /60% /70% /80% /90% /100%
/ 359M |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/tmp 180M |
/home 146G |XXXXXXXXXXXXXXXX
 1.34 27-Mar-2004  martin A __attribute__((__noreturn__)) function better be void - gcc correctly
complains at >= -O3 otherwise.
 1.33 07-Dec-2003  christos be more descriptive about what failed by printing the errno and the
variable we were trying to fetch.
 1.32 12-Sep-2003  mycroft WRT disk commands, make the man page consistent with the program, and add the
feature I expected.
 1.31 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.30 03-Aug-2003  jdolecek mark nlisterr() as 'noreturn'
 1.29 20-Jan-2003  dsl Make kernel address arg of kvm_ckread() const void * so caller doesn't
need a cast.
(approved by christos)
 1.28 01-Nov-2002  mrg iostat(8) and systat(8) support for separate read/write disk statistics.
"iostat -x" now shows these (ala linux/solaris), but this is only splitting
the read/write bytes/transactions, not adding any new metrics. "systat
iostat" now has two new commands to switch between combined/separate mode
for both it's numbers & bar modes.
 1.27 14-Jul-2001  matt branches: 1.27.2;
Fetch maxslp from the kernel. Only use USPACE if it's defined.
 1.26 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.25 11-Oct-2000  is More format string cleanup by sommerfeld.
 1.24 25-Aug-2000  hubertf Add "all" mode to systat to cycle between all modes,
sort of like VMS' "MONITOR ALL"-command.

Code was submitted by Jarkko Teppo <jate@uwasa.fi> in PR 10851,
cleaned up and added 'turns' handling by me.
 1.23 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.22 04-Jun-2000  thorpej branches: 1.22.2;
Use kern.cp_time to fetch cp_time[]. Don't support fetching it from
crash dumps yet, as that requires determining which CPU we should fetch
it from, etc.
 1.21 08-Jan-2000  itojun branches: 1.21.2;
- implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.20 07-Jan-2000  itojun add command line -n flag, which is same as "netstat numbers".
without it, we can't disable name resolution before the resolution starts.
 1.19 05-Jan-2000  itojun support IPv6. commands under "netstat" are IPv6 ready.
IPv6 is supported by filters (":ignore ssh") as well.
TODO: do something about line truncation?
TODO: inet6.icmp6? ":help" will not fit into single line...
 1.18 25-Dec-1999  jwise GC now-spurious prototype
 1.17 22-Dec-1999  kleink * Fix a display buglet: if the process list is exhausted before the window's
bottom is reached, clear the remaining lines, lest there be stale process
entries if the process list shrinks.
* Implement a top(1)-like `user' command in the ps display.
 1.16 20-Dec-1999  jwise G/C function used in old command parsing
 1.15 20-Dec-1999  jwise Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.14 16-Dec-1999  jwise End special-casing of `start' and `interval' global commands.
Vastly simplify handling of mode switches, and short-syntax interval
changes. Substring matching of mode names and commands will come
shortly, however the previous method of substring matching modes (it was
not available for commands) is currently not working.

TODO: implement table lookups for mode-specific commands.
 1.13 16-Dec-1999  jwise Handle arguments to global commands. Note that the `interval' and
`start' global commands are still special cased, which will change
 1.12 16-Dec-1999  jwise Rototill global command matching -- switch from ad-hoc tomfoolery to a
table lookup. This will make prefix matching and so on easier.

Expect a similar change for mode-specific commands before too long.

While there, rename some structures with misleading names.

Watch this space for more changes soon.
 1.11 15-Nov-1999  simonb - Add `bufcache' display which shows buffer cache usage per filesystem,
ala the monitor(1) command for Ultrix.
- Allow `h' or `?' to show the command list (same as `:help').
- Sort commands in cmdtab.c and systat.1
 1.10 30-May-1999  ad branches: 1.10.4;
Add 4 new modes: ip, icmp, tcp, tcpsyn. XXX still some work to be done
on aesthetics and update modes.
 1.9 24-Apr-1999  ross Kill incorrect const in previous.
 1.8 24-Apr-1999  ross Functional LP64 and type sanity fixes.
 1.7 21-Feb-1999  jwise branches: 1.7.2;
Add a new `ps' view to systat, which shows process information. This
view is identical to the output of `ps aux' except that a.) the RSS and VSZ
fields are one character wider and b.) it shows a zero value for the RSS
and %MEM columns of processes which report a negative RSS.
 1.6 19-Jul-1998  drochner Fix handling of privileges - the gid was given up before dkinit()
was called.
Pass the gid to use for KVM access explicitely to dkinit(), the caller
decides whether to call setgid(getgid()) or not.
 1.5 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.4 13-Dec-1996  scottr Freshen up a bit:

- Replace deprecated sigblock() with sigprocmask()
- Redraw the current display if SIGWINCH is caught
- Style police
 1.3 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.7.2.2 19-Oct-2000  he Pull up revision 1.25 (via patch, requested by he):
Format string cleanup.
 1.7.2.1 26-Sep-1999  he Pull up revisions 1.8-1.9 (requested by he):
LP64 and type sanity fixes, with visible effects of enabling echo
on commands and correct cursor placement after update.
 1.10.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.21.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.22.2.2 18-Oct-2000  tv Pullup usr.bin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.22.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

bufcache.c 1.8
cmds.c 1.22
cmdtab.c 1.16
disks.c 1.11
extern.h 1.23
fetch.c 1.7
globalcmds.c 1.8
 1.27.2.2 12-Nov-2002  skrll Catch up to -current.
 1.27.2.1 14-Jul-2001  skrll file extern.h was added on branch nathanw_sa on 2002-11-12 16:54:59 +0000
 1.36.14.1 03-Jun-2008  skrll Sync with netbsd-4.
 1.36.12.1 03-Feb-2008  riz Pull up following revision(s) (requested by christos in ticket #1031):
usr.bin/systat/keyboard.c: revision 1.24
usr.bin/systat/main.c: revision 1.41
usr.bin/systat/extern.h: revision 1.38
don't call curses from a signal handler!
 1.37.4.1 09-Jan-2008  matt sync with HEAD
 1.41.2.1 17-Apr-2012  yamt sync with head
 1.42.16.1 10-Aug-2014  tls Rebase.
 1.42.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.44.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.46.14.1 10-Jun-2019  christos Sync with HEAD
 1.46.12.1 26-Jan-2019  pgoyette Sync with HEAD
 1.46.6.1 30-Jan-2019  martin Pull up following revision(s) (requested by christos in ticket #1176):

usr.bin/systat/main.c: revision 1.55
usr.bin/systat/extern.h: revision 1.47
usr.bin/systat/syscall.c: revision 1.10
usr.bin/systat/iostat.c: revision 1.39
usr.bin/systat/vmstat.c: revision 1.85
usr.bin/systat/vmstat.c: revision 1.86

no need for curses.h

-

PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.13 13-Apr-2009  lukem Fix -Wsign-compare issues
 1.12 07-Dec-2003  christos branches: 1.12.42;
be more descriptive about what failed by printing the errno and the
variable we were trying to fetch.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.10 20-Jan-2003  dsl Make kernel address arg of kvm_ckread() const void * so caller doesn't
need a cast.
(approved by christos)
 1.9 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.8 11-Oct-2000  thorpej int vs. pointer format/argument confusion.
 1.7 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.6 04-Jun-2000  thorpej branches: 1.6.2;
Use kern.cp_time to fetch cp_time[]. Don't support fetching it from
crash dumps yet, as that requires determining which CPU we should fetch
it from, etc.
 1.5 24-Apr-1999  ross branches: 1.5.6;
Functional LP64 and type sanity fixes.
 1.4 12-Jul-1998  mrg branches: 1.4.2;
- KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.3 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.4.2.2 19-Oct-2000  he Pull up revision 1.8 (requested by he):
Fix pointer/format problem, cast to u_long, print with %lx.
 1.4.2.1 26-Sep-1999  he Pull up revision 1.5 (requested by he):
LP64 and type sanity fixes, with visible effects of enabling echo
on commands and correct cursor placement after update.
 1.5.6.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.6.2.2 18-Oct-2000  tv Pullup usr.bin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.6.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

bufcache.c 1.8
cmds.c 1.22
cmdtab.c 1.16
disks.c 1.11
extern.h 1.23
fetch.c 1.7
globalcmds.c 1.8
 1.12.42.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.15 01-Nov-2009  dsl 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.
 1.14 13-Apr-2009  lukem Fix -Wsign-compare issues
 1.13 05-Feb-2006  dsl branches: 1.13.30;
Rename 'cur' to 'name' to avoid aliasing a global - this code has some
horrid globals...
 1.12 26-Feb-2005  dsl Always treat ^h and ^? as erase chars (as well as stty erase).
Make the ':' erasable.
Fix typo in unviewable help message.
No point in having 'else' after 'return'...
 1.11 03-Jul-2004  mycroft Using timeout() to control refresh gets rid of a whole pile of signal-related
lossage.
Making ungetch() signal-safe, as ncurses seems to, would be better, though.
 1.10 16-Nov-2002  itojun error handling on strdup failure
 1.9 01-Dec-2000  simonb branches: 1.9.2;
Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.8 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.7 08-Jan-2000  itojun branches: 1.7.4;
oops, avoid duplicate free().
 1.6 08-Jan-2000  itojun - implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.5 20-Dec-1999  lukem branches: 1.5.2;
need <string.h> for strlen()
 1.4 20-Dec-1999  jwise TNF copyright -- I will do the paperwork to give these over asap.
 1.3 16-Dec-1999  jwise End special-casing of `start' and `interval' global commands.
Vastly simplify handling of mode switches, and short-syntax interval
changes. Substring matching of mode names and commands will come
shortly, however the previous method of substring matching modes (it was
not available for commands) is currently not working.

TODO: implement table lookups for mode-specific commands.
 1.2 16-Dec-1999  jwise Handle arguments to global commands. Note that the `interval' and
`start' global commands are still special cased, which will change
 1.1 16-Dec-1999  jwise Add a file missed in last commit
 1.5.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.4.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

bufcache.c 1.8
cmds.c 1.22
cmdtab.c 1.16
disks.c 1.11
extern.h 1.23
fetch.c 1.7
globalcmds.c 1.8
 1.9.2.1 17-Jan-2003  thorpej Sync with HEAD.
 1.13.30.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.13 03-Jun-2014  joerg Always use_sysctl in preparation of removing all kvm code.
 1.12 10-Apr-2008  thorpej branches: 1.12.28; 1.12.40;
Don't even bother initializing the namelist if we're not going to use it.
 1.11 10-Apr-2008  thorpej Use sysctl to fetch network statistics unless a memory file is specified
on the command line.
 1.10 07-Apr-2008  thorpej Update for ICMP and UDP stats changes.
 1.9 22-Oct-2006  christos use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.8 26-Feb-2005  dsl WARNS=3
 1.7 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.6 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.5 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.4 13-Jun-2000  ad branches: 1.4.2;
Use my proper name.
 1.3 13-Jan-2000  ad branches: 1.3.2;
Two tiny formatting nits in each file.
 1.2 08-Jan-2000  itojun - implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.1 30-May-1999  ad Add 4 new modes: ip, icmp, tcp, tcpsyn. XXX still some work to be done
on aesthetics and update modes.
 1.3.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.12.40.1 10-Aug-2014  tls Rebase.
 1.12.28.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 02-Aug-2016  scole branches: 1.2.2;
Add $NetBSD$ tag for new files
 1.1 02-Aug-2016  scole PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.2.2.2 06-Aug-2016  pgoyette Sync with HEAD
 1.2.2.1 02-Aug-2016  pgoyette file ifcmds.c was added on branch pgoyette-localcount on 2016-08-06 00:19:12 +0000
 1.4 05-Aug-2016  christos branches: 1.4.2;
Avoid string gymnastics in an olympic year.
 1.3 04-Aug-2016  jakllsch Make this build with clang:
- Remove unused static const variables
- Adjust impossibleish comparision.
 1.2 02-Aug-2016  scole Add $NetBSD$ tag for new files
 1.1 02-Aug-2016  scole PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.4.2.2 06-Aug-2016  pgoyette Sync with HEAD
 1.4.2.1 05-Aug-2016  pgoyette file ifstat.c was added on branch pgoyette-localcount on 2016-08-06 00:19:12 +0000
 1.39 25-Jan-2019  christos PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.38 15-Jul-2017  mlelstv branches: 1.38.2; 1.38.4; 1.38.6;
Use I/O timestamps to compute disk statistics for better precisison.
 1.37 13-Apr-2009  lukem branches: 1.37.38;
Fix -Wsign-compare issues
 1.36 14-Apr-2006  blymn branches: 1.36.30;
Update to use new kernel io statistics.
 1.35 18-Mar-2006  dsl Count both read bytes and write bytes when we are not showing separate read
and write statistics. Discovered by go.
Since I broke in in rev 1.31, I guess I'll fix it first!
 1.34 05-Feb-2006  dsl Match changes to vmstat.c (splitting of dkreadstats).
Read tape stats if there are no disks found - is this possible?
 1.33 07-Aug-2005  blymn Add tape statistics.
 1.32 26-Feb-2005  dsl branches: 1.32.2;
Add an extra digit to the kBps column - now overflows at 100MB/s
 1.31 26-Feb-2005  dsl Fix field widths for 'numbers' display, and allow it without 'secs'.
 1.30 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.29 12-Aug-2003  dsl Correct boundary conditions for drive table for 'systat io num'.
Correct fix for bin/18823 (which was incomplete and wrong!)
 1.28 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.27 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.26 01-Feb-2003  dsl When disk activity exceeds 100kB/s divide length of bar by 10s and report
factor on RHS screen.
(approved by christos)
 1.25 29-Dec-2002  kristerw Prevent the "kBps" field from overflowing for values > 1M/s.

From Paul Shupak in PR 18822.
 1.24 06-Dec-2002  thorpej Remove extra args from a printf.
 1.23 01-Nov-2002  mrg iostat(8) and systat(8) support for separate read/write disk statistics.
"iostat -x" now shows these (ala linux/solaris), but this is only splitting
the read/write bytes/transactions, not adding any new metrics. "systat
iostat" now has two new commands to switch between combined/separate mode
for both it's numbers & bar modes.
 1.22 25-Sep-2002  christos PR/18408: Chris Demetriou: Kilo is abbreviated using a small k not a CAPITAL K.
 1.21 30-Jun-2002  sommerfeld Since the KERN_CP_TIME sysctl reports total clock ticks across all
cpus and hz is measured in ticks per cpu, divide tick count by ncpu to
determine elapsed time since last sample.

Fixes I/O rate deflation observed on multiprocessors.
 1.20 09-Jun-2002  itojun format fix in number mode. PR 16911
 1.19 28-Jan-2002  augustss branches: 1.19.2; 1.19.4;
Make it compile (more vmstat fallout).
 1.18 16-Jan-2001  cgd comment or delete text after CPP directives.
 1.17 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.16 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.15 04-Jun-2000  mycroft branches: 1.15.2;
Use hline() and variants in a bunch of places.
 1.14 03-Jun-2000  thorpej Need to include <sys/sched.h> to get cp_time-related constants.
 1.13 20-Dec-1999  jwise branches: 1.13.2;
Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.12 29-Jun-1999  mjl branches: 1.12.4;
Enlarge disk names in labels from 3 to 7 to cater for things like raid0.
 1.11 19-Jul-1998  drochner Fix handling of privileges - the gid was given up before dkinit()
was called.
Pass the gid to use for KVM access explicitely to dkinit(), the caller
decides whether to call setgid(getgid()) or not.
 1.10 12-Jul-1998  mrg - KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.9 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.8 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.7 24-May-1997  jtc Use the new getmaxx and getmaxy macros instead of directly accessing
the private fields of WINDOW.
 1.6 25-Oct-1996  scottr Be explicit about iostat transfer rate by displaying `KBps' instead of
`Kps'. As per (and noticed by) J.T.
 1.5 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.4 15-Mar-1996  ragge Removed a couple of #ifdef vax causing systat to malfunction.
 1.3 17-May-1995  mycroft Print out interrupt CPU time.
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.12.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.19.4.2 30-Jun-2002  lukem Pull up revision 1.21 (requested by sommerfeld in ticket #406):
Since the KERN_CP_TIME sysctl reports total clock ticks across all
cpus and hz is measured in ticks per cpu, divide tick count by ncpu to
determine elapsed time since last sample.
Fixes I/O rate deflation observed on multiprocessors.
 1.19.4.1 10-Jun-2002  tv Pull up revision 1.20 (requested by itojun in ticket #221):
format fix in number mode. PR 16911
 1.19.2.3 17-Jan-2003  thorpej Sync with HEAD.
 1.19.2.2 12-Nov-2002  skrll Catch up to -current.
 1.19.2.1 28-Jan-2002  skrll file iostat.c was added on branch nathanw_sa on 2002-11-12 16:54:59 +0000
 1.32.2.1 20-Mar-2006  riz Pull up following revision(s) (requested by dsl in ticket #1208):
usr.bin/systat/iostat.c: revision 1.35
Count both read bytes and write bytes when we are not showing separate read
and write statistics. Discovered by go.
Since I broke in in rev 1.31, I guess I'll fix it first!
 1.36.30.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.37.38.2 30-Jan-2019  martin Pull up following revision(s) (requested by christos in ticket #1176):

usr.bin/systat/main.c: revision 1.55
usr.bin/systat/extern.h: revision 1.47
usr.bin/systat/syscall.c: revision 1.10
usr.bin/systat/iostat.c: revision 1.39
usr.bin/systat/vmstat.c: revision 1.85
usr.bin/systat/vmstat.c: revision 1.86

no need for curses.h

-

PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.37.38.1 25-Jul-2017  snj Pull up following revision(s) (requested by mlelstv in ticket #138):
usr.bin/systat/iostat.c: revision 1.38
usr.bin/systat/vmstat.c: revision 1.82
usr.bin/vmstat/drvstats.c: revision 1.11
usr.bin/vmstat/drvstats.h: revision 1.5
usr.bin/vmstat/vmstat.c: revision 1.217
usr.sbin/iostat/iostat.c: revision 1.65
Use I/O timestamps to compute disk statistics for better precision.
Disk statistics are collected in a fixed size array, that got corrupted
when a disk was detached. Adapt by skipping entries of detached disks
and detect reused disknames at the array end.
--
Use I/O timestamps to compute disk statistics for better precisison.
 1.38.6.1 10-Jun-2019  christos Sync with HEAD
 1.38.4.1 26-Jan-2019  pgoyette Sync with HEAD
 1.38.2.2 15-Jul-2017  mlelstv 3327190
 1.38.2.1 15-Jul-2017  mlelstv file iostat.c was added on branch perseant-stdc-iso10646 on 2017-07-15 08:22:24 +0000
 1.18 03-Jun-2014  joerg Always use_sysctl in preparation of removing all kvm code.
 1.17 10-Apr-2008  thorpej branches: 1.17.28; 1.17.40;
Don't even bother initializing the namelist if we're not going to use it.
 1.16 10-Apr-2008  thorpej Use sysctl to fetch network statistics unless a memory file is specified
on the command line.
 1.15 07-Apr-2008  thorpej Change IP stats from a structure to an array of uint64_t's.

Note: This is ABI-compatible with the old ipstat structure; old netstat
binaries will continue to work properly.
 1.14 07-Apr-2008  thorpej Update for ICMP and UDP stats changes.
 1.13 22-Oct-2006  christos use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.12 26-Feb-2005  dsl WARNS=3
 1.11 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.10 12-Jun-2001  wiz branches: 1.10.2;
receive, not recieve
 1.9 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.8 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.7 13-Jun-2000  ad branches: 1.7.2;
Use my proper name.
 1.6 27-Apr-2000  thorpej branches: 1.6.2;
u_quad_t must be cast to (long long) to be printed with %llu.
 1.5 13-Jan-2000  ad Two tiny formatting nits in each file.
 1.4 08-Jan-2000  itojun - implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.3 04-Jan-2000  msaitoh fix printf format for inet.ip
(because the entries in struct ipstat is u_quad_t)
 1.2 30-Jul-1999  ad Formatting nits.
 1.1 30-May-1999  ad Add 4 new modes: ip, icmp, tcp, tcpsyn. XXX still some work to be done
on aesthetics and update modes.
 1.6.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.10.2.2 12-Jun-2001  wiz receive, not recieve
 1.10.2.1 12-Jun-2001  wiz file ip.c was added on branch nathanw_sa on 2001-06-12 15:17:30 +0000
 1.17.40.1 10-Aug-2014  tls Rebase.
 1.17.28.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16 03-Jun-2014  joerg Always use_sysctl in preparation of removing all kvm code.
 1.15 10-Apr-2008  thorpej branches: 1.15.28; 1.15.40;
Don't even bother initializing the namelist if we're not going to use it.
 1.14 10-Apr-2008  thorpej Use sysctl to fetch network statistics unless a memory file is specified
on the command line.
 1.13 08-Apr-2008  thorpej Change IPv6 stats from a structure to an array of uint64_t's.

Note: This is ABI-compatible with the old ip6stat structure; old netstat
binaries will continue to work properly.
 1.12 22-Oct-2006  christos use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.11 26-Feb-2005  dsl WARNS=3
 1.10 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.9 20-Dec-2000  cgd Don't try to use CPP token pasting to somehow 'stick' structure member
names on to the -> or . before them. There's no need to, and it's not
actually the right thing!
 1.8 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.7 16-Jul-2000  itojun repair inet6.ip6 stat (broken in 1.4 -> 1.5).
 1.6 13-Jul-2000  itojun remove pulldown statistics
 1.5 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.4 13-Jun-2000  ad branches: 1.4.2;
Use my proper name.
 1.3 13-Jan-2000  ad branches: 1.3.2;
Two tiny formatting nits in each file.
 1.2 10-Jan-2000  itojun don't choke on non-INET6 kernel, or non-IPSEC kernel.
cleanup error handling on mode change failure.

TODO: non-IPv4 kernel support should be improved. "netstat" should be okay,
"inet.ip" and "inet.icmp" needs more trick.

NetBSD PR: 9157
 1.1 08-Jan-2000  itojun - implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.3.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.2.2 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.4.2.1 14-Jul-2000  itojun pullup 1.5 -> 1.6 (approved by releng-1-5)
remove pulldown statistics
 1.15.40.1 10-Aug-2014  tls Rebase.
 1.15.28.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11 06-Jan-2012  drochner kill ipsec support which hasn't been working for a long time
(neither for KAME nor for FAST_IPSEC)
 1.10 23-Apr-2008  thorpej branches: 1.10.4;
Make IPSEC and FAST_IPSEC stats per-cpu. Use <net/net_stats.h> and
netstat_sysctl().
 1.9 22-Oct-2006  christos branches: 1.9.16;
use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.8 26-Feb-2005  dsl WARNS=3
 1.7 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.6 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.5 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.4 13-Jun-2000  ad branches: 1.4.2;
Use my proper name.
 1.3 13-Jan-2000  ad branches: 1.3.2;
Two tiny formatting nits in each file.
 1.2 10-Jan-2000  itojun don't choke on non-INET6 kernel, or non-IPSEC kernel.
cleanup error handling on mode change failure.

TODO: non-IPv4 kernel support should be improved. "netstat" should be okay,
"inet.ip" and "inet.icmp" needs more trick.

NetBSD PR: 9157
 1.1 08-Jan-2000  itojun - implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.3.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.9.16.1 18-May-2008  yamt sync with head.
 1.10.4.1 17-Apr-2012  yamt sync with head
 1.26 23-Aug-2015  mrg 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.
 1.25 14-Oct-2013  bad No David, '\?' is not the del character. Broken in rev 1.21.
XXX pullup-5, pullup-6.
 1.24 31-Dec-2007  christos branches: 1.24.10; 1.24.26; 1.24.28; 1.24.32;
don't call curses from a signal handler!
 1.23 10-May-2006  mrg branches: 1.23.6; 1.23.8; 1.23.12;
quell GCC 4.1 uninitialised variable warnings.

XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
 1.22 26-Feb-2005  dsl WARNS=3
 1.21 26-Feb-2005  dsl Always treat ^h and ^? as erase chars (as well as stty erase).
Make the ':' erasable.
Fix typo in unviewable help message.
No point in having 'else' after 'return'...
 1.20 04-Nov-2004  dsl Add (unsigned char) cast to ctype functions
Although, IIRC, there is another PR on all commands being converted to
lower case.
 1.19 03-Jul-2004  mycroft Whoops, make "all" work again.
 1.18 03-Jul-2004  mycroft Using timeout() to control refresh gets rid of a whole pile of signal-related
lossage.
Making ungetch() signal-safe, as ncurses seems to, would be better, though.
 1.17 03-Jul-2004  mycroft Use KEY_RESIZE. Might as well have something in our source tree that does.
 1.16 27-Mar-2004  martin A __attribute__((__noreturn__)) function better be void - gcc correctly
complains at >= -O3 otherwise.
 1.15 12-Sep-2003  mycroft Allow lower case 'q' to quit.
 1.14 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.13 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.12 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.11 11-Apr-2000  jwise branches: 1.11.4;
Two UI changes:

a.) restore the capability to enter a substring of a mode or command
name. Pointed out by Soren Jorvang.

b.) (capital) Q now exits systat immediately
 1.10 20-Dec-1999  jwise Fix error handling throughout. First off, it is not true as claimed in swap.c
that `systat doesn't handle errors'. Second off, errx should not be used directly, since
the terminal should be cleaned up before bailing. Third off, whatever we do we need
to be consistent.

There, I feel better now.
 1.9 20-Dec-1999  jwise Be consistent about whether to block SIGALRM before calling command() -- don't
ever do so, as the first thing command() does is block SIGALRM.
 1.8 20-Dec-1999  jwise 1.) Clean up keystroke processing
2.) Add the all-time most requested feature: hitting space or CR while
not in command mode now causes an instant refresh
 1.7 15-Nov-1999  simonb - Add `bufcache' display which shows buffer cache usage per filesystem,
ala the monitor(1) command for Ultrix.
- Allow `h' or `?' to show the command list (same as `:help').
- Sort commands in cmdtab.c and systat.1
 1.6 02-Aug-1999  sommerfeld branches: 1.6.4;
Fix from PR7655: translation of keyboard command in systat is Wrong.
(breaks netstat's :ignore command for upper-case service names)
 1.5 12-Jul-1998  mrg branches: 1.5.2;
- KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.4 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.3 13-Dec-1996  scottr Freshen up a bit:

- Replace deprecated sigblock() with sigprocmask()
- Redraw the current display if SIGWINCH is caught
- Style police
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.5.2.1 26-Sep-1999  he Pull up revision 1.6 (requested by he):
Do not downcase input, which prevented "ignore X11" in the
"netstat" display from working. Fixes PR#7655.
 1.6.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.4.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.23.12.1 09-Jan-2008  matt sync with HEAD
 1.23.8.1 03-Jun-2008  skrll Sync with netbsd-4.
 1.23.6.1 03-Feb-2008  riz Pull up following revision(s) (requested by christos in ticket #1031):
usr.bin/systat/keyboard.c: revision 1.24
usr.bin/systat/main.c: revision 1.41
usr.bin/systat/extern.h: revision 1.38
don't call curses from a signal handler!
 1.24.32.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.24.28.1 20-Oct-2013  bouyer Pull up following revision(s) (requested by dholland in ticket #968):
usr.bin/systat/keyboard.c: revision 1.25
No David, '\?' is not the del character. Broken in rev 1.21.
XXX pullup-5, pullup-6.
 1.24.26.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.10.1 20-Oct-2013  bouyer Pull up following revision(s) (requested by dholland in ticket #1885):
usr.bin/systat/keyboard.c: revision 1.25
No David, '\?' is not the del character. Broken in rev 1.21.
XXX pullup-5, pullup-6.
 1.58 16-Jun-2024  kre Revert previous, and switch to using real arithmetic.

Ever since this code was first committed to the CSRG SCCS
tree, in Oct 1983, it has contained either
int dellave;
or more recently:
static int dellave;
(that change is irrelevant, as is the move of the declaration
from systat.h into main.c)

And then in main() initialised it as:
dellave = 0.0;

It seems clear to me that the variable really should have been a
double since day one. All its uses were in floating point contexts.

So, undo the change to use int constants, and instead just make
"dellave" (the load average delta) be a double.

This should make the load average bar which appears at the
top of most systat display screens more sensitive to showing
when the load average is increasing or decreasing (showing
it using '>' or '<' instead of '|' which is used when there
is not much change since last time).
 1.57 14-Jun-2024  rillig systat: don't compare integer to floating point constants

No binary change.
 1.56 21-Aug-2021  christos PR/56331: Paul Goyette: Add -z option to display 0 instead of ' ' in vmstat.
 1.55 25-Jan-2019  christos PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.54 26-Dec-2018  sevan Extend "systat vm" output to provide better insight about buffercache and
document it.

From Greg A. Woods in PR bin/36542
 1.53 22-Nov-2017  snj branches: 1.53.2; 1.53.4;
add -b to usage.
 1.52 17-Nov-2017  mrg add missing 'b' to the optstring. alpha-sort the option handling.
 1.51 03-Dec-2016  mrg branches: 1.51.6;
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.
 1.50 22-Oct-2016  christos allow fractional intervals
 1.49 23-Aug-2015  mrg branches: 1.49.2;
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.
 1.48 03-Jun-2014  joerg branches: 1.48.2;
Always use_sysctl in preparation of removing all kvm code.
 1.47 23-Nov-2012  christos branches: 1.47.6;
use more sysctl
 1.46 06-Sep-2011  joerg branches: 1.46.2; 1.46.8;
Consistently use __dead and __printflike.
 1.45 04-Nov-2009  dsl Allow display intervals > 25 seconds.
Fixes PR/36999
I did contemplate chaging curses - but the code is replicated and warped.
 1.44 14-Jul-2009  apb 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.
 1.43 21-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.42 10-Apr-2008  thorpej branches: 1.42.4;
Use sysctl to fetch network statistics unless a memory file is specified
on the command line.
 1.41 31-Dec-2007  christos don't call curses from a signal handler!
 1.40 22-Oct-2006  christos branches: 1.40.2; 1.40.4; 1.40.8;
use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.39 26-Feb-2005  dsl WARNS=3
 1.38 04-Nov-2004  dsl Add (unsigned char) cast to ctype functions
Although, IIRC, there is another PR on all commands being converted to
lower case.
 1.37 03-Jul-2004  mycroft Using timeout() to control refresh gets rid of a whole pile of signal-related
lossage.
Making ungetch() signal-safe, as ncurses seems to, would be better, though.
 1.36 03-Jul-2004  mycroft Use KEY_RESIZE. Might as well have something in our source tree that does.
 1.35 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.34 03-Aug-2003  jdolecek if kvm_nlist() fails, nlisterr() would be called before the screen
curses context would be initialized; just use errx() instead in this case
this fixes coredump for cases like 'systat -N /netbsd.gz', reported by Walt
on port-i386

in nlisterr(), wait a while (5 seconds currently) before exiting, so that
it would be actually possible to actually see the error
 1.33 05-Jul-2003  dsl No need to resizeterm() if size not changed.
On 'fg' just restore old screen contents.
 1.32 28-May-2003  dsl Reinstate our STOP handler before curses installs its one.
Ensures that both handlers are executed on subsequent stops.
 1.31 10-Feb-2003  dsl Resize windows on SIGWINCH and restart from SIGTSTP
(approved by christos)
 1.30 06-Dec-2001  blymn branches: 1.30.2;
Change deprecated curses function to new equivalent.
 1.29 14-Jul-2001  matt Fetch maxslp from the kernel. Only use USPACE if it's defined.
 1.28 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.27 25-Aug-2000  hubertf Add "all" mode to systat to cycle between all modes,
sort of like VMS' "MONITOR ALL"-command.

Code was submitted by Jarkko Teppo <jate@uwasa.fi> in PR 10851,
cleaned up and added 'turns' handling by me.
 1.26 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.25 04-Jun-2000  mycroft branches: 1.25.2;
Use hline() and variants in a bunch of places.
 1.24 11-Apr-2000  jwise branches: 1.24.2;
Two UI changes:

a.) restore the capability to enter a substring of a mode or command
name. Pointed out by Soren Jorvang.

b.) (capital) Q now exits systat immediately
 1.23 07-Jan-2000  itojun add command line -n flag, which is same as "netstat numbers".
without it, we can't disable name resolution before the resolution starts.
 1.22 20-Dec-1999  jwise Block alarm signals while displaying -- there's no reason to allow recursive
display at all.
 1.21 20-Dec-1999  jwise Knee-jerk snprintf()-ism.
 1.20 20-Dec-1999  jwise Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.19 16-Dec-1999  jwise Sigh... this is the missing part of last night's final commit -- perform
the same simplification on mode parsing for the command line as for user
commands.

My apologies to anyone who tried to build systat this morning.
 1.18 16-Dec-1999  jwise Rototill global command matching -- switch from ad-hoc tomfoolery to a
table lookup. This will make prefix matching and so on easier.

Expect a similar change for mode-specific commands before too long.

While there, rename some structures with misleading names.

Watch this space for more changes soon.
 1.17 11-Nov-1999  soren Sync usage() with man page.
 1.16 24-Apr-1999  ross branches: 1.16.4;
Functional LP64 and type sanity fixes.
 1.15 19-Jul-1998  drochner branches: 1.15.2;
Fix handling of privileges - the gid was given up before dkinit()
was called.
Pass the gid to use for KVM access explicitely to dkinit(), the caller
decides whether to call setgid(getgid()) or not.
 1.14 12-Jul-1998  mrg - KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.13 06-Jul-1998  mrg - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
 1.12 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.11 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.10 03-Mar-1997  explorer Message buffer passed to kvm_openfiles() should _POSIX2_LINE_MAX long; PR#3266
 1.9 13-Dec-1996  scottr Freshen up a bit:

- Replace deprecated sigblock() with sigprocmask()
- Redraw the current display if SIGWINCH is caught
- Style police
 1.8 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.7 21-Mar-1996  jtc Be pedantic, main() returns int in C.
 1.6 06-May-1995  jtc Print error message and exit if TERM is not set.
From PR #1015.
 1.5 29-Apr-1995  cgd various includes, casts, and cleanups...
 1.4 22-Mar-1995  mycroft Use err*(3)/warn*(3).
 1.3 22-Mar-1995  mycroft Don't core dump on an illegal display type. Display a more specific error
message for an ambiguous type.
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.15.2.2 20-Dec-1999  he Pull up revision 1.21 (requested by jwise):
Guard against buffer overflow.
 1.15.2.1 26-Sep-1999  he Pull up revision 1.16 (requested by he):
LP64 and type sanity fixes, with visible effects of enabling echo
on commands and correct cursor placement after update.
 1.16.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.24.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.30.2.2 06-Dec-2001  blymn Change deprecated curses function to new equivalent.
 1.30.2.1 06-Dec-2001  blymn file main.c was added on branch nathanw_sa on 2001-12-06 12:40:52 +0000
 1.40.8.1 09-Jan-2008  matt sync with HEAD
 1.40.4.1 03-Jun-2008  skrll Sync with netbsd-4.
 1.40.2.1 03-Feb-2008  riz Pull up following revision(s) (requested by christos in ticket #1031):
usr.bin/systat/keyboard.c: revision 1.24
usr.bin/systat/main.c: revision 1.41
usr.bin/systat/extern.h: revision 1.38
don't call curses from a signal handler!
 1.42.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.46.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.8.1 25-Feb-2013  tls resync with head
 1.46.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.47.6.1 10-Aug-2014  tls Rebase.
 1.48.2.2 30-Oct-2018  sborrill Pull up the following revisions(s) (requested by mrg in ticket #1639):
usr.bin/systat/main.c: revision 1.52 via patch

Add missing 'b' to the list of options.
Alpha-sort the option handling.
 1.48.2.1 04-Sep-2017  snj Pull up following revision(s) (requested by mrg in ticket #1491):
usr.bin/systat/main.c: revision 1.51
usr.bin/systat/systat.1: revision 1.47 via patch
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.
 1.49.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.49.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.51.6.1 30-Jan-2019  martin Pull up following revision(s) (requested by christos in ticket #1176):

usr.bin/systat/main.c: revision 1.55
usr.bin/systat/extern.h: revision 1.47
usr.bin/systat/syscall.c: revision 1.10
usr.bin/systat/iostat.c: revision 1.39
usr.bin/systat/vmstat.c: revision 1.85
usr.bin/systat/vmstat.c: revision 1.86

no need for curses.h

-

PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.53.4.1 10-Jun-2019  christos Sync with HEAD
 1.53.2.2 26-Jan-2019  pgoyette Sync with HEAD
 1.53.2.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.16 23-Nov-2012  christos mbufs display was broken since the time we moved to percpu stats.
 1.15 13-Apr-2009  lukem branches: 1.15.6; 1.15.12;
Fix -Wsign-compare issues
 1.14 22-Oct-2006  christos branches: 1.14.26;
use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.13 26-Feb-2005  dsl WARNS=3
 1.12 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.11 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.10 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.9 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.8 04-Jun-2000  mycroft branches: 1.8.2;
Use hline() and variants in a bunch of places.
 1.7 04-Mar-1999  bgrayson branches: 1.7.8;
Minor printf mod, for when we print a 3-digit value, and the next update prints only two (leaving the last stale digit showing)
 1.6 12-Jul-1998  mrg - KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.5 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.4 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.3 24-May-1997  jtc Use the new getmaxx and getmaxy macros instead of directly accessing
the private fields of WINDOW.
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.7.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.14.26.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.15.12.1 25-Feb-2013  tls resync with head
 1.15.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.24 28-Oct-2022  ozaki-r Adjust userland commands for struct inpcb separation

Only kvm users are affected.
 1.23 28-Oct-2022  ozaki-r Adjust userland commands for struct inpcb integration

Only kvm users are affected.
 1.22 30-Oct-2021  nia netstat(1): use reallocarr instead of realloc(x * y)
 1.21 26-Feb-2005  dsl WARNS=3
 1.20 04-Nov-2004  dsl Add (unsigned char) cast to ctype functions
Although, IIRC, there is another PR on all commands being converted to
lower case.
 1.19 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.18 15-May-2003  itojun use strlcpy
 1.17 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.16 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.15 27-Apr-2000  jdc branches: 1.15.4;
Fix arguments to *printw().
 1.14 05-Jan-2000  itojun support IPv6. commands under "netstat" are IPv6 ready.
IPv6 is supported by filters (":ignore ssh") as well.
TODO: do something about line truncation?
TODO: inet6.icmp6? ":help" will not fit into single line...
 1.13 05-Jan-2000  itojun avoid null pointer access on ":show".
 1.12 04-Jan-2000  itojun bring in latter half of PR 9080 (host table allocation error check).
 1.11 31-Dec-1999  tron Add missing memory check in port table handling. Patch based on
PR bin/9080 by Jun-ichiro itojun Hagino
 1.10 20-Dec-1999  jwise G/C function used in old command parsing
 1.9 20-Dec-1999  jwise Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.8 12-Jul-1998  mrg branches: 1.8.6;
- KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.7 02-Apr-1998  kleink No need to include <sys/socketvar.h>.
 1.6 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.5 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.4 21-May-1995  mycroft Use inet_aton(), not inet_addr().
 1.3 29-Apr-1995  cgd various includes, casts, and cleanups...
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.8.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.4.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

icmp.c 1.5
iostat.c 1.16
ip.c 1.8
ip6.c 1.5, 1.7
ipsec.c 1.5
keyboard.c 1.12
main.c 1.26
mbufs.c 1.9
netcmds.c 1.16
 1.32 28-Oct-2022  ozaki-r Adjust userland commands for struct inpcb separation

Only kvm users are affected.
 1.31 28-Oct-2022  ozaki-r Adjust userland commands for struct inpcb integration

Only kvm users are affected.
 1.30 03-May-2018  maxv Remove now unused tcpip.h includes. Some were already unused before.
 1.29 24-Nov-2013  mlelstv branches: 1.29.24;
Fix fallout from circleq->tailq transition.
 1.28 22-Oct-2006  christos branches: 1.28.40; 1.28.46;
use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.27 26-Feb-2005  dsl WARNS=3
 1.26 09-Jan-2005  christos - remove left over debugging code.
- centralize pointer to the head of the list casts by introducing a new var.
 1.25 04-Sep-2003  itojun synchronize w/ inpcb/in6pcb change
 1.24 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.23 05-Jul-2003  dsl Redraw addresses after screen refresh
 1.22 17-May-2003  itojun use strlcat/strlcpy
 1.21 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.20 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.19 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.18 27-Apr-2000  jdc branches: 1.18.4;
Fix arguments to *printw().
 1.17 10-Jan-2000  itojun don't choke on non-INET6 kernel, or non-IPSEC kernel.
cleanup error handling on mode change failure.

TODO: non-IPv4 kernel support should be improved. "netstat" should be okay,
"inet.ip" and "inet.icmp" needs more trick.

NetBSD PR: 9157
 1.16 07-Jan-2000  itojun add command line -n flag, which is same as "netstat numbers".
without it, we can't disable name resolution before the resolution starts.
 1.15 05-Jan-2000  itojun support IPv6. commands under "netstat" are IPv6 ready.
IPv6 is supported by filters (":ignore ssh") as well.
TODO: do something about line truncation?
TODO: inet6.icmp6? ":help" will not fit into single line...
 1.14 05-Jan-2000  itojun remove dupplicated prototype defs for file static funcs.
 1.13 20-Dec-1999  itojun fix "netstat numbers".
 1.12 20-Dec-1999  jwise Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.11 24-Apr-1999  ross branches: 1.11.4;
Functional LP64 and type sanity fixes.
 1.10 25-Aug-1998  ross branches: 1.10.2;
Add { and } to shut up egcs. Reformat the more questionable code.
 1.9 12-Jul-1998  mrg - KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.8 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.7 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.6 24-May-1997  jtc Use the new getmaxx and getmaxy macros instead of directly accessing
the private fields of WINDOW.
 1.5 13-Dec-1996  scottr Freshen up a bit:

- Replace deprecated sigblock() with sigprocmask()
- Redraw the current display if SIGWINCH is caught
- Style police
 1.4 11-Aug-1996  explorer clear the screen at the correct time to avoid leaving garbage on the screen.
This happens when switching from address to :numbers display.

From FreeBSD pr bin/1425.
 1.3 18-Jun-1995  cgd update for new queue structures
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.10.2.1 26-Sep-1999  he Pull up revision 1.11 (requested by he):
LP64 and type sanity fixes, with visible effects of enabling echo
on commands and correct cursor placement after update.
 1.11.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.4.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

netstat.c 1.19
pigs.c 1.20
ps.c 1.16
swap.c 1.13
systat.1 1.20
systat.h 1.7
tcp.c 1.7
vmstat.c 1.33
 1.28.46.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.40.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.24.1 21-May-2018  pgoyette Sync with HEAD
 1.34 09-Nov-2021  nia systat(1): convert free(x); x = malloc(x * y) to reallocarr.

free on NULL is a guaranteed non-op.
 1.33 23-Nov-2012  christos fix wrong sysctl
 1.32 23-Nov-2012  christos use sysctl
 1.31 21-Oct-2009  rmind branches: 1.31.6; 1.31.12;
Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.30 22-Oct-2006  christos use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.29 24-Dec-2005  matt Appease gcc 4.x
 1.28 26-Feb-2005  dsl WARNS=3
 1.27 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.26 11-Jan-2004  jdolecek g/c SDEAD handling
 1.25 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.24 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.23 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.22 04-May-2002  thorpej branches: 1.22.2;
Use kinfo_proc2.
 1.21 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.20 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.19 04-Jun-2000  mycroft branches: 1.19.2;
Use hline() and variants in a bunch of places.
 1.18 04-Jun-2000  thorpej Use kern.cp_time to fetch cp_time[]. Don't support fetching it from
crash dumps yet, as that requires determining which CPU we should fetch
it from, etc.
 1.17 04-Jun-2000  perry include sys/sched.h to get definition of CPUSTATES
 1.16 08-Jan-2000  itojun branches: 1.16.2;
- implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.15 22-Jul-1999  thorpej Update for SDEAD.
 1.14 24-Apr-1999  ross Functional LP64 and type sanity fixes.
 1.13 21-Feb-1999  jwise branches: 1.13.2;
Add a new `ps' view to systat, which shows process information. This
view is identical to the output of `ps aux' except that a.) the RSS and VSZ
fields are one character wider and b.) it shows a zero value for the RSS
and %MEM columns of processes which report a negative RSS.
 1.12 19-Feb-1999  jwise Show pid as well as user name and command in pigs view. Makes hopping to
another window and killing the errant process (or even just distinguishing
it from like processes) rather easier.
 1.11 28-Jul-1998  mycroft const propagation.
 1.10 12-Jul-1998  mrg - KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.9 17-May-1998  mycroft Fix pasto.
 1.8 17-May-1998  mycroft Don't display %cpu for zombies. It never decays, and makes the results look
odd.
 1.7 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.6 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.5 24-May-1997  jtc Use the new getmaxx and getmaxy macros instead of directly accessing
the private fields of WINDOW.
 1.4 13-Dec-1996  scottr Freshen up a bit:

- Replace deprecated sigblock() with sigprocmask()
- Redraw the current display if SIGWINCH is caught
- Style police
 1.3 29-Apr-1995  cgd various includes, casts, and cleanups...
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.13.2.1 26-Sep-1999  he Pull up revision 1.14 (requested by he):
LP64 and type sanity fixes, with visible effects of enabling echo
on commands and correct cursor placement after update.
 1.16.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.19.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

netstat.c 1.19
pigs.c 1.20
ps.c 1.16
swap.c 1.13
systat.1 1.20
systat.h 1.7
tcp.c 1.7
vmstat.c 1.33
 1.22.2.2 04-May-2002  thorpej Minimal changes needed to build in an LWP'ified universe.
 1.22.2.1 04-May-2002  thorpej file pigs.c was added on branch nathanw_sa on 2002-05-04 18:53:05 +0000
 1.31.12.1 25-Feb-2013  tls resync with head
 1.31.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.40 17-Apr-2021  maya Remove SCCS workarounds. No binary change.
 1.39 26-Aug-2020  simonb Use the vm.uspace sysctl instead of using the USPACE kernel define.
 1.38 03-Feb-2019  mrg - enlarge buffer to avoid snprintf() truncation
 1.37 10-Jan-2017  christos branches: 1.37.14;
need <sys/stat.h>
 1.36 19-Feb-2014  dsl branches: 1.36.8;
Remove some pointless inclusions os sys/user.h
 1.35 17-Aug-2011  christos branches: 1.35.2; 1.35.8;
eliminate non-literal format strings.
 1.34 21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.33 13-Apr-2009  lukem Fix -Wsign-compare issues
 1.32 29-Mar-2009  mrg - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.31 29-Dec-2008  christos branches: 1.31.2;
cast for tdev.
 1.30 17-Feb-2007  pavel branches: 1.30.18;
Revert the changes done after newlock2 merge, except for the removal of
the now unused LSDEAD state. The current kernel headers are now
source-compatible with pre-newlock2 kernel headers again.

Approved by Andrew Doran.
 1.29 09-Feb-2007  ad Sync with kernel changes introduced by merging the newlock2 branch.
 1.28 13-Feb-2006  kleink Print system processes' command names in square brackets, like ps(1) does.
 1.27 24-Dec-2005  matt Appease gcc 4.x
 1.26 26-Feb-2005  dsl branches: 1.26.2;
WARNS=3
 1.25 11-Jan-2004  jdolecek g/c SDEAD handling
 1.24 17-May-2003  itojun use strlcat/strlcpy
 1.23 15-May-2003  itojun use strlcpy
 1.22 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.21 06-Jan-2003  wiz interrupt with two rs.
 1.20 04-May-2002  thorpej branches: 1.20.2;
Use kinfo_proc2.
 1.19 14-Jul-2001  matt Fetch maxslp from the kernel. Only use USPACE if it's defined.
 1.18 20-Dec-2000  cgd __CONCAT does token pasting, not string concatnation. if something like:
__CONCAT("foo","bar");
actually works to concantate strings, it's because the preprocessor expands
it into "foo""bar" as separate strings, and then ANSI string concatenation
is performed on that. It's more straightforward to just use ANSI string
concatenation directly, and newer GCCs complain (rightly) about misuse
of token pasting.
 1.17 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.16 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.15 04-Jun-2000  perry branches: 1.15.2;
include sys/sched.h to get definition of CPUSTATES
 1.14 02-Jun-2000  thorpej Handle SONPROC state.
 1.13 08-Jan-2000  itojun branches: 1.13.2;
- implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.12 22-Dec-1999  kleink * Fix a display buglet: if the process list is exhausted before the window's
bottom is reached, clear the remaining lines, lest there be stale process
entries if the process list shrinks.
* Implement a top(1)-like `user' command in the ps display.
 1.11 20-Dec-1999  jwise TNF copyright -- I will do the paperwork to give these over asap.
 1.10 20-Dec-1999  jwise Knee-jerk snprintf()-ism.
 1.9 16-Dec-1999  jwise Backout unintended change
 1.8 16-Dec-1999  jwise Add a file missed in last commit
 1.7 05-Dec-1999  fredb More fallout from CL* purge.
 1.6 11-Oct-1999  mrg recognise "dty" the same as we do "tty"
 1.5 23-Jul-1999  veego branches: 1.5.2;
According to the previous commit the new process state should be SDEAD and
not SDYING, so s/SDYING/SDEAD/.
 1.4 22-Jul-1999  thorpej Update for SDEAD.
 1.3 19-Jun-1999  itohy Fix CPU percentage of "systat ps".
Yes, the name of the member "pt_pctcpu" is confusing :-).
Use double instead of float.
 1.2 22-Apr-1999  simonb Add an __RCSID.
 1.1 21-Feb-1999  jwise branches: 1.1.2;
Add a new `ps' view to systat, which shows process information. This
view is identical to the output of `ps aux' except that a.) the RSS and VSZ
fields are one character wider and b.) it shows a zero value for the RSS
and %MEM columns of processes which report a negative RSS.
 1.1.2.1 12-Oct-1999  he Pull up revision 1.6 (requested by mrg):
Fix "dty" vs "tty" problems that have existed since "dty"s were
invented sometime before 1.4 was released.
 1.5.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

netstat.c 1.19
pigs.c 1.20
ps.c 1.16
swap.c 1.13
systat.1 1.20
systat.h 1.7
tcp.c 1.7
vmstat.c 1.33
 1.20.2.3 17-Jan-2003  thorpej Sync with HEAD.
 1.20.2.2 04-May-2002  thorpej Minimal changes needed to build in an LWP'ified universe.
 1.20.2.1 04-May-2002  thorpej file ps.c was added on branch nathanw_sa on 2002-05-04 18:53:05 +0000
 1.26.2.1 15-Feb-2006  riz Pull up following revision(s) (requested by kleink in ticket #1172):
usr.bin/systat/ps.c: revision 1.28
Print system processes' command names in square brackets, like ps(1) does.
 1.30.18.1 01-Apr-2009  snj branches: 1.30.18.1.4;
Pull up following revision(s) (requested by mrg in ticket #622):
bin/csh/csh.1: revision 1.46
bin/csh/func.c: revision 1.37
bin/ps/print.c: revision 1.111
bin/ps/ps.c: revision 1.74
bin/sh/miscbltin.c: revision 1.38
bin/sh/sh.1: revision 1.92 via patch
external/bsd/top/dist/machine/m_netbsd.c: revision 1.7
lib/libkvm/kvm_proc.c: revision 1.82
sys/arch/mips/mips/cpu_exec.c: revision 1.55
sys/compat/darwin/darwin_exec.c: revision 1.57
sys/compat/ibcs2/ibcs2_exec.c: revision 1.73
sys/compat/irix/irix_resource.c: revision 1.15
sys/compat/linux/arch/amd64/linux_exec_machdep.c: revision 1.16
sys/compat/linux/arch/i386/linux_exec_machdep.c: revision 1.12
sys/compat/linux/common/linux_limit.h: revision 1.5
sys/compat/osf1/osf1_resource.c: revision 1.14
sys/compat/svr4/svr4_resource.c: revision 1.18
sys/compat/svr4_32/svr4_32_resource.c: revision 1.17
sys/kern/exec_subr.c: revision 1.62
sys/kern/init_sysctl.c: revision 1.160
sys/kern/kern_exec.c: revision 1.288
sys/kern/kern_resource.c: revision 1.151
sys/sys/param.h: patch
sys/sys/resource.h: revision 1.31
sys/sys/sysctl.h: revision 1.184
sys/uvm/uvm_extern.h: revision 1.153
sys/uvm/uvm_glue.c: revision 1.136
sys/uvm/uvm_mmap.c: revision 1.128
usr.bin/systat/ps.c: revision 1.32
- - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.
- - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.
- - add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)
- - patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)
- - patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.
- - update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)
this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.30.18.1.4.1 27-Dec-2011  matt Use UPAGES in preferences to USPACE.
 1.31.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.35.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.36.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.37.14.1 10-Jun-2019  christos Sync with HEAD
 1.4 23-Nov-2012  christos use sysctl
 1.3 04-May-2002  thorpej branches: 1.3.2; 1.3.60; 1.3.66;
Use kinfo_proc2.
 1.2 04-Jun-2000  thorpej Use kern.cp_time to fetch cp_time[]. Don't support fetching it from
crash dumps yet, as that requires determining which CPU we should fetch
it from, etc.
 1.1 21-Feb-1999  jwise branches: 1.1.8;
Add a new `ps' view to systat, which shows process information. This
view is identical to the output of `ps aux' except that a.) the RSS and VSZ
fields are one character wider and b.) it shows a zero value for the RSS
and %MEM columns of processes which report a negative RSS.
 1.1.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.66.1 25-Feb-2013  tls resync with head
 1.3.60.1 16-Jan-2013  yamt sync with (a bit old) head
 1.3.2.2 04-May-2002  thorpej Use kinfo_proc2.
 1.3.2.1 04-May-2002  thorpej file ps.h was added on branch nathanw_sa on 2002-05-04 18:44:28 +0000
 1.21 09-Nov-2021  nia systat(1): convert free(x); x = malloc(x * y) to reallocarr.

free on NULL is a guaranteed non-op.
 1.20 30-May-2008  mrg convert the rest of my licenses to 2-clause, extracting myself out
from a group as necessary.

bozohttpd remains, but it will get fixed next time i update it.
 1.19 18-Mar-2006  dsl branches: 1.19.20; 1.19.22;
Coverty 7449: Remove splurious check for 'sep == NULL'.
 1.18 26-Feb-2005  dsl WARNS=3
 1.17 13-Oct-2003  agc Move Matt Green's code from a 4-clause to a 3-clause licence by removing
the advertising clause. Diffs provided in PR 22396 by Joel Baker, the changes
were confirmed to the board by Matt Green.
 1.16 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.15 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.14 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.13 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.12 04-Jun-2000  mycroft branches: 1.12.2;
Use hline() and variants in a bunch of places.
 1.11 13-Apr-2000  mrg branches: 1.11.2;
use <sys/swap.h>. should have happened years ago.
 1.10 20-Dec-1999  jwise Fix error handling throughout. First off, it is not true as claimed in swap.c
that `systat doesn't handle errors'. Second off, errx should not be used directly, since
the terminal should be cleaned up before bailing. Third off, whatever we do we need
to be consistent.

There, I feel better now.
 1.9 26-Dec-1998  marc branches: 1.9.6;
since the return from swapctl can change from call to call, print the
"Disk" column each time. Also, use sep->se_path, not
devname(sep->se_dev).
 1.8 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
- use swapctl(2), rather than grovelling KVM.
 1.7 03-Apr-1997  mikel erase old Xs when printing new ones for swap usage; from Paul Boven in
PR bin/3431 with some changes by me.
 1.6 02-Feb-1997  christos Fix PR1882+PR3171, swap display core-dumps from Paul Boven.
 1.5 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.4 31-Aug-1995  jtc Sync with 4.4lite2
 1.3 29-Apr-1995  cgd various includes, casts, and cleanups...
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.2 31-Aug-1995  jtc imported from 44lite2
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.9.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.12.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

netstat.c 1.19
pigs.c 1.20
ps.c 1.16
swap.c 1.13
systat.1 1.20
systat.h 1.7
tcp.c 1.7
vmstat.c 1.33
 1.19.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.19.20.1 04-Jun-2008  yamt sync with head
 1.10 25-Jan-2019  christos PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.9 19-Feb-2014  dsl branches: 1.9.18; 1.9.24; 1.9.26;
Remove some pointless inclusions os sys/user.h
 1.8 23-Nov-2012  christos PR/47222: Manuel Bouyer: Fix syscall display to show something reasonable.
 1.7 21-Oct-2009  wiz branches: 1.7.6; 1.7.12;
Fix problems with SIGWINCH. From Paul Ripke in PR 42161.
 1.6 13-Apr-2009  lukem Fix -Wsign-compare issues
 1.5 29-Apr-2008  martin branches: 1.5.6; 1.5.8; 1.5.12;
Convert to new 2 clause license
 1.4 11-Feb-2008  dyoung branches: 1.4.4;
#include <sys/evcnt.h> instead of <sys/device.h>, since the former
is sufficient, anyway. Do not needlessly #include <sys/device.h>.

Note well: device_t is not part of the kernel ABI.
 1.3 18-Feb-2007  dsl branches: 1.3.4;
Include code to display per system call counts and times.
 1.2 20-May-2006  dsl Checkpoint this as 'WIP' before I break it again!
(Not complied by default.)
 1.1 18-Mar-2006  dsl branches: 1.1.2;
Code to display per-system call counts.
Very useful to help identify which code is doing 1000s of system calls.
Not built because no one else has a kernel yet, and I need to make
the kernel side configurable. But I don't want to lose this code....
 1.1.2.1 19-Jun-2006  chap Sync with head.
 1.3.4.1 23-Mar-2008  matt sync with HEAD
 1.4.4.1 18-May-2008  yamt sync with head.
 1.5.12.1 21-Apr-2010  matt sync to netbsd-5
 1.5.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.5.6.1 27-Oct-2009  bouyer Pull up following revision(s) (requested by wiz in ticket #1110):
usr.bin/systat/vmstat.c: revision 1.74
usr.bin/systat/syscall.c: revision 1.7
Fix problems with SIGWINCH. From Paul Ripke in PR 42161.
 1.7.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.12.1 25-Feb-2013  tls resync with head
 1.7.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.6.1 16-Jan-2013  yamt sync with (a bit old) head
 1.9.26.1 10-Jun-2019  christos Sync with HEAD
 1.9.24.1 26-Jan-2019  pgoyette Sync with HEAD
 1.9.18.1 30-Jan-2019  martin Pull up following revision(s) (requested by christos in ticket #1176):

usr.bin/systat/main.c: revision 1.55
usr.bin/systat/extern.h: revision 1.47
usr.bin/systat/syscall.c: revision 1.10
usr.bin/systat/iostat.c: revision 1.39
usr.bin/systat/vmstat.c: revision 1.85
usr.bin/systat/vmstat.c: revision 1.86

no need for curses.h

-

PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.54 29-Mar-2023  uwe systat(1): try to give this page a quick facelift

... too bad what it really needs is reconstructive surgery. I tried
to fix the most obvious problems (unsorted lists, obviously wrong
markup, pleonastic wording that drowns out useful information in
repetition and lifetime supply of quote marks).

This page really needs a native speaker to take some loving care of it.
 1.53 29-Mar-2023  kre PR misc/57305 from Nan Xiao

Be consistent with method (and style) when referring to the mbufs and
ifstat sub-commands when describing what is available (and correct
"mbuf" to be "mbufs" which is what the internal command really is).

That is don't just "double quote" one and 'single quote' the other.
 1.52 21-Aug-2021  christos PR/56331: Paul Goyette: Add -z option to display 0 instead of ' ' in vmstat.
 1.51 28-Dec-2018  wiz Fix some macro usage. Fix a typo.
 1.50 26-Dec-2018  sevan Remove commentd out options for fields no longer present in source.
 1.49 26-Dec-2018  sevan Extend "systat vm" output to provide better insight about buffercache and
document it.

From Greg A. Woods in PR bin/36542
 1.48 03-Jul-2017  wiz branches: 1.48.4; 1.48.6;
Remove workaround for ancient HTML generation code.
 1.47 03-Dec-2016  mrg 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.
 1.46 03-Aug-2016  wiz Bump date for new ifstat command.
 1.45 02-Aug-2016  scole PR bin/51204

Add ifstat command to systat.

Imported from FreeBSD
 1.44 12-Mar-2016  dholland branches: 1.44.2;
NetBSD does actually support flat-panel displays. Even for systat(1).
(noted by tnn)
 1.43 18-Oct-2013  bad branches: 1.43.4;
Make :drives, :display, :ignore accept fnmatch(3) patterns to specify drives.
Bump man page date.
 1.42 22-Mar-2012  wiz branches: 1.42.2;
Fix whitespace nits. Suggested by Bug Hunting.
 1.41 06-Jan-2012  drochner kill ipsec support which hasn't been working for a long time
(neither for KAME nor for FAST_IPSEC)
 1.40 21-Oct-2009  wiz branches: 1.40.6;
Bump date for uarea swap-out removal.
 1.39 21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.38 11-Mar-2009  joerg Don't workaround ancient macro argument limit with .Xo/.Xc.
 1.37 18-Feb-2007  dsl branches: 1.37.20;
Document 'systat syscall'.
 1.36 20-Feb-2005  wiz Sort SEE ALSO (hi hubert! First by section, then by name.)
 1.35 20-Feb-2005  wiz Drop trailing whitespace.
 1.34 16-Feb-2005  hubertf Add "df" display to give information about filesystems, available diskspace
and used disk capacity, similar to df(1):

Filesystem Avail Capacity
/0% /10% /20% /30% /40% /50% /60% /70% /80% /90% /100%
/ 359M |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/tmp 180M |
/home 146G |XXXXXXXXXXXXXXXX
 1.33 15-Sep-2003  wiz Bump date for previous, reword a sentence.
 1.32 12-Sep-2003  mycroft WRT disk commands, make the man page consistent with the program, and add the
feature I expected.
 1.31 30-Aug-2003  dsl Bring description of vmstat page closer to reality.
 1.30 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.29 27-Jun-2003  wiz Quote question mark. Change width argument in a table to line up
 1.28 31-Mar-2003  perry refreshs->refreshes
reactived->reactivated
intransit->in-transit
from Igor Sobrado, PR misc/19700
 1.27 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.26 01-Nov-2002  mrg iostat(8) and systat(8) support for separate read/write disk statistics.
"iostat -x" now shows these (ala linux/solaris), but this is only splitting
the read/write bytes/transactions, not adding any new metrics. "systat
iostat" now has two new commands to switch between combined/separate mode
for both it's numbers & bar modes.
 1.25 08-Feb-2002  ross branches: 1.25.2;
Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
 1.24 13-Jan-2002  fair Apply patch to BUGS section, per PR 13230, plus clean up nroff nits.
 1.23 08-Jul-2001  wiz Remove Pp before Sh, and split filesystem.
 1.22 06-May-2001  wiz Change xref for vmstat(8) to vmstat(1).
Whitespace, punctuation and spelling fixes while I'm here.
 1.21 25-Aug-2000  hubertf Add "all" mode to systat to cycle between all modes,
sort of like VMS' "MONITOR ALL"-command.

Code was submitted by Jarkko Teppo <jate@uwasa.fi> in PR 10851,
cleaned up and added 'turns' handling by me.
 1.20 05-Jul-2000  ad - Document new commands for IP displays.
- Replace the "Takes 2-10 percent of the CPU" statement.
 1.19 08-Jan-2000  itojun branches: 1.19.4;
- implement layered help.
Suggested by: Andy Doran <ad@mr-magoo.sports.gov.uk>
- inet6.ip6 and ipsec menu
- u_quad_t printing fix
- #ifdefs to allow compilation on 1.4.x
 1.18 07-Jan-2000  itojun add command line -n flag, which is same as "netstat numbers".
without it, we can't disable name resolution before the resolution starts.
 1.17 22-Dec-1999  kleink * Fix a display buglet: if the process list is exhausted before the window's
bottom is reached, clear the remaining lines, lest there be stale process
entries if the process list shrinks.
* Implement a top(1)-like `user' command in the ps display.
 1.16 15-Nov-1999  simonb - Add `bufcache' display which shows buffer cache usage per filesystem,
ala the monitor(1) command for Ultrix.
- Allow `h' or `?' to show the command list (same as `:help').
- Sort commands in cmdtab.c and systat.1
 1.15 02-Aug-1999  ad branches: 1.15.4;
Add 'inet.' prefix to 'tcp', 'ip', 'tcpsyn' and 'icmp' displays.
Fixes PR: bin/8130 (Geoff C. Wing)
 1.14 30-May-1999  ad Add 4 new modes: ip, icmp, tcp, tcpsyn. XXX still some work to be done
on aesthetics and update modes.
 1.13 22-Mar-1999  garbled More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages. Many more to
come.
 1.12 21-Feb-1999  jwise Document the new `ps' view.
 1.11 19-Feb-1999  jwise Add cross-references from eaach of these too the other. Note that top.1
is still in old man format. Do we want to translate this to mandoc? I
assume no, as this would make imports hard, so I didn't, but I'm not sure
what the best way to do this would be.
 1.10 28-Jan-1999  mrg swap areas are not compiled into the kernel, from erik bertelsen, PR#6892
 1.9 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.8 25-Jul-1997  mrg update "systat vmstat" documentation to reality.
 1.7 25-Jul-1997  mrg get at least *part* of "systat vmstat" right...
 1.6 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.5 27-Sep-1995  jtc iostat is in section 8; PR #1533
 1.4 27-Sep-1995  jtc vmstat is in section 8; PR #1532
 1.3 27-Apr-1995  jtc vmunix -> netbsd
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.15.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.19.4.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

netstat.c 1.19
pigs.c 1.20
ps.c 1.16
swap.c 1.13
systat.1 1.20
systat.h 1.7
tcp.c 1.7
vmstat.c 1.33
 1.25.2.2 12-Nov-2002  skrll Catch up to -current.
 1.25.2.1 08-Feb-2002  skrll file systat.1 was added on branch nathanw_sa on 2002-11-12 16:54:59 +0000
 1.37.20.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.40.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.40.6.1 17-Apr-2012  yamt sync with head
 1.42.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.4.1 04-Sep-2017  snj Pull up following revision(s) (requested by mrg in ticket #1491):
usr.bin/systat/main.c: revision 1.51
usr.bin/systat/systat.1: revision 1.47 via patch
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.
 1.44.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.44.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.48.6.1 10-Jun-2019  christos Sync with HEAD
 1.48.4.2 18-Jan-2019  pgoyette Synch with HEAD
 1.48.4.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.12 26-Dec-2018  sevan Extend "systat vm" output to provide better insight about buffercache and
document it.

From Greg A. Woods in PR bin/36542
 1.11 26-Feb-2005  dsl branches: 1.11.90; 1.11.92;
WARNS=3
 1.10 07-Dec-2003  christos be more descriptive about what failed by printing the errno and the
variable we were trying to fetch.
 1.9 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.8 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.7 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.6 20-Dec-1999  jwise branches: 1.6.4;
Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.5 16-Dec-1999  jwise Handle arguments to global commands. Note that the `interval' and
`start' global commands are still special cased, which will change
 1.4 16-Dec-1999  jwise Rototill global command matching -- switch from ad-hoc tomfoolery to a
table lookup. This will make prefix matching and so on easier.

Expect a similar change for mode-specific commands before too long.

While there, rename some structures with misleading names.

Watch this space for more changes soon.
 1.3 21-Jul-1997  mrg branches: 1.3.8;
- some KNF.
- use __RCSID().
- WARNS=1
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.4.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

netstat.c 1.19
pigs.c 1.20
ps.c 1.16
swap.c 1.13
systat.1 1.20
systat.h 1.7
tcp.c 1.7
vmstat.c 1.33
 1.11.92.1 10-Jun-2019  christos Sync with HEAD
 1.11.90.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.16 03-Jun-2014  joerg Always use_sysctl in preparation of removing all kvm code.
 1.15 10-Apr-2008  thorpej branches: 1.15.28; 1.15.40;
Don't even bother initializing the namelist if we're not going to use it.
 1.14 10-Apr-2008  thorpej Use sysctl to fetch network statistics unless a memory file is specified
on the command line.
 1.13 08-Apr-2008  thorpej Change TCP stats from a structure to an array of uint64_t's.

Note: This is ABI-compatible with the old tcpstat structure; old netstat
binaries will continue to work properly.
 1.12 22-Oct-2006  christos use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.11 26-Feb-2005  dsl WARNS=3
 1.10 24-Feb-2003  dsl Create subwins that end one line from the bottom of the screen even
after the window is resized.
 1.9 12-Jun-2001  wiz branches: 1.9.2;
receive, not recieve
 1.8 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.7 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.6 13-Jun-2000  ad branches: 1.6.2;
Use my proper name.
 1.5 29-Apr-2000  matt branches: 1.5.2;
fix SHOW to work on any platform
 1.4 27-Apr-2000  jdc Fix arguments to *printw().
 1.3 13-Jan-2000  ad Two tiny formatting nits in each file.
 1.2 30-Jul-1999  ad Formatting nits.
 1.1 30-May-1999  ad Add 4 new modes: ip, icmp, tcp, tcpsyn. XXX still some work to be done
on aesthetics and update modes.
 1.5.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.6.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

netstat.c 1.19
pigs.c 1.20
ps.c 1.16
swap.c 1.13
systat.1 1.20
systat.h 1.7
tcp.c 1.7
vmstat.c 1.33
 1.9.2.2 12-Jun-2001  wiz receive, not recieve
 1.9.2.1 12-Jun-2001  wiz file tcp.c was added on branch nathanw_sa on 2001-06-12 15:17:30 +0000
 1.15.40.1 10-Aug-2014  tls Rebase.
 1.15.28.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.92 28-Mar-2023  kre PR bin/56014 from Kouichi Hashikawa

Don't try to optimise away placing the "s" or " " after "N user"
(" " where N==1, "s" otherwise) when it seems unnecessary, as that
fails when the number of users hasn't changed, but the screen is
being redrawn from nothing (as in after being resumed from a ^Z,
as in the PR, but just doing a ^L would make the same thing happen).

XXX pullup -10 (maybe -9 as well - seems too trivial for -8).
 1.91 09-Nov-2021  nia branches: 1.91.2;
systat(1): convert realloc(x * y) to reallocarr, eliminate a temp var
 1.90 21-Aug-2021  christos PR/56331: Paul Goyette: Add -z option to display 0 instead of ' ' in vmstat.
 1.89 24-Jul-2021  simonb 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.
 1.88 02-Mar-2020  mrg increase slot slop space from 100 to 1000 before giving up.

from Paul Ripke on current-users. thanks!
 1.87 30-Jun-2019  he branches: 1.87.2;
Make the scaling of the "bytes written" sticky, so that if we go
to K, we don't return to unscaled, and similar for higher scales
(though it takes some effort, due to the wide field...)
Fixes PR#54334.
 1.86 25-Jan-2019  christos no need for curses.h
 1.85 25-Jan-2019  christos PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.84 08-Jan-2019  tih Remove a format character from a non-format string.
 1.83 26-Dec-2018  sevan Extend "systat vm" output to provide better insight about buffercache and
document it.

From Greg A. Woods in PR bin/36542
 1.82 15-Jul-2017  mlelstv branches: 1.82.2; 1.82.4; 1.82.6;
Use I/O timestamps to compute disk statistics for better precisison.
 1.81 24-Dec-2014  dennis branches: 1.81.8;
Update stats-keeping in sys/kern/vfs_cache.c to remove (most)
races while allowing consistent lockless sampling of the per-cpu
statistics without atomic operations. Update comment describing
the locking protocol to include this.

These files were fumble-fingered out of the last commit.
 1.80 20-Jun-2014  njoly Remove fagile test which ensured that first namelist element (was
X_NCHSTATS) had a known type. Make disk stats available again for
vmstat display.
 1.79 14-Jun-2014  joerg GC X_NCHSTATS
 1.78 03-Jun-2014  joerg Provide sysctl for namecache statistics.
 1.77 30-Apr-2010  njoly branches: 1.77.12; 1.77.22;
Add per process cache values to the total name translations count.
 1.76 30-Apr-2010  njoly In vmstat display, add one more column to output memory values. Avoid
overflow with more than 100GB.
 1.75 21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.74 21-Oct-2009  wiz Fix problems with SIGWINCH. From Paul Ripke in PR 42161.
 1.73 13-Apr-2009  lukem Fix -Wsign-compare issues
 1.72 09-Mar-2009  njoly In vmstat display, increase software interrupt count output from 5 to
6 columns.
 1.71 13-Jul-2008  dholland branches: 1.71.4; 1.71.6; 1.71.10;
Clarify how one is supposed to use the pointers returned by getutentries()
(the utmpentry.c code), specifically with respect to who owns them and
when to free them. Now they're owned by utmpentry.c, only. Abolish the
freeutentries() function, which was the wrong abstraction; add instead
endutentries(), which flushes out the internally managed memory.

Update callers as necessary. Some (e.g. talkd) had been leaking memory;
others (e.g. syslogd) had been accidentally freeing and reloading utmp
more often than necessary. There are a couple untidy bits in users and
rwhod that someone should look after sometime, maybe.

Fixes PR bin/35131, which was about talkd's memory leak.
 1.70 11-Feb-2008  dyoung branches: 1.70.6;
#include <sys/evcnt.h> instead of <sys/device.h>, since the former
is sufficient, anyway. Do not needlessly #include <sys/device.h>.

Note well: device_t is not part of the kernel ABI.
 1.69 22-Oct-2006  christos branches: 1.69.8;
use c99 initializers
consistently terminate nlist arrays with NULL not ""
 1.68 21-May-2006  dsl Reduce the field widths for the summary line of traps, system calls
and interrupts so that the numbers don't all run into one.
 1.67 14-May-2006  christos branches: 1.67.2;
Gcc 4 needs to have the enum declaration in scope to determine the enum size.
 1.66 11-May-2006  yamt include errno.h directly rather than via user.h.
 1.65 14-Apr-2006  blymn Update to use new kernel io statistics.
 1.64 20-Mar-2006  dsl free() intrnamebuf, intrname and intrloc on entry so we don't leak them
every time initvmstat() is called.
Change intrnamebuf to be static so this works.
Inspired by Coverty CID 2072 (incorrectly) reporting that the memory assigned
to intrnamebuf wasn't being freed.
 1.63 18-Mar-2006  dsl Make the functions that display the top 8 lines externally visible so
they can be used to head other pages (not ready to commit yet...).
Use puthumanint() for oversize numbers when display_mode is RUN or BOOT (when
very big numbers are to be expected).
Allow an extra column for Csw..Flt.
Adjust some #defines to avoid use of global s & s1.
 1.62 05-Feb-2006  dsl Split dkreadstats() into dkreadstats(), tkreadstats() and cpureadstats().
Similarly for dkswap().
Allows code to only call one of these.
Rename struct _disk to _vminfo to be nearer its contents.
Change 'systat vm' so that it always shows the 'current' cpu times, even
after ':run' or ':boot' commands. The code in vmstat.c doesn't support :run.
 1.61 07-Aug-2005  blymn Add tape statistics.
 1.60 22-May-2005  chs do not rely on the pre-evcnt interrupt counter kernel symbols being present.
if they do not exist, then interrupt stats are all in evcnts.
 1.59 26-Feb-2005  dsl WARNS=3
 1.58 22-Feb-2005  christos PR/29505: Nicolas Joly: Increase width of csw value in systat vmstat.
 1.57 03-Feb-2005  christos PR/29213: Nicolas Joly: sysstat(1) vmstat cannot display large memory values
 1.56 13-Jun-2004  mycroft Fix a display glitch when blanking out drive columns.
 1.55 19-Sep-2003  itojun realloc pedant
 1.54 30-Aug-2003  dsl Use correct size when copying interrupt counters.
Fixes second part of bin/10095 (first part fixed in rev 1.25)
 1.53 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.52 05-Aug-2003  grant Discs->Disks
 1.51 11-Jun-2003  drochner no need to #include <sys/dkstat.h>
 1.50 15-May-2003  itojun use strlcpy
 1.49 18-Feb-2003  dsl Pivot the disk stats into extra lines if they run out of columns
(approved by christos)
 1.48 17-Feb-2003  dsl Fiddle with screen layout to generate room for longer labels on the
interrupt count fields.
(approved by christos)
 1.47 13-Feb-2003  dsl Avoid displaying "intr" for all interrupt counter titles
(approved by christos)
 1.46 20-Jan-2003  dsl Make kernel address arg of kvm_ckread() const void * so caller doesn't
need a cast.
(approved by christos)
 1.45 18-Jan-2003  christos kill warns.
 1.44 18-Jan-2003  dsl pull interrupt stats from event counts
fix disk xfer byte count
fix absolute counts - were divided by time interval
 1.43 01-Nov-2002  mrg iostat(8) and systat(8) support for separate read/write disk statistics.
"iostat -x" now shows these (ala linux/solaris), but this is only splitting
the read/write bytes/transactions, not adding any new metrics. "systat
iostat" now has two new commands to switch between combined/separate mode
for both it's numbers & bar modes.
 1.42 25-Sep-2002  christos PR/18408: Chris Demetriou: Kilo is abbreviated using a small k not a CAPITAL K.
 1.41 08-Aug-2002  abs introduce puthumanint() which calls humanize_number(), and use to
display disk transfer values (Suggested by Simon Burge). Also clip
%busy to 100 and display as an int which has the useful side effect
of stopping it overflowing into the next column (100.0).
 1.40 01-Aug-2002  christos scan utmpx/utmp.
 1.39 30-Jun-2002  sommerfeld Since the KERN_CP_TIME sysctl reports total clock ticks across all
cpus and hz is measured in ticks per cpu, divide tick count by ncpu to
determine elapsed time since last sample.

Fixes I/O rate deflation observed on multiprocessors.
 1.38 15-May-2002  kleink branches: 1.38.2;
From Simon Burge: remove orphaned reference to _total; fixes PR bin/16804.
 1.37 28-Jan-2002  augustss branches: 1.37.2;
Make it compile (more vmstat fallout).
 1.36 28-Sep-2001  augustss Since the system call and trap rates are often 5 digit numbers these
days we move the columns a little to avoid running into other numbers.
 1.35 01-Dec-2000  simonb Remove extern variables and functions now declared in dkstats.h.
While here, remove 77 (!) unneed #includes.
 1.34 29-Nov-2000  simonb Use the vm.uvmexp2 sysctl.
 1.33 05-Jul-2000  ad - Add `boot', `run', `time' and `zero' commands to all IP displays. These work
as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.
 1.32 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.31 05-Jun-2000  mycroft branches: 1.31.2;
Display disk busy statistics as `%busy', as it's less confusing.
 1.30 04-Jun-2000  mycroft Use hline() and variants in a bunch of places.
 1.29 04-Jun-2000  mycroft Fix a check so that holding down the space bar doesn't cause systat to lose.
 1.28 04-Jun-2000  mycroft Fix the CPU usage bar graph.
 1.27 04-Jun-2000  thorpej Use kern.cp_time to fetch cp_time[]. Don't support fetching it from
crash dumps yet, as that requires determining which CPU we should fetch
it from, etc.
 1.26 04-Jun-2000  perry include sys/sched.h to get definition of CPUSTATES
 1.25 29-May-2000  simonb Another cp_time size fix - also, there are 5 CPUSTATES now not four...
 1.24 21-Jan-2000  mycroft branches: 1.24.2;
Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We get
the correct definition from errno.h.
 1.23 20-Dec-1999  jwise Fix error handling throughout. First off, it is not true as claimed in swap.c
that `systat doesn't handle errors'. Second off, errx should not be used directly, since
the terminal should be cleaned up before bailing. Third off, whatever we do we need
to be consistent.

There, I feel better now.
 1.22 20-Dec-1999  jwise Two things:

1.) fix a bug which caused coredumps when starting with no mode arguments
2.) move to table-lookup for mode-specific command parsing as well.
all command matching is now table-driven.
 1.21 10-Oct-1999  mrg let "systat vmstat" say "1 user" not "1 users"
 1.20 30-Sep-1999  soren There's room in the systat-vmstat-iostat display, so allow four-letter
device names like e.g. ccd0 and print an extra digit of precision in
the 'sec' line like iostat(8) does.
 1.19 24-Mar-1999  mrg branches: 1.19.2; 1.19.4;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.18 26-Dec-1998  marc display the seconds in the timestamp in the corner, too.
 1.17 19-Dec-1998  drochner avoid integer overflow in free memory report
 1.16 06-Dec-1998  mycroft Add missing braces, so PUTRATE() works correctly as an if clause.
 1.15 19-Jul-1998  drochner Fix handling of privileges - the gid was given up before dkinit()
was called.
Pass the gid to use for KVM access explicitely to dkinit(), the caller
decides whether to call setgid(getgid()) or not.
 1.14 12-Jul-1998  mrg - KNF
- use snprintf
- don't overwrite the keyboard buffer (and make this sized on
the window size).
 1.13 09-Feb-1998  mrg clean up memory totals in UVM case.
 1.12 09-Feb-1998  mrg make "systat vmstat" much much much more UVM friendly.
 1.11 07-Feb-1998  mrg build and run with -DUVM. this isn't yet finished but it does run and partially work.
 1.10 19-Oct-1997  lukem fix .Nm usage, deprecate register, getopt returns -1 not EOF, s/[br]*/[ms]*/
 1.9 25-Aug-1997  kleink Lseek(2) usage cleanup: the use of L_SET/L_INCR/L_XTND is deprecated,
use SEEK_SET/SEEK_CUR/SEEK_END instead.
 1.8 21-Jul-1997  mrg - some KNF.
- use __RCSID().
- WARNS=1
 1.7 13-Dec-1996  scottr Freshen up a bit:

- Replace deprecated sigblock() with sigprocmask()
- Redraw the current display if SIGWINCH is caught
- Style police
 1.6 11-Aug-1996  explorer remove nlist lookup of _dk_*
 1.5 10-May-1996  thorpej New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.4 29-Apr-1995  cgd various includes, casts, and cleanups...
 1.3 22-Mar-1995  mycroft Use err*(3)/warn*(3).
 1.2 20-Jan-1995  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1 20-Jan-1995  jtc branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jan-1995  jtc imported from 44lite
 1.19.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.19.2.1 23-Jan-2000  he Pull up revision 1.24 (requested by mycroft):
Always do the errno indirection hack, so that non-threaded
libraries get the right errno value when linked with -lpthread.
This means "always include <errno.h> and never declare errno
yourself".
 1.24.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.31.2.1 01-Sep-2000  ad Pull up the following revisions, approved by releng-1-5:

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

netstat.c 1.19
pigs.c 1.20
ps.c 1.16
swap.c 1.13
systat.1 1.20
systat.h 1.7
tcp.c 1.7
vmstat.c 1.33
 1.37.2.2 12-Nov-2002  skrll Catch up to -current.
 1.37.2.1 28-Jan-2002  skrll file vmstat.c was added on branch nathanw_sa on 2002-11-12 16:55:00 +0000
 1.38.2.1 30-Jun-2002  lukem Pull up revision 1.39 (requested by sommerfeld in ticket #406):
Since the KERN_CP_TIME sysctl reports total clock ticks across all
cpus and hz is measured in ticks per cpu, divide tick count by ncpu to
determine elapsed time since last sample.
Fixes I/O rate deflation observed on multiprocessors.
 1.67.2.1 19-Jun-2006  chap Sync with head.
 1.69.8.1 23-Mar-2008  matt sync with HEAD
 1.70.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.71.10.1 21-Apr-2010  matt sync to netbsd-5
 1.71.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.71.4.1 27-Oct-2009  bouyer Pull up following revision(s) (requested by wiz in ticket #1110):
usr.bin/systat/vmstat.c: revision 1.74
usr.bin/systat/syscall.c: revision 1.7
Fix problems with SIGWINCH. From Paul Ripke in PR 42161.
 1.77.22.1 10-Aug-2014  tls Rebase.
 1.77.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.81.8.3 11-Dec-2023  martin Pull up following revision(s) (requested by kre in ticket #1926):

usr.bin/systat/vmstat.c: revision 1.92

PR bin/56014 from Kouichi Hashikawa

Don't try to optimise away placing the "s" or " " after "N user"
(" " where N==1, "s" otherwise) when it seems unnecessary, as that
fails when the number of users hasn't changed, but the screen is
being redrawn from nothing (as in after being resumed from a ^Z,
as in the PR, but just doing a ^L would make the same thing happen).
 1.81.8.2 30-Jan-2019  martin Pull up following revision(s) (requested by christos in ticket #1176):

usr.bin/systat/main.c: revision 1.55
usr.bin/systat/extern.h: revision 1.47
usr.bin/systat/syscall.c: revision 1.10
usr.bin/systat/iostat.c: revision 1.39
usr.bin/systat/vmstat.c: revision 1.85
usr.bin/systat/vmstat.c: revision 1.86

no need for curses.h

-

PR/53906: Paul Ripke: systat(1) vmstat & syscall get
"alternate system clock has died" on terminal resize (SIGWINCH)
 1.81.8.1 25-Jul-2017  snj Pull up following revision(s) (requested by mlelstv in ticket #138):
usr.bin/systat/iostat.c: revision 1.38
usr.bin/systat/vmstat.c: revision 1.82
usr.bin/vmstat/drvstats.c: revision 1.11
usr.bin/vmstat/drvstats.h: revision 1.5
usr.bin/vmstat/vmstat.c: revision 1.217
usr.sbin/iostat/iostat.c: revision 1.65
Use I/O timestamps to compute disk statistics for better precision.
Disk statistics are collected in a fixed size array, that got corrupted
when a disk was detached. Adapt by skipping entries of detached disks
and detect reused disknames at the array end.
--
Use I/O timestamps to compute disk statistics for better precisison.
 1.82.6.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.82.6.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.82.6.1 10-Jun-2019  christos Sync with HEAD
 1.82.4.3 26-Jan-2019  pgoyette Sync with HEAD
 1.82.4.2 18-Jan-2019  pgoyette Synch with HEAD
 1.82.4.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.82.2.2 15-Jul-2017  mlelstv 3327190
 1.82.2.1 15-Jul-2017  mlelstv file vmstat.c was added on branch perseant-stdc-iso10646 on 2017-07-15 08:22:24 +0000
 1.87.2.1 11-Dec-2023  martin Pull up following revision(s) (requested by kre in ticket #1777):

usr.bin/systat/vmstat.c: revision 1.92

PR bin/56014 from Kouichi Hashikawa

Don't try to optimise away placing the "s" or " " after "N user"
(" " where N==1, "s" otherwise) when it seems unnecessary, as that
fails when the number of users hasn't changed, but the screen is
being redrawn from nothing (as in after being resumed from a ^Z,
as in the PR, but just doing a ^L would make the same thing happen).
 1.91.2.1 10-Dec-2023  martin Pull up following revision(s) (requested by kre in ticket #489):

usr.bin/systat/vmstat.c: revision 1.92

PR bin/56014 from Kouichi Hashikawa

Don't try to optimise away placing the "s" or " " after "N user"
(" " where N==1, "s" otherwise) when it seems unnecessary, as that
fails when the number of users hasn't changed, but the screen is
being redrawn from nothing (as in after being resumed from a ^Z,
as in the PR, but just doing a ^L would make the same thing happen).
 1.2 30-Jun-2019  he Make the scaling of the "bytes written" sticky, so that if we go
to K, we don't return to unscaled, and similar for higher scales
(though it takes some effort, due to the wide field...)
Fixes PR#54334.
 1.1 18-Mar-2006  dsl branches: 1.1.86;
Make the functions that display the top 8 lines externally visible so
they can be used to head other pages (not ready to commit yet...).
Use puthumanint() for oversize numbers when display_mode is RUN or BOOT (when
very big numbers are to be expected).
Allow an extra column for Csw..Flt.
Adjust some #defines to avoid use of global s & s1.
 1.1.86.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed