diff options
author | Robert Millan <rmh@FreeBSD.org> | 2011-11-22 18:53:54 +0000 |
---|---|---|
committer | Robert Millan <rmh@FreeBSD.org> | 2011-11-22 18:53:54 +0000 |
commit | 8326714bc16bb49740c652488cd272c7779e2113 (patch) | |
tree | 56583fbc01d4c94c7549895a7f319d9f6d7e4c12 | |
parent | 885c97af51946d21b2e4fcd6faf10ac06c3684b0 (diff) | |
download | src-8326714bc16bb49740c652488cd272c7779e2113.tar.gz src-8326714bc16bb49740c652488cd272c7779e2113.zip |
Define __FreeBSD_kernel__ macro in sys/param.h.
__FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
which by definition is always true on FreeBSD. This macro is also defined
on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD.
It is tempting to use this macro in userland code when we want to enable
kernel-specific routines, and in fact it's fine to do this in code that
is part of FreeBSD itself. However, be aware that as presence of this
macro is still not widespread (e.g. older FreeBSD versions, 3rd party
compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in
external applications without also checking for __FreeBSD__ as an
alternative.
Approved by: kib (mentor)
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=227827
-rw-r--r-- | sys/sys/param.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/sys/param.h b/sys/sys/param.h index d2ead83edecd..87eba11e0e8f 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,6 +60,22 @@ #undef __FreeBSD_version #define __FreeBSD_version 1000001 /* Master, propagated to newvers */ +/* + * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, + * which by definition is always true on FreeBSD. This macro is also defined + * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD. + * + * It is tempting to use this macro in userland code when we want to enable + * kernel-specific routines, and in fact it's fine to do this in code that + * is part of FreeBSD itself. However, be aware that as presence of this + * macro is still not widespread (e.g. older FreeBSD versions, 3rd party + * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in + * external applications without also checking for __FreeBSD__ as an + * alternative. + */ +#undef __FreeBSD_kernel__ +#define __FreeBSD_kernel__ + #ifdef _KERNEL #define P_OSREL_SIGWAIT 700000 #define P_OSREL_SIGSEGV 700004 |