Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/usr.bin/systat Pull up following revision(s) (requested b...
details: https://anonhg.NetBSD.org/src/rev/3c3f67059fd3
branches: netbsd-8
changeset: 448006:3c3f67059fd3
user: martin <martin%NetBSD.org@localhost>
date: Wed Jan 30 13:46:25 2019 +0000
description:
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)
diffstat:
usr.bin/systat/extern.h | 7 ++++++-
usr.bin/systat/iostat.c | 5 ++---
usr.bin/systat/main.c | 35 ++++++++++++++++++++++++++++++++---
usr.bin/systat/syscall.c | 23 +++--------------------
usr.bin/systat/vmstat.c | 23 +++--------------------
5 files changed, 46 insertions(+), 47 deletions(-)
diffs (271 lines):
diff -r f9946a81df2d -r 3c3f67059fd3 usr.bin/systat/extern.h
--- a/usr.bin/systat/extern.h Tue Jan 29 08:29:52 2019 +0000
+++ b/usr.bin/systat/extern.h Wed Jan 30 13:46:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.46 2016/10/22 22:02:55 christos Exp $ */
+/* $NetBSD: extern.h,v 1.46.6.1 2019/01/30 13:46:25 martin Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -33,10 +33,12 @@
#include <sys/cdefs.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <kvm.h>
#define ADJINETCTR(c, o, n, e) (c.e = n.e - o.e)
#define xADJINETCTR(c, o, n, e) (c[e] = n[e] - o[e])
+#define MAXFAIL 5
extern struct command global_commands[];
extern struct mode *curmode;
@@ -60,6 +62,8 @@
extern int allflag;
extern int turns;
extern gid_t egid;
+extern float hertz;
+extern double etime;
struct inpcb;
#ifdef INET6
@@ -210,6 +214,7 @@
void tcp_run(char *);
void tcp_time(char *);
void tcp_zero(char *);
+bool toofast(int *);
void vmstat_boot(char *);
void vmstat_run(char *);
void vmstat_time(char *);
diff -r f9946a81df2d -r 3c3f67059fd3 usr.bin/systat/iostat.c
--- a/usr.bin/systat/iostat.c Tue Jan 29 08:29:52 2019 +0000
+++ b/usr.bin/systat/iostat.c Wed Jan 30 13:46:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iostat.c,v 1.37.38.1 2017/07/25 01:43:37 snj Exp $ */
+/* $NetBSD: iostat.c,v 1.37.38.2 2019/01/30 13:46:25 martin Exp $ */
/*
* Copyright (c) 1980, 1992, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: iostat.c,v 1.37.38.1 2017/07/25 01:43:37 snj Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.37.38.2 2019/01/30 13:46:25 martin Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -46,7 +46,6 @@
#include "drvstats.h"
static int linesperregion;
-static double etime;
static int numbers = 0; /* default display bar graphs */
static int secs = 0; /* default seconds shown */
static int read_write = 0; /* default read/write shown */
diff -r f9946a81df2d -r 3c3f67059fd3 usr.bin/systat/main.c
--- a/usr.bin/systat/main.c Tue Jan 29 08:29:52 2019 +0000
+++ b/usr.bin/systat/main.c Wed Jan 30 13:46:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.51 2016/12/03 03:26:27 mrg Exp $ */
+/* $NetBSD: main.c,v 1.51.6.1 2019/01/30 13:46:25 martin Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: main.c,v 1.51 2016/12/03 03:26:27 mrg Exp $");
+__RCSID("$NetBSD: main.c,v 1.51.6.1 2019/01/30 13:46:25 martin Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -57,6 +57,7 @@
#include "systat.h"
#include "extern.h"
+#include "drvstats.h"
static int dellave;
@@ -78,6 +79,8 @@
int allflag;
int allcounter;
sig_atomic_t needsredraw = 0;
+float hertz;
+double etime;
static WINDOW *wload; /* one line window for load average */
@@ -329,7 +332,6 @@
void
redraw(void)
{
- resizeterm(LINES, COLS);
CMDLINE = LINES - 1;
labels();
@@ -415,3 +417,30 @@
endwin();
exit(1);
}
+
+bool
+toofast(int *failcnt)
+{
+ static char pigs[] = "pigs";
+ etime = cur.cp_etime;
+ /* < 1 ticks - sleep for a tick */
+ /* this is often triggered by repeated SIGWINCH */
+ if ((etime * hertz) >= 1.0)
+ return false;
+
+ if ((*failcnt)++ <= MAXFAIL) {
+ struct timespec interval = { 0, 1000000000L / hertz };
+ while (nanosleep(&interval, &interval) == -1)
+ continue;
+ return true;
+ }
+ clear();
+ mvprintw(2, 10, "The alternate system clock has died!");
+ mvprintw(3, 10, "Reverting to ``pigs'' display.");
+ move(CMDLINE, 0);
+ refresh();
+ failcnt = 0;
+ sleep(5);
+ command(pigs);
+ return true;
+}
diff -r f9946a81df2d -r 3c3f67059fd3 usr.bin/systat/syscall.c
--- a/usr.bin/systat/syscall.c Tue Jan 29 08:29:52 2019 +0000
+++ b/usr.bin/systat/syscall.c Wed Jan 30 13:46:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.9 2014/02/19 20:42:14 dsl Exp $ */
+/* $NetBSD: syscall.c,v 1.9.18.1 2019/01/30 13:46:25 martin Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: syscall.c,v 1.9 2014/02/19 20:42:14 dsl Exp $");
+__RCSID("$NetBSD: syscall.c,v 1.9.18.1 2019/01/30 13:46:25 martin Exp $");
/* System call stats */
@@ -75,7 +75,6 @@
static void getinfo(struct Info *, int);
static char buf[32];
-static float hertz;
static size_t counts_mib_len, times_mib_len;
static int counts_mib[4], times_mib[4];
@@ -146,8 +145,6 @@
labelvmstat_top();
}
-#define MAXFAIL 5
-
static void
putuint64(uint64_t v, int row, int col, int width)
{
@@ -186,7 +183,6 @@
uint64_t v;
static int failcnt = 0;
static int relabel = 0;
- static char pigs[] = "pigs";
uint64_t itime;
if (relabel) {
@@ -196,21 +192,8 @@
cpuswap();
if (display_mode == TIME) {
- etime = cur.cp_etime;
- /* < 5 ticks - ignore this trash */
- if ((etime * hertz) < 1.0) {
- if (failcnt++ <= MAXFAIL)
- return;
- clear();
- mvprintw(2, 10, "The alternate system clock has died!");
- mvprintw(3, 10, "Reverting to ``pigs'' display.");
- move(CMDLINE, 0);
- refresh();
- failcnt = 0;
- sleep(5);
- command(pigs);
+ if (toofast(&failcnt))
return;
- }
} else
etime = 1.0;
itime = etime * 100;
diff -r f9946a81df2d -r 3c3f67059fd3 usr.bin/systat/vmstat.c
--- a/usr.bin/systat/vmstat.c Tue Jan 29 08:29:52 2019 +0000
+++ b/usr.bin/systat/vmstat.c Wed Jan 30 13:46:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.81.8.1 2017/07/25 01:43:37 snj Exp $ */
+/* $NetBSD: vmstat.c,v 1.81.8.2 2019/01/30 13:46:25 martin Exp $ */
/*-
* Copyright (c) 1983, 1989, 1992, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
#endif
-__RCSID("$NetBSD: vmstat.c,v 1.81.8.1 2017/07/25 01:43:37 snj Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.81.8.2 2019/01/30 13:46:25 martin Exp $");
#endif /* not lint */
/*
@@ -80,8 +80,6 @@
static char buf[26];
static u_int64_t temp;
-double etime;
-static float hertz;
static int nintr;
static long *intrloc;
static char **intrname;
@@ -412,7 +410,6 @@
{temp = (s).fld; (s).fld -= (s1).fld; \
if (display_mode == TIME) (s1).fld = temp; \
putint((int)((float)(s).fld/etime + 0.5), l, c, w);}
-#define MAXFAIL 5
static char cpuchar[CPUSTATES] = { '=' , '>', '-', '%', ' ' };
static char cpuorder[CPUSTATES] = { CP_SYS, CP_USER, CP_NICE, CP_INTR, CP_IDLE };
@@ -475,7 +472,6 @@
static int failcnt = 0;
static int relabel = 0;
static int last_disks = 0;
- static char pigs[] = "pigs";
if (relabel) {
labelvmstat();
@@ -485,21 +481,8 @@
cpuswap();
if (display_mode == TIME) {
drvswap();
- etime = cur.cp_etime;
- /* < 5 ticks - ignore this trash */
- if ((etime * hertz) < 1.0) {
- if (failcnt++ <= MAXFAIL)
- return;
- clear();
- mvprintw(2, 10, "The alternate system clock has died!");
- mvprintw(3, 10, "Reverting to ``pigs'' display.");
- move(CMDLINE, 0);
- refresh();
- failcnt = 0;
- sleep(5);
- command(pigs);
+ if (toofast(&failcnt))
return;
- }
} else
etime = 1.0;
Home |
Main Index |
Thread Index |
Old Index