[Midnightbsd-cvs] src [10744] trunk/usr.sbin/gstat/gstat.c: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 9 18:12:08 EDT 2018


Revision: 10744
          http://svnweb.midnightbsd.org/src/?rev=10744
Author:   laffer1
Date:     2018-06-09 18:12:07 -0400 (Sat, 09 Jun 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/usr.sbin/gstat/Makefile
    trunk/usr.sbin/gstat/gstat.8
    trunk/usr.sbin/gstat/gstat.c

Property Changed:
----------------
    trunk/usr.sbin/gstat/gstat.8

Modified: trunk/usr.sbin/gstat/Makefile
===================================================================
--- trunk/usr.sbin/gstat/Makefile	2018-06-09 22:11:16 UTC (rev 10743)
+++ trunk/usr.sbin/gstat/Makefile	2018-06-09 22:12:07 UTC (rev 10744)
@@ -1,8 +1,9 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/usr.sbin/gstat/Makefile 273499 2014-10-23 00:43:08Z ngie $
 
 PROG=	gstat
 MAN=	gstat.8
-DPADD=	${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBEDIT} ${LIBCURSES}
-LDADD=	-ldevstat -lkvm -lgeom -lbsdxml -lsbuf -ledit -lcurses
+DPADD=	${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBEDIT} ${LIBNCURSESW}
+LDADD=	-ldevstat -lkvm -lgeom -lbsdxml -lsbuf -ledit -lncursesw
 
 .include <bsd.prog.mk>

Modified: trunk/usr.sbin/gstat/gstat.8
===================================================================
--- trunk/usr.sbin/gstat/gstat.8	2018-06-09 22:11:16 UTC (rev 10743)
+++ trunk/usr.sbin/gstat/gstat.8	2018-06-09 22:12:07 UTC (rev 10744)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2003 Giorgos Keramidas
 .\" All rights reserved.
 .\"
@@ -22,9 +23,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.sbin/gstat/gstat.8 268791 2014-07-17 06:36:22Z delphij $
 .\"
-.Dd March 12, 2009
+.Dd July 3, 2014
 .Dt GSTAT 8
 .Os
 .Sh NAME
@@ -32,7 +33,7 @@
 .Nd print statistics about GEOM disks
 .Sh SYNOPSIS
 .Nm
-.Op Fl abcd
+.Op Fl abcdop
 .Op Fl f Ar filter
 .Op Fl I Ar interval
 .Sh DESCRIPTION
@@ -69,6 +70,9 @@
 will be displayed.
 The format of the regular expression is described in
 .Xr re_format 7 .
+.It Fl o
+Enable display of statistics for other operations
+.Pq Dv BIO_FLUSH .
 .It Fl I Ar interval
 Refresh the
 .Nm
@@ -81,6 +85,8 @@
 .Cm us
 (the default) indicates that the update interval is specified in
 seconds, milliseconds, or microseconds, respectively.
+.It Fl p
+Only display physical providers (those with rank of 1).
 .El
 .Sh EXIT STATUS
 .Ex -std


Property changes on: trunk/usr.sbin/gstat/gstat.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/gstat/gstat.c
===================================================================
--- trunk/usr.sbin/gstat/gstat.c	2018-06-09 22:11:16 UTC (rev 10743)
+++ trunk/usr.sbin/gstat/gstat.c	2018-06-09 22:12:07 UTC (rev 10744)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003 Poul-Henning Kamp
  * All rights reserved.
@@ -26,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/gstat/gstat.c 288205 2015-09-25 01:17:24Z delphij $
  */
 
 
@@ -51,7 +52,7 @@
 #include <sysexits.h>
 #include <unistd.h>
 
-static int flag_a, flag_b, flag_c, flag_d;
+static int flag_a, flag_b, flag_c, flag_d, flag_o, flag_p;
 static int flag_I = 1000000;
 
 #define PRINTMSG(...) do {						\
@@ -88,7 +89,7 @@
 	char *p;
 	char f_s[100], pf_s[100], tmp_f_s[100];
 	const char *line;
-	long double ld[11];
+	long double ld[13];
 	uint64_t u64;
 	EditLine *el;
 	History *hist;
@@ -104,7 +105,7 @@
 		flag_b = 1;
 
 	f_s[0] = '\0';
-	while ((i = getopt(argc, argv, "adcf:I:b")) != -1) {
+	while ((i = getopt(argc, argv, "abdcf:I:op")) != -1) {
 		switch (i) {
 		case 'a':
 			flag_a = 1;
@@ -124,8 +125,11 @@
 			if (regcomp(&f_re, optarg, REG_EXTENDED) != 0)
 				errx(EX_USAGE,
 				    "Invalid filter - see re_format(7)");
-			strncpy(f_s, optarg, sizeof(f_s));
+			strlcpy(f_s, optarg, sizeof(f_s));
 			break;
+		case 'o':
+			flag_o = 1;
+			break;
 		case 'I':
 			p = NULL;
 			i = strtoul(optarg, &p, 0);
@@ -140,6 +144,9 @@
 				i *= 1;
 			flag_I = i;
 			break;
+		case 'p':
+			flag_p = 1;
+			break;
 		case '?':
 		default:
 			usage();
@@ -210,7 +217,7 @@
 				getyx(stdscr, cury, curx);
 				getmaxyx(stdscr, maxy, maxx);
 			}
-			strncpy(pf_s, f_s, sizeof(pf_s));
+			strlcpy(pf_s, f_s, sizeof(pf_s));
 			max_flen = maxx - curx - 1;
 			if ((int)strlen(f_s) > max_flen && max_flen >= 0) {
 				if (max_flen > 3)
@@ -229,6 +236,8 @@
 		PRINTMSG(" w/s   kBps   ms/w   ");
 		if (flag_d)
 			PRINTMSG(" d/s   kBps   ms/d   ");
+		if (flag_o)
+			PRINTMSG(" o/s   ms/o   ");
 		PRINTMSG("%%busy Name\n");
 		for (;;) {
 			gsp = geom_stats_snapshot_next(sp);
@@ -249,6 +258,9 @@
 				continue;
 			if (gid->lg_what == ISCONSUMER && !flag_c)
 				continue;
+			if (flag_p && gid->lg_what == ISPROVIDER &&
+			   ((struct gprovider *)(gid->lg_ptr))->lg_geom->lg_rank != 1)
+				continue;
 			/* Do not print past end of window */
 			if (!flag_b) {
 				getyx(stdscr, cury, curx);
@@ -279,9 +291,14 @@
 			    DSM_MS_PER_TRANSACTION_WRITE, &ld[6],
 
 			    DSM_BUSY_PCT, &ld[7],
+
 			    DSM_TRANSFERS_PER_SECOND_FREE, &ld[8],
 			    DSM_MB_PER_SECOND_FREE, &ld[9],
 			    DSM_MS_PER_TRANSACTION_FREE, &ld[10],
+
+			    DSM_TRANSFERS_PER_SECOND_OTHER, &ld[11],
+			    DSM_MS_PER_TRANSACTION_OTHER, &ld[12],
+
 			    DSM_NONE);
 
 			if (flag_a && ld[7] < 0.1) {
@@ -313,6 +330,14 @@
 					PRINTMSG(" %6.1f", (double)ld[10]);
 			}
 
+			if (flag_o) {
+				PRINTMSG(" %6.0f", (double)ld[11]);
+				if (ld[12] > 1e3) 
+					PRINTMSG(" %6.0f", (double)ld[12]);
+				else
+					PRINTMSG(" %6.1f", (double)ld[12]);
+			}
+
 			if (ld[7] > 80)
 				i = 3;
 			else if (ld[7] > 50)
@@ -382,7 +407,7 @@
 					err(1, "el_gets");
 				if (line_len > 1)
 					history(hist, &hist_ev, H_ENTER, line);
-				strncpy(tmp_f_s, line, sizeof(f_s));
+				strlcpy(tmp_f_s, line, sizeof(f_s));
 				if ((p = strchr(tmp_f_s, '\n')) != NULL)
 					*p = '\0';
 				/*
@@ -399,7 +424,7 @@
 					refresh();
 					sleep(1);
 				} else {
-					strncpy(f_s, tmp_f_s, sizeof(f_s));
+					strlcpy(f_s, tmp_f_s, sizeof(f_s));
 					f_re = tmp_f_re;
 				}
 				break;
@@ -425,7 +450,7 @@
 static void
 usage(void)
 {
-	fprintf(stderr, "usage: gstat [-abcd] [-f filter] [-I interval]\n");
+	fprintf(stderr, "usage: gstat [-abcdp] [-f filter] [-I interval]\n");
 	exit(EX_USAGE);
         /* NOTREACHED */
 }



More information about the Midnightbsd-cvs mailing list