diff options
author | Hiroki Sato <hrs@FreeBSD.org> | 2015-09-02 18:51:36 +0000 |
---|---|---|
committer | Hiroki Sato <hrs@FreeBSD.org> | 2015-09-02 18:51:36 +0000 |
commit | 81dacd8beb51dfec0fbd5703d616efa542465d84 (patch) | |
tree | 80d11a12601882e893628fa58ab4a9d052ad4751 /usr.bin/netstat/route.c | |
parent | a261e36179b2c4000374441913f0b27384ae6b20 (diff) | |
download | src-81dacd8beb51dfec0fbd5703d616efa542465d84.tar.gz src-81dacd8beb51dfec0fbd5703d616efa542465d84.zip |
Simplify kvm symbol resolution and error handling. The symbol table
nl_symbols will eventually be organized into several modules depending
on MK_* variables.
Notes
Notes:
svn path=/head/; revision=287407
Diffstat (limited to 'usr.bin/netstat/route.c')
-rw-r--r-- | usr.bin/netstat/route.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index b271133ddb7c..7cb777bdd245 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include <ifaddrs.h> #include <libutil.h> #include <netdb.h> -#include <nlist.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -67,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include <err.h> #include <libxo/xo.h> #include "netstat.h" +#include "nl_defs.h" /* * Definitions for showing gateway flags. @@ -96,17 +96,6 @@ static struct bits { { 0 , 0, NULL } }; -/* - * kvm(3) bindings for every needed symbol - */ -static struct nlist rl[] = { -#define N_RTSTAT 0 - { .n_name = "_rtstat" }, -#define N_RTTRASH 1 - { .n_name = "_rttrash" }, - { .n_name = NULL }, -}; - struct ifmap_entry { char ifname[IFNAMSIZ]; }; @@ -745,13 +734,11 @@ rt_stats(void) u_long rtsaddr, rttaddr; int rttrash; - kresolve_list(rl); - - if ((rtsaddr = rl[N_RTSTAT].n_value) == 0) { + if ((rtsaddr = nl[N_RTSTAT].n_value) == 0) { xo_emit("{W:rtstat: symbol not in namelist}\n"); return; } - if ((rttaddr = rl[N_RTTRASH].n_value) == 0) { + if ((rttaddr = nl[N_RTTRASH].n_value) == 0) { xo_emit("{W:rttrash: symbol not in namelist}\n"); return; } |