CVS commit: src/usr.sbin/iostat

2018-07-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul 29 21:17:43 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.8

Log Message:
Fix mandoc warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/iostat/iostat.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.26 src/usr.sbin/iostat/iostat.8:1.27
--- src/usr.sbin/iostat/iostat.8:1.26	Sun Jul 29 17:03:02 2018
+++ src/usr.sbin/iostat/iostat.8	Sun Jul 29 21:17:43 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.26 2018/07/29 17:03:02 sevan Exp $
+.\"	$NetBSD: iostat.8,v 1.27 2018/07/29 21:17:43 wiz Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -34,9 +34,7 @@
 .Os
 .Sh NAME
 .Nm iostat
-.Nd report
-.Tn I/O
-statistics
+.Nd report I/O statistics
 .Sh SYNOPSIS
 .Nm
 .Op Fl CdDITxy
@@ -45,9 +43,7 @@ statistics
 .Op Ar drives
 .Sh DESCRIPTION
 .Nm
-displays kernel
-.Tn I/O
-statistics on terminal, disk and CPU operations.
+displays kernel I/O statistics on terminal, disk and CPU operations.
 By default,
 .Nm
 displays one line of statistics averaged over the machine's run time.
@@ -162,7 +158,6 @@ Kilobytes transferred per disk transfer
 transfers per second
 .It MB/s
 Megabytes transferred per second
-.Pp
 .El
 The alternative display format, (selected with
 .Fl D ) ,
@@ -174,7 +169,6 @@ Kilobytes transferred
 Disk transfers
 .It time
 Seconds spent in disk activity
-.Pp
 .El
 With the
 .Fl y



CVS commit: src/usr.sbin/iostat

2018-07-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Jul 29 17:03:02 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.8

Log Message:
Document "in" field in CPU section
Fix ps(1) Xr raised by mandoc -Tlint


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/iostat/iostat.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.25 src/usr.sbin/iostat/iostat.8:1.26
--- src/usr.sbin/iostat/iostat.8:1.25	Sun Mar  5 23:07:12 2017
+++ src/usr.sbin/iostat/iostat.8	Sun Jul 29 17:03:02 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.25 2017/03/05 23:07:12 mlelstv Exp $
+.\"	$NetBSD: iostat.8,v 1.26 2018/07/29 17:03:02 sevan Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd July 9, 2015
+.Dd July 29, 2018
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -201,6 +201,8 @@ and is then shown as zeros.
 % of CPU time in user mode running niced processes
 .It \&sy
 % of CPU time in system mode
+.It \&in
+% of CPU time in interrupt mode
 .It \&id
 % of CPU time in idle mode
 .El
@@ -209,7 +211,7 @@ and is then shown as zeros.
 .Xr fstat 1 ,
 .Xr netstat 1 ,
 .Xr nfsstat 1 ,
-.Xr \&ps 1 ,
+.Xr ps 1 ,
 .Xr systat 1 ,
 .Xr vmstat 1 ,
 .Xr fnmatch 3 ,



CVS commit: src/usr.sbin/iostat

2018-04-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr  8 11:37:31 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Re-evaluate drive selection to catch hog-plug devices.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.66 src/usr.sbin/iostat/iostat.c:1.67
--- src/usr.sbin/iostat/iostat.c:1.66	Sat Sep  9 23:51:58 2017
+++ src/usr.sbin/iostat/iostat.c	Sun Apr  8 11:37:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -210,14 +210,6 @@ main(int argc, char *argv[])
 		if (todo == 0)
 			errx(1, "no drives");
 	}
-	if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
-		lines = ndrives;
-		hdroffset = 3;
-	} else {
-		lines = 1;
-		hdroffset = 4;
-	}
-
 	tv.tv_sec = interval;
 	tv.tv_nsec = 0;
 
@@ -225,6 +217,14 @@ main(int argc, char *argv[])
 	(void)signal(SIGCONT, sig_header);
 
 	for (hdrcnt = 1;;) {
+		if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
+			lines = ndrives;
+			hdroffset = 3;
+		} else {
+			lines = 1;
+			hdroffset = 4;
+		}
+
 		if (do_header || (hdrcnt -= lines) <= 0) {
 			do_header = 0;
 			header();
@@ -244,6 +244,8 @@ main(int argc, char *argv[])
 		nanosleep(&tv, NULL);
 		cpureadstats();
 		drvreadstats();
+
+		ndrives = selectdrives(argc, argv);
 	}
 	exit(0);
 }



CVS commit: src/usr.sbin/iostat

2017-09-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Sep  9 23:51:58 UTC 2017

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
two minor fixes for -x and -y mode:
- the header is only 1 line not 2, account for this when calculating
  when to display the next header.
- when ndrives > 1, don't display the header every time, but only when
  the previous one disappears.

now i don't feel the need to run "iostat -x wd0 1 & iostat -c wd1 1"
to get less repeated header output on my display.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.65 src/usr.sbin/iostat/iostat.c:1.66
--- src/usr.sbin/iostat/iostat.c:1.65	Tue Jul  4 21:19:33 2017
+++ src/usr.sbin/iostat/iostat.c	Sat Sep  9 23:51:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.65 2017/07/04 21:19:33 mlelstv Exp $	*/
+/*	$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.65 2017/07/04 21:19:33 mlelstv Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -129,7 +129,7 @@ static int selectdrives(int, char *[]);
 int
 main(int argc, char *argv[])
 {
-	int ch, hdrcnt, ndrives, lines;
+	int ch, hdrcnt, hdroffset, ndrives, lines;
 	struct timespec	tv;
 	struct ttysize ts;
 
@@ -210,10 +210,13 @@ main(int argc, char *argv[])
 		if (todo == 0)
 			errx(1, "no drives");
 	}
-	if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y))
+	if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
 		lines = ndrives;
-	else
+		hdroffset = 3;
+	} else {
 		lines = 1;
+		hdroffset = 4;
+	}
 
 	tv.tv_sec = interval;
 	tv.tv_nsec = 0;
@@ -222,10 +225,10 @@ main(int argc, char *argv[])
 	(void)signal(SIGCONT, sig_header);
 
 	for (hdrcnt = 1;;) {
-		if (do_header || lines > 1 || (hdrcnt -= lines) <= 0) {
+		if (do_header || (hdrcnt -= lines) <= 0) {
 			do_header = 0;
 			header();
-			hdrcnt = winlines - 4;
+			hdrcnt = winlines - hdroffset;
 		}
 
 		if (!ISSET(todo, SHOW_TOTALS)) {



CVS commit: src/usr.sbin/iostat

2015-10-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Oct 25 02:47:17 UTC 2015

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
extend the "tout" column to 5 characters, it's really common on a modern
machine to have eg, build output way more than  chars/sec.

this doesn't affect the default disk list on an 80-char wide screen.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.62 src/usr.sbin/iostat/iostat.c:1.63
--- src/usr.sbin/iostat/iostat.c:1.62	Thu Jul  9 13:26:52 2015
+++ src/usr.sbin/iostat/iostat.c	Sun Oct 25 02:47:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.63 2015/10/25 02:47:17 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.63 2015/10/25 02:47:17 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -184,7 +184,7 @@ main(int argc, char *argv[])
 	if (ISSET(todo, SHOW_CPU))
 		defdrives -= 16;	/* XXX magic number */
 	if (ISSET(todo, SHOW_TTY))
-		defdrives -= 9;		/* XXX magic number */
+		defdrives -= 10;	/* XXX magic number */
 	defdrives /= 18;		/* XXX magic number */
 
 	drvinit(0);
@@ -279,7 +279,7 @@ header(void)
 
 	/* Sub-Headers. */
 	if (ISSET(todo, SHOW_TTY))
-		printf(" tin tout");
+		printf(" tin  tout");
 
 	if (ISSET(todo, SHOW_STATS_1)) {
 		for (i = 0; i < ndrive; i++)
@@ -468,7 +468,7 @@ display(void)
 	}
 
 	if (ISSET(todo, SHOW_TTY))
-		printf("%4.0f %4.0f", cur.tk_nin / etime, cur.tk_nout / etime);
+		printf("%4.0f %5.0f", cur.tk_nin / etime, cur.tk_nout / etime);
 
 	if (ISSET(todo, SHOW_STATS_1)) {
 		drive_stats(etime);



CVS commit: src/usr.sbin/iostat

2015-07-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Jul  9 13:26:52 UTC 2015

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
support fnmatch(3) patterns for disknames.  eg, "iostat wd*" works now.
update the default disk number selection to note that it uses the current
terminal size to fit disks, not hard coded 4.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.23 src/usr.sbin/iostat/iostat.8:1.24
--- src/usr.sbin/iostat/iostat.8:1.23	Wed Jun 11 17:01:04 2014
+++ src/usr.sbin/iostat/iostat.8	Thu Jul  9 13:26:52 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.23 2014/06/11 17:01:04 joerg Exp $
+.\"	$NetBSD: iostat.8,v 1.24 2015/07/09 13:26:52 mrg Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd June 11, 2014
+.Dd July 9, 2015
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -142,13 +142,16 @@ characters written to terminals
 .It disks
 Disk operations.
 The header of the field is the disk name and unit number.
-If more than four disk drives are configured in the system,
+If more drives are configured in the system that fit across the
+current display,
 .Nm
-displays only the first four drives.
+displays only those drives that fit on the display.
 To force
 .Nm
-to display specific drives, their names may be supplied on the command
-line.
+to display specific drives, they may be supplied on the command
+line, either as names or
+.Fn fnmatch
+patterns.
 .Pp
 .Bl -tag -width indent -compact
 .It KB/t
@@ -189,6 +192,7 @@ Seconds spent in disk activity
 .Xr \&ps 1 ,
 .Xr systat 1 ,
 .Xr vmstat 1 ,
+.Xr fnmatch 3 ,
 .Xr pstat 8
 .Pp
 The sections starting with ``Interpreting system activity'' in

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.61 src/usr.sbin/iostat/iostat.c:1.62
--- src/usr.sbin/iostat/iostat.c:1.61	Wed Jun 11 17:01:04 2014
+++ src/usr.sbin/iostat/iostat.c	Thu Jul  9 13:26:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -88,6 +88,7 @@ __RCSID("$NetBSD: iostat.c,v 1.61 2014/0
 #include 
 #include 
 #include 
+#include 
 
 #include "drvstats.h"
 
@@ -511,7 +512,7 @@ selectdrives(int argc, char *argv[])
 #endif
 		tried++;
 		for (i = 0; i < (int)ndrive; i++) {
-			if (strcmp(cur.name[i], *argv))
+			if (fnmatch(*argv, cur.name[i], 0))
 continue;
 			cur.select[i] = 1;
 			++ndrives;



CVS commit: src/usr.sbin/iostat

2014-06-11 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jun 11 17:01:04 UTC 2014

Modified Files:
src/usr.sbin/iostat: Makefile iostat.8 iostat.c

Log Message:
Remove KVM related options.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/iostat/Makefile
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/Makefile
diff -u src/usr.sbin/iostat/Makefile:1.24 src/usr.sbin/iostat/Makefile:1.25
--- src/usr.sbin/iostat/Makefile:1.24	Fri Jan  7 03:12:27 2011
+++ src/usr.sbin/iostat/Makefile	Wed Jun 11 17:01:04 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.24 2011/01/07 03:12:27 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.25 2014/06/11 17:01:04 joerg Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include 
@@ -13,7 +13,7 @@ CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin/vmst
 # drvstats.c pulled in from ../../usr.bin/vmstat
 SRCS=	drvstats.c iostat.c
 
-DPADD=	${LIBKVM} ${LIBM}
-LDADD=	-lkvm -lm
+DPADD=	${LIBM}
+LDADD=	-lm
 
 .include 

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.22 src/usr.sbin/iostat/iostat.8:1.23
--- src/usr.sbin/iostat/iostat.8:1.22	Thu Aug  7 11:25:22 2003
+++ src/usr.sbin/iostat/iostat.8	Wed Jun 11 17:01:04 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.22 2003/08/07 11:25:22 agc Exp $
+.\"	$NetBSD: iostat.8,v 1.23 2014/06/11 17:01:04 joerg Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd March 1, 2003
+.Dd June 11, 2014
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -41,8 +41,6 @@ statistics
 .Nm
 .Op Fl CdDITx
 .Op Fl c Ar count
-.Op Fl M Ar core
-.Op Fl N Ar system
 .Op Fl w Ar wait
 .Op Ar drives
 .Sh DESCRIPTION
@@ -106,13 +104,6 @@ transfers, and time spent in transfers.
 Use of this flag disables the default display.
 .It Fl I
 Show the running total values, rather than an average.
-.It Fl M Ar core
-Extract values associated with the name list from the specified core
-instead of the default
-.Dq Pa /dev/mem .
-.It Fl N Ar system
-Extract the name list from the specified system instead of the default
-.Dq Pa /netbsd .
 .It Fl T
 Show tty statistics.
 This is enabled by default unless the
@@ -191,13 +182,6 @@ Seconds spent in disk activity
 % of CPU time in idle mode
 .El
 .El
-.Sh FILES
-.Bl -tag -width /dev/mem -compact
-.It Pa /netbsd
-Default kernel namelist.
-.It Pa /dev/mem
-Default memory file.
-.El
 .Sh SEE ALSO
 .Xr fstat 1 ,
 .Xr netstat 1 ,

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.60 src/usr.sbin/iostat/iostat.c:1.61
--- src/usr.sbin/iostat/iostat.c:1.60	Tue Aug 30 19:06:06 2011
+++ src/usr.sbin/iostat/iostat.c	Wed Jun 11 17:01:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.60 2011/08/30 19:06:06 joerg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.60 2011/08/30 19:06:06 joerg Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -91,9 +91,6 @@ __RCSID("$NetBSD: iostat.c,v 1.60 2011/0
 
 #include "drvstats.h"
 
-/* Namelist and memory files. */
-char	*nlistf, *memf;
-
 int		hz;
 static int	reps, interval;
 static int	todo = 0;
@@ -130,7 +127,7 @@ main(int argc, char *argv[])
 	struct timespec	tv;
 	struct ttysize ts;
 
-	while ((ch = getopt(argc, argv, "Cc:dDIM:N:Tw:x")) != -1)
+	while ((ch = getopt(argc, argv, "Cc:dDITw:x")) != -1)
 		switch (ch) {
 		case 'c':
 			if ((reps = atoi(optarg)) <= 0)
@@ -150,12 +147,6 @@ main(int argc, char *argv[])
 		case 'I':
 			todo |= SHOW_TOTALS;
 			break;
-		case 'M':
-			memf = optarg;
-			break;
-		case 'N':
-			nlistf = optarg;
-			break;
 		case 'T':
 			todo |= SHOW_TTY;
 			break;
@@ -450,8 +441,8 @@ static void
 usage(void)
 {
 
-	(void)fprintf(stderr, "usage: iostat [-CdDITx] [-c count] [-M core] "
-	"[-N system] [-w wait] [drives]\n");
+	(void)fprintf(stderr, "usage: iostat [-CdDITx] [-c count] "
+	"[-w wait] [drives]\n");
 	exit(1);
 }
 



CVS commit: src/usr.sbin/iostat

2011-08-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Aug 30 19:06:06 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.59 src/usr.sbin/iostat/iostat.c:1.60
--- src/usr.sbin/iostat/iostat.c:1.59	Mon Feb 14 02:43:37 2011
+++ src/usr.sbin/iostat/iostat.c	Tue Aug 30 19:06:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.59 2011/02/14 02:43:37 enami Exp $	*/
+/*	$NetBSD: iostat.c,v 1.60 2011/08/30 19:06:06 joerg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.59 2011/02/14 02:43:37 enami Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.60 2011/08/30 19:06:06 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -94,7 +94,8 @@
 /* Namelist and memory files. */
 char	*nlistf, *memf;
 
-int		hz, reps, interval;
+int		hz;
+static int	reps, interval;
 static int	todo = 0;
 static int	defdrives;
 static int	winlines = 20;
@@ -118,12 +119,10 @@
 static void sig_header(int);
 static volatile int do_header;
 static void header(void);
-static void usage(void);
+__dead static void usage(void);
 static void display(void);
 static int selectdrives(int, char *[]);
 
-int main(int, char *[]);
-
 int
 main(int argc, char *argv[])
 {
@@ -248,7 +247,7 @@
 }
 
 static void
-header()
+header(void)
 {
 	size_t i;
 



CVS commit: src/usr.sbin/iostat

2011-02-13 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Mon Feb 14 02:43:37 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
A number greater than or equal to 1.0 is a positive number.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.58 src/usr.sbin/iostat/iostat.c:1.59
--- src/usr.sbin/iostat/iostat.c:1.58	Mon Feb 14 02:42:26 2011
+++ src/usr.sbin/iostat/iostat.c	Mon Feb 14 02:43:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.58 2011/02/14 02:42:26 enami Exp $	*/
+/*	$NetBSD: iostat.c,v 1.59 2011/02/14 02:43:37 enami Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.58 2011/02/14 02:42:26 enami Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.59 2011/02/14 02:43:37 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -327,7 +327,7 @@
 		else
 			mbps = 0.0;
 		(void)printf(" %5.*f",
-		MAX(0, 3 - (int)floor(log10(fabs(fmax(1.0, mbps), mbps);
+		MAX(0, 3 - (int)floor(log10(fmax(1.0, mbps, mbps);
 
 	/* average transfers per second. */
 		(void)printf(" %4.0f",
@@ -345,7 +345,7 @@
 			mbps = 0;
 		mbps /= etime;
 		(void)printf(" %5.*f ",
-		MAX(0, 3 - (int)floor(log10(fabs(fmax(1.0, mbps), mbps);
+		MAX(0, 3 - (int)floor(log10(fmax(1.0, mbps, mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-02-13 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Mon Feb 14 02:42:26 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Put space after comma and around binary operator.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.57 src/usr.sbin/iostat/iostat.c:1.58
--- src/usr.sbin/iostat/iostat.c:1.57	Sun Jan  9 03:35:23 2011
+++ src/usr.sbin/iostat/iostat.c	Mon Feb 14 02:42:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.57 2011/01/09 03:35:23 jakllsch Exp $	*/
+/*	$NetBSD: iostat.c,v 1.58 2011/02/14 02:42:26 enami Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.57 2011/01/09 03:35:23 jakllsch Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.58 2011/02/14 02:42:26 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -327,7 +327,7 @@
 		else
 			mbps = 0.0;
 		(void)printf(" %5.*f",
-		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
+		MAX(0, 3 - (int)floor(log10(fabs(fmax(1.0, mbps), mbps);
 
 	/* average transfers per second. */
 		(void)printf(" %4.0f",
@@ -345,7 +345,7 @@
 			mbps = 0;
 		mbps /= etime;
 		(void)printf(" %5.*f ",
-		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
+		MAX(0, 3 - (int)floor(log10(fabs(fmax(1.0, mbps), mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-01-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  9 03:35:23 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Fix copy/paste error that resulted in a extra space after the KB/t column.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.56 src/usr.sbin/iostat/iostat.c:1.57
--- src/usr.sbin/iostat/iostat.c:1.56	Sun Jan  9 02:40:19 2011
+++ src/usr.sbin/iostat/iostat.c	Sun Jan  9 03:35:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $	*/
+/*	$NetBSD: iostat.c,v 1.57 2011/01/09 03:35:23 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.57 2011/01/09 03:35:23 jakllsch Exp $");
 #endif
 #endif /* not lint */
 
@@ -326,7 +326,7 @@
 			1024.0) / (cur.rxfer[dn] + cur.wxfer[dn]);
 		else
 			mbps = 0.0;
-		(void)printf(" %5.*f ",
+		(void)printf(" %5.*f",
 		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
 
 	/* average transfers per second. */



CVS commit: src/usr.sbin/iostat

2011-01-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  9 02:40:19 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
NetBSD/vax libm now has fmax, use it again.
Also, display average transfer size using dynamic precision too.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.55 src/usr.sbin/iostat/iostat.c:1.56
--- src/usr.sbin/iostat/iostat.c:1.55	Sat Jan  8 02:36:52 2011
+++ src/usr.sbin/iostat/iostat.c	Sun Jan  9 02:40:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $	*/
+/*	$NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $");
 #endif
 #endif /* not lint */
 
@@ -326,7 +326,8 @@
 			1024.0) / (cur.rxfer[dn] + cur.wxfer[dn]);
 		else
 			mbps = 0.0;
-		(void)printf(" %5.2f", mbps);
+		(void)printf(" %5.*f ",
+		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
 
 	/* average transfers per second. */
 		(void)printf(" %4.0f",
@@ -344,7 +345,7 @@
 			mbps = 0;
 		mbps /= etime;
 		(void)printf(" %5.*f ",
-		MAX(0,3-(int)floor(log10(fabs(MAX(1.0,mbps), mbps);
+		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-01-07 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jan  8 02:36:52 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
NetBSD/vax does not implement fmax(3), substitute with existing MAX() macro.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.54 src/usr.sbin/iostat/iostat.c:1.55
--- src/usr.sbin/iostat/iostat.c:1.54	Fri Jan  7 03:12:27 2011
+++ src/usr.sbin/iostat/iostat.c	Sat Jan  8 02:36:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.54 2011/01/07 03:12:27 jakllsch Exp $	*/
+/*	$NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.54 2011/01/07 03:12:27 jakllsch Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $");
 #endif
 #endif /* not lint */
 
@@ -344,7 +344,7 @@
 			mbps = 0;
 		mbps /= etime;
 		(void)printf(" %5.*f ",
-		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
+		MAX(0,3-(int)floor(log10(fabs(MAX(1.0,mbps), mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-01-06 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Jan  7 03:12:27 UTC 2011

Modified Files:
src/usr.sbin/iostat: Makefile iostat.c

Log Message:
Maintain 5-character width of MB/s column by dynamically adjusting the
decimal precision.

This should work until disk transfer rates exceed 9 MB/s.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/iostat/Makefile
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/Makefile
diff -u src/usr.sbin/iostat/Makefile:1.23 src/usr.sbin/iostat/Makefile:1.24
--- src/usr.sbin/iostat/Makefile:1.23	Fri Apr 21 13:46:37 2006
+++ src/usr.sbin/iostat/Makefile	Fri Jan  7 03:12:27 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2006/04/21 13:46:37 yamt Exp $
+#	$NetBSD: Makefile,v 1.24 2011/01/07 03:12:27 jakllsch Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include 
@@ -13,7 +13,7 @@
 # drvstats.c pulled in from ../../usr.bin/vmstat
 SRCS=	drvstats.c iostat.c
 
-DPADD=	${LIBKVM}
-LDADD=	-lkvm
+DPADD=	${LIBKVM} ${LIBM}
+LDADD=	-lkvm -lm
 
 .include 

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.53 src/usr.sbin/iostat/iostat.c:1.54
--- src/usr.sbin/iostat/iostat.c:1.53	Wed Apr 15 10:05:41 2009
+++ src/usr.sbin/iostat/iostat.c	Fri Jan  7 03:12:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.53 2009/04/15 10:05:41 lukem Exp $	*/
+/*	$NetBSD: iostat.c,v 1.54 2011/01/07 03:12:27 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.53 2009/04/15 10:05:41 lukem Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.54 2011/01/07 03:12:27 jakllsch Exp $");
 #endif
 #endif /* not lint */
 
@@ -87,6 +87,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "drvstats.h"
 
@@ -99,6 +100,8 @@
 static int	winlines = 20;
 static int	wincols = 80;
 
+#define	MAX(a,b)	(((a)>(b))?(a):(b))
+
 #define	ISSET(x, a)	((x) & (a))
 #define	SHOW_CPU	(1<<0)
 #define	SHOW_TTY	(1<<1)
@@ -339,7 +342,9 @@
 			(double)(1024 * 1024);
 		else
 			mbps = 0;
-		(void)printf(" %5.2f ", mbps / etime);
+		mbps /= etime;
+		(void)printf(" %5.*f ",
+		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2009-04-15 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Wed Apr 15 10:05:41 UTC 2009

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Fix -Wsign-compare issues


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.52 src/usr.sbin/iostat/iostat.c:1.53
--- src/usr.sbin/iostat/iostat.c:1.52	Mon Jul 21 13:36:58 2008
+++ src/usr.sbin/iostat/iostat.c	Wed Apr 15 10:05:41 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.52 2008/07/21 13:36:58 lukem Exp $	*/
+/*	$NetBSD: iostat.c,v 1.53 2009/04/15 10:05:41 lukem Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.52 2008/07/21 13:36:58 lukem Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.53 2009/04/15 10:05:41 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -247,7 +247,7 @@
 static void
 header()
 {
-	int i;
+	size_t i;
 
 	/* Main Headers. */
 	if (ISSET(todo, SHOW_STATS_X)) {
@@ -311,7 +311,7 @@
 static void
 drive_stats(double etime)
 {
-	int dn;
+	size_t dn;
 	double atime, mbps;
 
 	for (dn = 0; dn < ndrive; ++dn) {
@@ -346,7 +346,7 @@
 static void
 drive_stats2(double etime)
 {
-	int dn;
+	size_t dn;
 	double atime;
 
 	for (dn = 0; dn < ndrive; ++dn) {
@@ -371,7 +371,7 @@
 static void
 drive_statsx(double etime)
 {
-	int dn;
+	size_t dn;
 	double atime, kbps;
 
 	for (dn = 0; dn < ndrive; ++dn) {
@@ -429,16 +429,16 @@
 cpustats(void)
 {
 	int state;
-	double time;
+	double ttime;
 
-	time = 0;
+	ttime = 0;
 	for (state = 0; state < CPUSTATES; ++state)
-		time += cur.cp_time[state];
-	if (!time)
-		time = 1.0;
+		ttime += cur.cp_time[state];
+	if (!ttime)
+		ttime = 1.0;
 			/* States are generally never 100% and can use %3.0f. */
 	for (state = 0; state < CPUSTATES; ++state)
-		printf(" %2.0f", 100. * cur.cp_time[state] / time);
+		printf(" %2.0f", 100. * cur.cp_time[state] / ttime);
 }
 
 static void
@@ -514,7 +514,7 @@
 			break;
 #endif
 		tried++;
-		for (i = 0; i < ndrive; i++) {
+		for (i = 0; i < (int)ndrive; i++) {
 			if (strcmp(cur.name[i], *argv))
 continue;
 			cur.select[i] = 1;
@@ -529,8 +529,8 @@
 		 * if none specified.
 		 */
 		maxdrives = (ISSET(todo, SHOW_STATS_X) ||
-			 ndrive < defdrives)
-			? (ndrive) : defdrives;
+			 (int)ndrive < defdrives)
+			? (int)(ndrive) : defdrives;
 		for (i = 0; i < maxdrives; i++) {
 			cur.select[i] = 1;