summaryrefslogtreecommitdiff
path: root/usr.bin/systat/iostat.c
diff options
context:
space:
mode:
authorkstailey <kstailey@cvs.openbsd.org>1997-02-04 04:42:43 +0000
committerkstailey <kstailey@cvs.openbsd.org>1997-02-04 04:42:43 +0000
commit7aa026ea7fbc9ff167581f8646360a7123d87f2d (patch)
tree9ca0710657b297a862579f4549cf3c275caf40fe /usr.bin/systat/iostat.c
parentf0665df2b87465f110f0e0b56b1bd5bc90c6540a (diff)
display CPU stats on iostat screen even if diskless
Diffstat (limited to 'usr.bin/systat/iostat.c')
-rw-r--r--usr.bin/systat/iostat.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c
index 019ab5fd653..3ce96c7bd35 100644
--- a/usr.bin/systat/iostat.c
+++ b/usr.bin/systat/iostat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iostat.c,v 1.6 1997/01/06 18:50:50 maja Exp $ */
+/* $OpenBSD: iostat.c,v 1.7 1997/02/04 04:42:42 kstailey Exp $ */
/* $NetBSD: iostat.c,v 1.5 1996/05/10 23:16:35 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: iostat.c,v 1.6 1997/01/06 18:50:50 maja Exp $";
+static char rcsid[] = "$OpenBSD: iostat.c,v 1.7 1997/02/04 04:42:42 kstailey Exp $";
#endif not lint
#include <sys/param.h>
@@ -107,10 +107,6 @@ labeliostat()
{
int row;
- if (dk_ndrive == 0) {
- error("No drives defined.");
- return;
- }
row = 0;
wmove(wnd, row, 0); wclrtobot(wnd);
mvwaddstr(wnd, row++, INSET,
@@ -132,6 +128,10 @@ numlabels(row)
{
int i, col, regions, ndrives;
+ if (dk_ndrive == 0) {
+ mvwaddstr(wnd, row++, INSET, "No drives attached.");
+ return (row);
+ }
#define COLWIDTH 14
#define DRIVESPERLINE ((wnd->_maxx - INSET) / COLWIDTH)
for (ndrives = 0, i = 0; i < dk_ndrive; i++)
@@ -171,6 +171,10 @@ barlabels(row)
{
int i;
+ if (dk_ndrive == 0) {
+ mvwaddstr(wnd, row++, INSET, "No drives attached.");
+ return (row);
+ }
mvwaddstr(wnd, row++, INSET,
"/0 /10 /20 /30 /40 /50 /60 /70 /80 /90 /100");
linesperregion = 2 + secs;
@@ -193,8 +197,6 @@ showiostat()
register u_int64_t t;
register int i, row, col;
- if (dk_ndrive == 0)
- return;
dkswap();
etime = 0;
@@ -211,6 +213,10 @@ showiostat()
*/
for (i = 0; i < CPUSTATES; i++)
stat1(row++, i);
+
+ if (dk_ndrive == 0)
+ return;
+
if (!numbers) {
row += 2;
for (i = 0; i < dk_ndrive; i++)