Home | History | Annotate | Download | only in systat
History log of /src/usr.bin/systat/main.c
RevisionDateAuthorComments
 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

RSS XML Feed