From b1499feb9e7d7e472cdc4b329775893db9448594 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Thu, 19 Feb 2015 22:42:33 +0000 Subject: [PATCH] Now that IGMP and MLD sysctls provide a clean API structures that do not leak kernel internal stuff, reconnect ifmcstat(1) back to build. However, disable kvm(3) support in it, since it requires uncovering tons of _KERNEL defined declarations, which can be achieved either uncovering them globally or providing dirty hacks such as _WANT_IFADDR. If anyone demands an ifmcstat-like kvm-based tool, please take the code out of usr.sbin/ifmstat and create a tool in src/tools/tools. --- usr.sbin/Makefile | 2 -- usr.sbin/ifmcstat/Makefile | 5 ----- usr.sbin/ifmcstat/ifmcstat.c | 30 +++++++++++++++--------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 20b9fe01724..30d843dfbd5 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -94,8 +94,6 @@ SUBDIR= adduser \ watchdogd \ zic -SUBDIR:= ${SUBDIR:Nifmcstat} - # NB: keep these sorted by MK_* knobs .if ${MK_ACCT} != "no" diff --git a/usr.sbin/ifmcstat/Makefile b/usr.sbin/ifmcstat/Makefile index 20de277e2bf..adf1304f3dd 100644 --- a/usr.sbin/ifmcstat/Makefile +++ b/usr.sbin/ifmcstat/Makefile @@ -15,9 +15,4 @@ WARNS?= 2 CFLAGS+=-DINET6 .endif -.if ${MK_KVM_SUPPORT} != "no" -CFLAGS+=-DWITH_KVM -LIBADD= kvm -.endif - .include diff --git a/usr.sbin/ifmcstat/ifmcstat.c b/usr.sbin/ifmcstat/ifmcstat.c index 9f5187761be..d3798e39fab 100644 --- a/usr.sbin/ifmcstat/ifmcstat.c +++ b/usr.sbin/ifmcstat/ifmcstat.c @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define _WANT_IFADDR #include #include #include @@ -52,20 +51,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define KERNEL -# include -#undef KERNEL -#define _KERNEL -#define SYSCTL_DECL(x) -# include -#undef SYSCTL_DECL -#undef _KERNEL +#include +#include #ifdef INET6 #include -#define _KERNEL -# include -#undef _KERNEL +#include #endif /* INET6 */ #include @@ -82,14 +73,23 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include -#include #include #include -/* XXX: This file currently assumes INET and KVM support in the base system. */ +#ifdef KVM +/* + * Currently the KVM build is broken. To be fixed it requires uncovering + * large amount of _KERNEL code in include files, and it is also very + * tentative to internal kernel ABI changes. If anyone wishes to restore + * it, please move it out of src/usr.sbin to src/tools/tools. + */ +#include +#include +#endif + +/* XXX: This file currently assumes INET support in the base system. */ #ifndef INET #define INET #endif