| Use macro '__FreeBSD_kernel__' to indicate the kernel of FreeBSD. |
| |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/archive3/public/freebsd-releng-10.4-src/sys/conf/kern.pre.mk freebsd-10.4/sys/conf/kern.pre.mk |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/conf/kern.pre.mk 2017-09-29 08:19:45.000000000 +0800 |
| +++ freebsd-10.4/sys/conf/kern.pre.mk 2020-01-24 15:25:50.155401000 +0800 |
| @@ -79,7 +79,7 @@ |
| .endif |
| |
| CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS} |
| -CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h |
| +CFLAGS+= ${INCLUDES} -D __FreeBSD_kernel__=1 -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h |
| .if ${COMPILER_TYPE} != "clang" |
| CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} |
| .if ${MACHINE_CPUARCH} != "mips" |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/archive3/public/freebsd-releng-10.4-src/sys/conf/kmod.mk freebsd-10.4/sys/conf/kmod.mk |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/conf/kmod.mk 2017-09-29 08:19:45.000000000 +0800 |
| +++ freebsd-10.4/sys/conf/kmod.mk 2020-01-24 15:38:05.924153000 +0800 |
| @@ -96,7 +96,7 @@ |
| .endif |
| WERROR?= -Werror |
| CFLAGS+= ${WERROR} |
| -CFLAGS+= -D_KERNEL |
| +CFLAGS+= -D __FreeBSD_kernel__=1 -D_KERNEL |
| CFLAGS+= -DKLD_MODULE |
| |
| # Don't use any standard or source-relative include directories. |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/archive3/public/freebsd-releng-10.4-src/sys/net80211/ieee80211_var.h freebsd-10.4/sys/net80211/ieee80211_var.h |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/net80211/ieee80211_var.h 2017-09-29 08:20:06.000000000 +0800 |
| +++ freebsd-10.4/sys/net80211/ieee80211_var.h 2020-01-24 15:25:15.283490000 +0800 |
| @@ -31,15 +31,18 @@ |
| /* |
| * Definitions for IEEE 802.11 drivers. |
| */ |
| +#if defined __FreeBSD__ && !defined __FreeBSD_kernel__ |
| +#define __FreeBSD_kernel__ 1 |
| +#endif |
| /* NB: portability glue must go first */ |
| #if defined(__NetBSD__) |
| #include <net80211/ieee80211_netbsd.h> |
| -#elif defined(__FreeBSD__) |
| +#elif defined(__FreeBSD_kernel__) |
| #include <net80211/ieee80211_freebsd.h> |
| #elif defined(__linux__) |
| #include <net80211/ieee80211_linux.h> |
| #else |
| -#error "No support for your operating system!" |
| +#error "No support for your operating system / kernel!" |
| #endif |
| |
| #include <net80211/_ieee80211.h> |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/archive3/public/freebsd-releng-10.4-src/sys/sys/timex.h freebsd-10.4/sys/sys/timex.h |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/sys/timex.h 2017-09-29 08:19:46.000000000 +0800 |
| +++ freebsd-10.4/sys/sys/timex.h 2020-01-24 15:25:15.284273000 +0800 |
| @@ -97,7 +97,11 @@ |
| #define _SYS_TIMEX_H_ 1 |
| #define NTP_API 4 /* NTP API version */ |
| |
| -#ifdef __FreeBSD__ |
| +#if defined __FreeBSD__ && !defined __FreeBSD_kernel__ |
| +#define __FreeBSD_kernel__ 1 |
| +#endif |
| + |
| +#ifdef __FreeBSD_kernel__ |
| #include <sys/_timespec.h> |
| #endif /* __FreeBSD__ */ |
| #ifndef MSDOS /* Microsoft specific */ |
| @@ -221,7 +225,7 @@ |
| long stbcnt; /* stability limit exceeded (ro) */ |
| }; |
| |
| -#ifdef __FreeBSD__ |
| +#ifdef __FreeBSD_kernel__ |
| |
| #ifdef _KERNEL |
| void ntp_update_second(int64_t *adjustment, time_t *newsec); |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/archive3/public/freebsd-releng-10.4-src/sys/teken/teken.c freebsd-10.4/sys/teken/teken.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/teken/teken.c 2017-09-29 08:20:11.000000000 +0800 |
| +++ freebsd-10.4/sys/teken/teken.c 2020-01-24 15:25:15.284745000 +0800 |
| @@ -27,7 +27,8 @@ |
| */ |
| |
| #include <sys/cdefs.h> |
| -#if defined(__FreeBSD__) && defined(_KERNEL) |
| +#include <sys/param.h> |
| +#if defined(__FreeBSD_kernel__) && defined(_KERNEL) |
| #include <sys/param.h> |
| #include <sys/limits.h> |
| #include <sys/lock.h> |