netstat: Enable use of kvm again

The code committed has some debug information enabled. It ends with
an odd reference to address 0x1.
This commit is contained in:
Joel Sherrill 2012-10-24 15:40:19 -05:00
parent 34e1fb2c5a
commit 5f600ddbed
3 changed files with 10 additions and 7 deletions

View File

@ -325,7 +325,7 @@ struct protox *protoprotox[] = {
#ifndef __rtems__ #ifndef __rtems__
atalkprotox, NULL }; atalkprotox, NULL };
#else #else
}; NULL };
#endif #endif
static void printproto(struct protox *, const char *); static void printproto(struct protox *, const char *);
@ -1087,7 +1087,6 @@ printproto(tp, name)
#define _POSIX2_LINE_MAX 128 #define _POSIX2_LINE_MAX 128
#endif #endif
#ifndef __rtems__
/* /*
* Read kernel memory, return 0 on success. * Read kernel memory, return 0 on success.
*/ */
@ -1095,6 +1094,9 @@ int
kread(u_long addr, void *buf, size_t size) kread(u_long addr, void *buf, size_t size)
{ {
char errbuf[_POSIX2_LINE_MAX]; char errbuf[_POSIX2_LINE_MAX];
#ifdef __rtems__
printf( "kread( %p to %p for %d)\n", (void *)addr, buf, size );
#endif
if (kvmd == NULL) { if (kvmd == NULL) {
kvmd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf); kvmd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
@ -1127,7 +1129,6 @@ kread(u_long addr, void *buf, size_t size)
} }
return (0); return (0);
} }
#endif
const char * const char *
plural(uintmax_t n) plural(uintmax_t n)

View File

@ -67,11 +67,7 @@ extern int unit; /* unit number for above */
extern int af; /* address family */ extern int af; /* address family */
extern int live; /* true if we are examining a live system */ 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); int kread(u_long addr, void *buf, size_t size);
#endif
const char *plural(uintmax_t); const char *plural(uintmax_t);
const char *plurales(uintmax_t); const char *plurales(uintmax_t);
const char *pluralies(uintmax_t); const char *pluralies(uintmax_t);

View File

@ -230,6 +230,12 @@ routepr(u_long rtree)
continue; continue;
if (rnh == NULL) if (rnh == NULL)
continue; 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. */ /* Read the rnh data. */
if (kget(rnh, head) != 0) if (kget(rnh, head) != 0)
continue; continue;