From 6b7275814f602396b5f8d9ed2bbc0ebd70db50fe Mon Sep 17 00:00:00 2001 From: charnier Date: Mon, 24 Jan 2000 22:08:19 +0000 Subject: [PATCH] Back out previous commit minus spelling fixes. Should have asked maintainer before. --- usr.sbin/iostat/iostat.8 | 40 +++++++++++++++++++++------------------- usr.sbin/iostat/iostat.c | 26 ++++++++------------------ 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/usr.sbin/iostat/iostat.8 b/usr.sbin/iostat/iostat.8 index 035acb8d8b58..2e9b3e6dc7c3 100644 --- a/usr.sbin/iostat/iostat.8 +++ b/usr.sbin/iostat/iostat.8 @@ -25,6 +25,8 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" +.\" $FreeBSD$ +.\" .\" Copyright (c) 1985, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -57,7 +59,6 @@ .\" SUCH DAMAGE. .\" .\" @(#)iostat.8 8.1 (Berkeley) 6/6/93 -.\" $FreeBSD$ .\" .Dd December 22, 1997 .Dt IOSTAT 8 @@ -69,7 +70,7 @@ statistics .Sh SYNOPSIS .Nm iostat -.Op Fl CdhKIoT +.Op Fl CdhKIoT? .Op Fl c Ar count .Op Fl M Ar core .Op Fl n Ar devs @@ -122,16 +123,16 @@ instead of the default Display up to .Ar devs number of devices. -.Nm Iostat +.Nm iostat will display fewer devices if there aren't .Ar devs devices present. .It Fl N Extract the name list from the specified system instead of the default -.Pa /kernel . +.Dq Pa /kernel . .It Fl o Display old-style -.Nm +.Nm iostat device statistics. Sectors per second, transfers per second, and miliseconds per seek are displayed. If .Fl I @@ -202,7 +203,7 @@ all devices in the system are compared. Any device that fully matches any .Fl t argument will be included in the -.Nm +.Nm iostat output, up to the number of devices that can be displayed in 80 columns, or the maximum number of devices specified by the user. .It Fl T @@ -216,6 +217,8 @@ seconds between each display. If no repeat .Ar count is specified, the default is infinity. +.It Fl ? +Display a usage statement and exit. .El .Pp .Nm Iostat @@ -230,28 +233,27 @@ characters written to terminals .El .It devices Device operations. The header of the field is the device name and unit number. -.Nm Iostat +.Nm iostat will display as many devices as will fit in a standard 80 column screen, or the maximum number of devices in the system, whichever is smaller. If .Fl n is specified on the command line, iostat will display the smaller of the requested number of devices, and the maximum number of devices in the system. To force -.Nm +.Nm iostat to display specific drives, their names may be supplied on the command line. -.Nm Iostat +.Nm iostat will not display more devices than will fit in an 80 column screen, unless the .Fl n argument is given on the command line to specify a maximum number of devices to display. If fewer devices are specified on the command line -than will fit in an 80 column screen, -.Nm -will show only the specified devices. +than will fit in an 80 column screen, iostat will show only the specified +devices. .Pp The standard -.Nm +.Nm iostat device display shows the following statistics: .Pp .Bl -tag -width indent -compact @@ -264,7 +266,7 @@ megabytes per second .El .Pp The standard -.Nm +.Nm iostat device display, with the .Fl I flag specified, shows the following statistics: @@ -279,7 +281,7 @@ total number of megabytes transferred .El .Pp The old-style -.Nm +.Nm iostat display (using .Fl o ) shows the following statistics: @@ -294,7 +296,7 @@ average milliseconds per transaction .El .Pp The old-style -.Nm +.Nm iostat display, with the .Fl I flag specified, shows the following statistics: @@ -324,9 +326,9 @@ average milliseconds per transaction .Sh FILES .Bl -tag -width /dev/kmem -compact .It Pa /kernel -default kernel namelist +Default kernel namelist. .It Pa /dev/kmem -default memory file +Default memory file. .El .Sh EXAMPLES .Dl iostat -w 1 da0 da1 cd0 @@ -385,7 +387,7 @@ The sections starting with ``Interpreting system activity'' in .%T "Installing and Operating 4.3BSD" . .Sh HISTORY This version of -.Nm +.Nm iostat first appeared in .Fx 3.0 . .Sh BUGS diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index 16a81268e53f..5b702da754fc 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -24,6 +24,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ /* * Parts of this program are derived from the original FreeBSD iostat @@ -97,10 +99,6 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include #include @@ -157,10 +155,9 @@ usage(void) * This isn't mentioned in the man page, or the usage statement, * but it is supported. */ - fprintf(stderr, "%s\n%s\n", - "usage: iostat [-CdhIKoT] [-c count] [-M core] [-n devs] [-N system]", - " [-t type,if,pass] [-w wait] [drives]"); - exit(1); + fprintf(stderr, "usage: iostat [-CdhIKoT?] [-c count] [-M core]" + " [-n devs] [-N system]\n" + "\t [-t type,if,pass] [-w wait] [drives]\n"); } int @@ -174,6 +171,7 @@ main(int argc, char **argv) struct devstat_match *matches; int num_matches = 0; char errbuf[_POSIX2_LINE_MAX]; + char *err_str; kvm_t *kd; int hz, stathz; int headercount; @@ -187,7 +185,7 @@ main(int argc, char **argv) matches = NULL; maxshowdevs = 3; - while ((c = getopt(argc, argv, "c:CdhIKM:n:N:ot:Tw:")) != -1) { + while ((c = getopt(argc, argv, "c:CdhIKM:n:N:ot:Tw:?")) != -1) { switch(c) { case 'c': cflag++; @@ -241,9 +239,9 @@ main(int argc, char **argv) if (waittime < 1) errx(1, "wait time is < 1"); break; - case '?': default: usage(); + exit(1); break; } } @@ -290,11 +288,7 @@ main(int argc, char **argv) err(1, "can't get number of devices"); cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - if (cur.dinfo == NULL) - errx(1, "malloc failed"); last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); - if (last.dinfo == NULL) - errx(1, "malloc failed"); bzero(cur.dinfo, sizeof(struct devinfo)); bzero(last.dinfo, sizeof(struct devinfo)); @@ -314,8 +308,6 @@ main(int argc, char **argv) * they are in the list of devices we have now. */ specified_devices = (char **)malloc(sizeof(char *)); - if (specified_devices == NULL) - errx(1, "malloc failed"); for (num_devices_specified = 0; *argv; ++argv) { if (isdigit(**argv)) break; @@ -323,8 +315,6 @@ main(int argc, char **argv) specified_devices = (char **)realloc(specified_devices, sizeof(char *) * num_devices_specified); - if (specified_devices == NULL) - errx(1, "malloc failed"); specified_devices[num_devices_specified - 1] = *argv; }