Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jan 2011 10:58:36 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217776 - head/usr.bin/netstat
Message-ID:  <201101241058.p0OAwa4A088494@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Mon Jan 24 10:58:36 2011
New Revision: 217776
URL: http://svn.freebsd.org/changeset/base/217776

Log:
  While printing out the WSID and CPU ID only the first time it appears for
  each workstream, rather than on every protocol, is prettier, it makes
  machine-parsing of netstat -Q output a lot harder.  Repeat the information
  and hope that the user forgives us slightly dense formatting.
  
  MFC after:	3 days
  Reported by:	bz
  Sponsored by:	Juniper Networks

Modified:
  head/usr.bin/netstat/netisr.c

Modified: head/usr.bin/netstat/netisr.c
==============================================================================
--- head/usr.bin/netstat/netisr.c	Mon Jan 24 10:54:09 2011	(r217775)
+++ head/usr.bin/netstat/netisr.c	Mon Jan 24 10:58:36 2011	(r217776)
@@ -436,20 +436,14 @@ static void
 netisr_print_workstream(struct sysctl_netisr_workstream *snwsp)
 {
 	struct sysctl_netisr_work *snwp;
-	int first;
 	u_int i;
 
-	first = 1;
 	for (i = 0; i < work_array_len; i++) {
 		snwp = &work_array[i];
 		if (snwp->snw_wsid != snwsp->snws_wsid)
 			continue;
-		if (first) {
-			printf("%4u ", snwsp->snws_wsid);
-			printf("%3u ", snwsp->snws_cpu);
-			first = 0;
-		} else
-			printf("%4s %3s ", "", "");
+		printf("%4u ", snwsp->snws_wsid);
+		printf("%3u ", snwsp->snws_cpu);
 		printf("%2s", "");
 		printf("%-6s", netisr_proto2name(snwp->snw_proto));
 		printf(" %5u", snwp->snw_len);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101241058.p0OAwa4A088494>