Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jul 2009 13:49:45 GMT
From:      Gabor Pali <pgj@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 166618 for review
Message-ID:  <200907271349.n6RDnj7V084496@repoman.freebsd.org>

index | next in thread | raw e-mail

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

Change 166618 by pgj@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


help

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