[rtems-libbsd commit] netstat: Enable use of kvm again
Joel Sherrill
joel at rtems.org
Wed Oct 24 20:36:49 UTC 2012
Module: rtems-libbsd
Branch: master
Commit: 5f600ddbed5120adf738f49ddd32f0a7ab57f671
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=5f600ddbed5120adf738f49ddd32f0a7ab57f671
Author: Joel Sherrill <joel.sherrill at oarcorp.com>
Date: Wed Oct 24 15:40:19 2012 -0500
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 ++++---
.../commands/usr.bin/netstat/netstat.h | 4 ----
.../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 e5e3b2d..c9750e2 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 2c40156..30d84f0 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 2963a54..3d6d897 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;
More information about the vc
mailing list