NetBSD Problem Report #36999
From dieter@bsdusr.net Mon Sep 17 15:24:22 2007
Return-Path: <dieter@bsdusr.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 448A263B8E9
for <gnats-bugs@gnats.NetBSD.org>; Mon, 17 Sep 2007 15:24:22 +0000 (UTC)
Message-Id: <20070917152417.4CE751A5B3@mail.bsdusr.net>
Date: Mon, 17 Sep 2007 15:24:17 +0000 (UTC)
From: dieter.NetBSD@pandora.be
To: gnats-bugs@NetBSD.org
Subject: systat refresh interval is limited
X-Send-Pr-Version: 3.95
>Number: 36999
>Category: bin
>Synopsis: systat refresh interval is limited
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 17 15:25:01 +0000 2007
>Closed-Date: Wed Nov 04 21:46:56 +0000 2009
>Last-Modified: Wed Nov 04 21:50:01 +0000 2009
>Originator: Dieter Roelants
>Release: NetBSD 4.0_RC1
>Organization:
>Environment:
System: NetBSD bsdusr.net 4.0_RC1 NetBSD 4.0_RC1 (BSDUSR2) #1: Mon Sep 3 12:04:19 CEST 2007 dieter@simult.amelgem.be:/build/obj.amd64.4/sys/arch/amd64/compile/BSDUSR2 amd64
Architecture: x86_64
Machine: amd64
>Description:
systat(1)s refresh interval can be set, but not to a higher
value than 25 seconds. When a higher number n is typed in,
it will say 'refresh every n seconds', but instead will
refresh every 25.5 seconds. This is because the curses
function timeout(3) is limited to 25500 seconds. I haven't
tried finding out why this is the case.
>How-To-Repeat:
systat vmstat 30
Look at the clock in the upper right corner and see it
being updated every 25 seconds. Press ^g to see systat lie
to you.
>Fix:
Following patch divides the wanted interval in chunks of 25 seconds
+ rest and refreshes after all have passed. Since I don't know the
reason for the limit in ncurses, maybe a better fix is to change
it there.
Index: extern.h
===================================================================
RCS file: /cvsroot/src/usr.bin/systat/extern.h,v
retrieving revision 1.37
diff -p -u -r1.37 extern.h
--- extern.h 18 Feb 2007 17:00:08 -0000 1.37
+++ extern.h 9 Sep 2007 19:33:09 -0000
@@ -49,7 +49,7 @@ extern kvm_t *kd;
extern long ntext, textp;
extern int CMDLINE;
extern int hz, stathz, maxslp;
-extern int naptime;
+extern int naptime, napcycles;
extern int nhosts;
extern int nports;
extern int protos;
@@ -153,6 +153,7 @@ void labels(void);
void labelswap(void);
void labeltcp(void);
void labeltcpsyn(void);
+void nap(void);
void netstat_all(char *);
void netstat_display(char *);
void netstat_ignore(char *);
Index: keyboard.c
===================================================================
RCS file: /cvsroot/src/usr.bin/systat/keyboard.c,v
retrieving revision 1.23
diff -p -u -r1.23 keyboard.c
--- keyboard.c 10 May 2006 21:53:48 -0000 1.23
+++ keyboard.c 9 Sep 2007 19:33:09 -0000
@@ -72,7 +72,10 @@ keyboard(void)
refresh();
ch = getch();
if (ch == ERR) {
- display(SIGALRM);
+ if (napcycles)
+ nap();
+ else
+ display(SIGALRM);
continue;
}
if (ch == KEY_RESIZE) {
Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/systat/main.c,v
retrieving revision 1.40
diff -p -u -r1.40 main.c
--- main.c 22 Oct 2006 16:43:24 -0000 1.40
+++ main.c 9 Sep 2007 19:33:09 -0000
@@ -75,6 +75,7 @@ sig_t sigtstpdfl;
double avenrun[3];
int col;
int naptime = 5;
+int napcycles = 0;
int verbose = 1; /* to report kvm read errs */
int hz, stathz, maxslp;
char c;
@@ -303,9 +304,21 @@ display(int signo)
allcounter=0;
} else
allcounter++;
- }
+ }
+
+ nap();
+}
- timeout(naptime * 1000);
+void
+nap(void)
+{
+ if (napcycles) {
+ napcycles--;
+ timeout(25 * 1000);
+ } else {
+ napcycles = naptime / 25;
+ timeout(naptime % 25 * 1000);
+ }
}
void
>Release-Note:
>Audit-Trail:
From: Julian Coleman <jdc@coris.org.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/36999: systat refresh interval is limited
Date: Thu, 20 Sep 2007 14:40:42 +0100
> This is because the curses
> function timeout(3) is limited to 25500 seconds. I haven't
> tried finding out why this is the case.
If you look at src/lib/libcurses/timeout.c:wtimeout(), this is because we
use VTIME, which is an 8-bit value (0-255) with a granularity of 0.1s. We
should probably look at making the libcurses code handle timeouts of more
than 25.5s.
J
--
My other computer also runs NetBSD / Sailing at Newbiggin
http://www.netbsd.org/ / http://www.newbigginsailingclub.org/
State-Changed-From-To: open->closed
State-Changed-By: dsl@NetBSD.org
State-Changed-When: Wed, 04 Nov 2009 21:46:56 +0000
State-Changed-Why:
Fix similar to that proposed has been applied.
From: David Laight <dsl@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/36999 CVS commit: src/usr.bin/systat
Date: Wed, 4 Nov 2009 21:46:24 +0000
Module Name: src
Committed By: dsl
Date: Wed Nov 4 21:46:24 UTC 2009
Modified Files:
src/usr.bin/systat: main.c
Log Message:
Allow display intervals > 25 seconds.
Fixes PR/36999
I did contemplate chaging curses - but the code is replicated and warped.
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/systat/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.