PERFORCE change 166618 for review

Gabor Pali pgj at FreeBSD.org
Mon Jul 27 13:49:47 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166618

Change 166618 by pgj at petymeg-current on 2009/07/27 13:48:58

	Improve error handling in tcp_stats().

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/inet.c#25 edit

Differences ...

==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/inet.c#25 (text+ko) ====

@@ -246,7 +246,7 @@
 {
 	const struct tcp_stat *s;
 	struct stat_type *sttp;
-	int stt_flags;
+	int stt_flags, error;
 
 #ifdef INET6
 	if (tcp_done != 0)
@@ -271,7 +271,12 @@
 	}
 
 	if (netstat_stat(stat_TCP, sttp, stt_flags, kvmd) < 0) {
-		return;
+		error = netstat_stat_geterror(sttp);
+		if (error == NETSTAT_ERROR_KVM)
+			warnx("netstat_stat: %s", kvm_geterr(kvmd));
+		else
+			warnx("netstat_stat: %s", netstat_strerror(error));
+		goto out;
 	}
 
 	s = netstat_get_tcpstats(sttp);
@@ -387,6 +392,7 @@
 	p(ecn_shs, "\t%ju successful ECN handshake%s\n");
 	p(ecn_rcwnd, "\t%ju time%s ECN reduced the congestion window\n");
 
+out:
 	netstat_stat_free(sttp);
 #undef p
 #undef p1a


More information about the p4-projects mailing list