socsvn commit: r224129 - soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat

oleksandr at FreeBSD.org oleksandr at FreeBSD.org
Mon Jul 11 16:41:40 UTC 2011


Author: oleksandr
Date: Mon Jul 11 16:41:37 2011
New Revision: 224129
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=224129

Log:
  Add to iostat option -E to show device error

Modified:
  soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c

Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c
==============================================================================
--- soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c	Mon Jul 11 14:15:27 2011	(r224128)
+++ soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c	Mon Jul 11 16:41:37 2011	(r224129)
@@ -100,6 +100,7 @@
 #include <sys/errno.h>
 #include <sys/resource.h>
 #include <sys/sysctl.h>
+#include <sys/devicestat.h>
 
 #include <err.h>
 #include <ctype.h>
@@ -136,7 +137,7 @@
 volatile sig_atomic_t wresized;		/* Tty resized, when non-zero. */
 unsigned short wrows;			/* Current number of tty rows. */
 int dflag = 0, Iflag = 0, Cflag = 0, Tflag = 0, oflag = 0, Kflag = 0;
-int xflag = 0, zflag = 0;
+int xflag = 0, zflag = 0, Eflag = 0;
 
 /* local function declarations */
 static void usage(void);
@@ -158,7 +159,7 @@
 	 * This isn't mentioned in the man page, or the usage statement,
 	 * but it is supported.
 	 */
-	fprintf(stderr, "usage: iostat [-CdhIKoTxz?] [-c count] [-M core]"
+	fprintf(stderr, "usage: iostat [-CdEhIKoTxz?] [-c count] [-M core]"
 		" [-n devs] [-N system]\n"
 		"\t      [-t type,if,pass] [-w wait] [drives]\n");
 }
@@ -200,6 +201,9 @@
 			case 'd':
 				dflag++;
 				break;
+                        case 'E':
+                                Eflag++;
+                                break;
 			case 'h':
 				hflag++;
 				break;
@@ -758,7 +762,13 @@
 			printf("us ni sy in id ");
 		printf("\n");
 	}
-
+        if (Eflag>0) {
+		printf("                        error device statistics  ");
+		printf(
+		"device     retrable   non_retrible "
+			    );
+		printf("\n");
+        }
 	for (dn = 0; dn < num_devices; dn++) {
 		int di;
 
@@ -804,6 +814,17 @@
 						       block_size : 512) / 1024;
 		}
 
+		if (Eflag > 0) {
+			if (asprintf(&devname, "%s%d",
+			    cur.dinfo->devices[di].device_name,
+			    cur.dinfo->devices[di].unit_number) == -1)
+				err(1, "asprintf");
+			printf("%-8.8s %d %d ",
+		    devname,cur.dinfo->devices[di].dev_error.retriable,
+			    cur.dinfo->devices[di].dev_error.non_retriable);
+				printf("\n");
+			free(devname);
+	        }		
 		if (xflag > 0) {
 			if (asprintf(&devname, "%s%d",
 			    cur.dinfo->devices[di].device_name,


More information about the svn-soc-all mailing list