Bryan Linton wrote:
> Hello tech@,
>
> I'd appreciate it if someone could review both this patch and my
> analysis.
There is no reason for etime to be a global. We can make it a local with the
correct value in the two functions that use it, avoiding future problems as
well.
Index: vmstat.c
===================================================================
RCS file: /cvs/src/usr.bin/systat/vmstat.c,v
retrieving revision 1.89
diff -u -p -r1.89 vmstat.c
--- vmstat.c 17 Nov 2018 23:10:08 -0000 1.89
+++ vmstat.c 19 Jan 2019 21:06:38 -0000
@@ -97,7 +97,6 @@ int select_vm(void);
int vm_keyboard_callback(int);
static time_t t;
-static double etime;
static float hertz;
static int nintr;
static long *intrloc;
@@ -336,6 +335,7 @@ showkre(void)
u_int64_t inttotal, intcnt;
int i, l, c;
static int failcnt = 0, first_run = 0;
+ double etime;
if (state == TIME) {
if (!first_run) {
@@ -676,7 +676,9 @@ copyinfo(struct Info *from, struct Info
static void
dinfo(int dn, int c)
{
- double words, atime;
+ double words, atime, etime;
+
+ etime = naptime;
c += DISKCOL;