From 07871af1af46fe9f96434c69bcf1ca318f3c3f94 Mon Sep 17 00:00:00 2001 From: mycroft Date: Sun, 15 Jan 1995 07:08:55 +0000 Subject: [PATCH] Add `-k' option, per Matt Green. Put the description of the `-n' option in the table, where it belongs. Also, fix the formatting of the table for consistency with the other man pages. Document the BLOCKSIZE environment variable. --- usr.sbin/pstat/pstat.8 | 26 ++++++++++++++++++-------- usr.sbin/pstat/pstat.c | 17 +++++++++++++---- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/usr.sbin/pstat/pstat.8 b/usr.sbin/pstat/pstat.8 index e72c5808e22c..5b19f3c9e075 100644 --- a/usr.sbin/pstat/pstat.8 +++ b/usr.sbin/pstat/pstat.8 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)pstat.8 8.4 (Berkeley) 4/19/94 -.\" $Id: pstat.8,v 1.2 1994/05/13 21:48:00 cgd Exp $ +.\" $Id: pstat.8,v 1.3 1995/01/15 07:08:55 mycroft Exp $ .\" .Dd April 19, 1994 .Dt PSTAT 8 @@ -40,7 +40,7 @@ .Nd display system data structures .Sh SYNOPSIS .Nm pstat -.Op Fl Tfnstv +.Op Fl Tfknstv .Op Fl M Ar core .Op Fl N Ar system .Sh DESCRIPTION @@ -57,13 +57,9 @@ The required namelist is taken from unless .Ar system is specified. -The -.Fl n -option specifies that devices should be printed out by major/minor -number rather than by name. .Pp -Options are -.Bl -tag -width indent +The following options are available: +.Bl -tag -width Ds .It Fl T Prints the number of used and free slots in the several system tables and is useful for checking to see how large system tables have become @@ -101,6 +97,10 @@ The location of the vnode table entry or socket structure for this file. The file offset (see .Xr lseek 2 ) . .El +.It Fl k +Use 1K-byte blocks. +.It Fl n +Print devices by major/minor number rather than by name. .It Fl s Print information about swap space usage on all the swap areas compiled into the kernel. @@ -292,6 +292,16 @@ Number of bytes in an ordinary file, or major and minor device of special file. .El .El +.Sh ENVIRONMENTAL VARIABLES +.Bl -tag -width BLOCKSIZE +.It Ev BLOCKSIZE +If the environmental variable +.Ev BLOCKSIZE +is set, and the +.Fl k +option is not specified, the block counts will be displayed in units of that +size block. +.El .Sh FILES .Bl -tag -width /dev/kmemxxx -compact .It Pa /netbsd diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index d3878e675517..219df39a0de9 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -39,7 +39,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)pstat.c 8.9 (Berkeley) 2/16/94"; */ -static char *rcsid = "$Id: pstat.c,v 1.7 1995/01/04 05:35:47 mycroft Exp $"; +static char *rcsid = "$Id: pstat.c,v 1.8 1995/01/15 07:08:57 mycroft Exp $"; #endif /* not lint */ #include @@ -165,6 +165,7 @@ struct nlist nl[] = { int usenumflag; int totalflag; +int kflag; char *nlistf = NULL; char *memf = NULL; kvm_t *kd; @@ -219,7 +220,7 @@ main(argc, argv) char buf[_POSIX2_LINE_MAX]; fileflag = swapflag = ttyflag = vnodeflag = 0; - while ((ch = getopt(argc, argv, "TM:N:finstv")) != EOF) + while ((ch = getopt(argc, argv, "TM:N:fiknstv")) != -1) switch (ch) { case 'f': fileflag = 1; @@ -242,6 +243,9 @@ main(argc, argv) case 't': ttyflag = 1; break; + case 'k': + kflag = 1; + break; case 'v': case 'i': /* Backward compatibility. */ vnodeflag = 1; @@ -1090,7 +1094,12 @@ swapmode() } } - header = getbsize(&hlen, &blocksize); + if (kflag) { + header = "1K-blocks"; + blocksize = 1024; + hlen = strlen(header); + } else + header = getbsize(&hlen, &blocksize); if (!totalflag) (void)printf("%-11s %*s %8s %8s %8s %s\n", "Device", hlen, header, @@ -1149,6 +1158,6 @@ void usage() { (void)fprintf(stderr, - "usage: pstat [-Tfnstv] [-M core] [-N system]\n"); + "usage: pstat [-Tfknstv] [-M core] [-N system]\n"); exit(1); }