From 5f600ddbed5120adf738f49ddd32f0a7ab57f671 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 24 Oct 2012 15:40:19 -0500 Subject: [PATCH] netstat: Enable use of kvm again The code committed has some debug information enabled. It ends with an odd reference to address 0x1. --- freebsd-userspace/commands/usr.bin/netstat/main.c | 7 ++++--- freebsd-userspace/commands/usr.bin/netstat/netstat.h | 4 ---- freebsd-userspace/commands/usr.bin/netstat/netstat_route.c | 6 ++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/freebsd-userspace/commands/usr.bin/netstat/main.c b/freebsd-userspace/commands/usr.bin/netstat/main.c index e5e3b2d5..c9750e24 100644 --- a/freebsd-userspace/commands/usr.bin/netstat/main.c +++ b/freebsd-userspace/commands/usr.bin/netstat/main.c @@ -325,7 +325,7 @@ struct protox *protoprotox[] = { #ifndef __rtems__ atalkprotox, NULL }; #else - }; + NULL }; #endif static void printproto(struct protox *, const char *); @@ -1087,7 +1087,6 @@ printproto(tp, name) #define _POSIX2_LINE_MAX 128 #endif -#ifndef __rtems__ /* * Read kernel memory, return 0 on success. */ @@ -1095,6 +1094,9 @@ int kread(u_long addr, void *buf, size_t size) { char errbuf[_POSIX2_LINE_MAX]; +#ifdef __rtems__ + printf( "kread( %p to %p for %d)\n", (void *)addr, buf, size ); +#endif if (kvmd == NULL) { kvmd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf); @@ -1127,7 +1129,6 @@ kread(u_long addr, void *buf, size_t size) } return (0); } -#endif const char * plural(uintmax_t n) diff --git a/freebsd-userspace/commands/usr.bin/netstat/netstat.h b/freebsd-userspace/commands/usr.bin/netstat/netstat.h index 2c40156a..30d84f09 100644 --- a/freebsd-userspace/commands/usr.bin/netstat/netstat.h +++ b/freebsd-userspace/commands/usr.bin/netstat/netstat.h @@ -67,11 +67,7 @@ extern int unit; /* unit number for above */ extern int af; /* address family */ extern int live; /* true if we are examining a live system */ -#ifdef __rtems__ -#define kread(_x, _y, _z) (0) -#else int kread(u_long addr, void *buf, size_t size); -#endif const char *plural(uintmax_t); const char *plurales(uintmax_t); const char *pluralies(uintmax_t); diff --git a/freebsd-userspace/commands/usr.bin/netstat/netstat_route.c b/freebsd-userspace/commands/usr.bin/netstat/netstat_route.c index 2963a548..3d6d8970 100644 --- a/freebsd-userspace/commands/usr.bin/netstat/netstat_route.c +++ b/freebsd-userspace/commands/usr.bin/netstat/netstat_route.c @@ -230,6 +230,12 @@ routepr(u_long rtree) continue; if (rnh == NULL) continue; +#ifdef __rtems__ + printf( "rnh %p %p\n", (void *)rnhp, (void *)rnh ); + /* We get a 1 here on some fields. Why? XXX */ + if (rnh == 1) + continue; +#endif /* Read the rnh data. */ if (kget(rnh, head) != 0) continue;