| Use macro '__FreeBSD_kernel__' to indicate the kernel of FreeBSD. |
| |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/sys/conf/kern.pre.mk freebsd-11.1/sys/conf/kern.pre.mk |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/sys/sys/timex.h freebsd-11.1/sys/sys/timex.h |
| @@ -70,7 +70,7 @@ |
| INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. -I$S |
| |
| CFLAGS= ${COPTFLAGS} ${DEBUG} |
| -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 |
| CFLAGS_PARAM_INLINE_UNIT_GROWTH?=100 |
| CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000 |
| .if ${MACHINE_CPUARCH} == "mips" |
| --- /usr/src/sys/sys/timex.h 2017-07-21 07:41:55.000000000 +0800 |
| +++ freebsd-11.1/sys/sys/timex.h 2019-12-20 17:39:23.084227505 +0800 |
| @@ -37,7 +37,11 @@ |
| |
| #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__ */ |
| |
| @@ -153,7 +157,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 /usr/src/sys/teken/teken.c freebsd-11.1/sys/teken/teken.c |
| --- /usr/src/sys/teken/teken.c 2017-07-21 07:42:12.000000000 +0800 |
| +++ freebsd-11.1/sys/teken/teken.c 2019-12-20 18:30:20.339769568 +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> |