Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jul 2005 03:51:13 GMT
From:      soc-anders <soc-anders@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80499 for review
Message-ID:  <200507190351.j6J3pDgo012920@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80499

Change 80499 by soc-anders@soc-anders_gimli on 2005/07/19 03:50:53

	'-rs' mode now uses sysctl to obtain rtstat and rttrash info

Affected files ...

.. //depot/projects/soc2005/ifcleanup/src/src/usr.bin/netstat/route.c#3 edit

Differences ...

==== //depot/projects/soc2005/ifcleanup/src/src/usr.bin/netstat/route.c#3 (text+ko) ====

@@ -755,22 +755,21 @@
 {
 	struct rtstat rtstat;
 	int rttrash;
+	size_t len;
 
-	/* IFCLEANUP 
-	 * rtstat should be accessible via sysctl.. until then skip this
-	 */
-	return; 
-
-	if (rtsaddr == 0) {
-		printf("rtstat: symbol not in namelist\n");
+	len = sizeof(rtstat);
+	if (sysctlbyname("net.route.rtstat", &rtstat, &len, 
+		NULL, 0) < 0) {
+		warn("sysctl: net.route.rtstat");
 		return;
 	}
-	if (rttaddr == 0) {
-		printf("rttrash: symbol not in namelist\n");
+	len = sizeof(rttrash);
+	if (sysctlbyname("net.route.rttrash", &rttrash, &len, 
+		NULL, 0) < 0) {
+		warn("sysctl: net.route.rttrash");
 		return;
 	}
-	kread(rtsaddr, (char *)&rtstat, sizeof (rtstat));
-	kread(rttaddr, (char *)&rttrash, sizeof (rttrash));
+
 	printf("routing:\n");
 
 #define	p(f, m) if (rtstat.f || sflag <= 1) \



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