diff options
author | mdf <mdf@FreeBSD.org> | 2011-12-12 18:44:17 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2011-12-12 18:44:17 +0000 |
commit | 21f7c1b29fdf6a1f3ff0070ce7cb0baaf2786fe5 (patch) | |
tree | fbc23e88a4737d6047e518d9540133f1e568c6d6 /sys/sys | |
parent | 20fbb4d01304ebe013c75e1a2ac638689ce4e9ba (diff) | |
download | FreeBSD-src-21f7c1b29fdf6a1f3ff0070ce7cb0baaf2786fe5.zip FreeBSD-src-21f7c1b29fdf6a1f3ff0070ce7cb0baaf2786fe5.tar.gz |
- Define true and false in sys/types.h for _KERNEL consumers, and
typedef bool. Due to macro expansion it seemed better to use a
typedef for kernel consumers (specifically ofed won't compile
without more changes if a define is used).
- <stdbool.h> should also not re-define bool/true/false if they are
defined by <sys/types.h>. It would probably be a programming error
to define _KERNEL for user-space code, but downstream consumers
like Isilon have already been including <stdbool.h> in kernel
sources, and this protects that usage.
- sizeof(_Bool) is not necessarily the same as sizeof(int), so kernel
modules should be rebuild with this change. Bump __FreeBSD_version.
MFC after: 2 weeks
Sponsored by: Isilon Systems, LLC
Diffstat (limited to 'sys/sys')
-rw-r--r-- | sys/sys/param.h | 2 | ||||
-rw-r--r-- | sys/sys/types.h | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/sys/sys/param.h b/sys/sys/param.h index 87eba11..1ce8e35 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000001 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000002 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/types.h b/sys/sys/types.h index 1b994d3..43c29d6 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -261,6 +261,16 @@ typedef __uint64_t uoff_t; typedef char vm_memattr_t; /* memory attribute codes */ typedef struct vm_page *vm_page_t; +#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus) +#define __bool_true_false_are_defined 1 +#define false 0 +#define true 1 +#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) +typedef int _Bool; +#endif +typedef _Bool bool; +#endif /* !__bool_true_false_are_defined && !__cplusplus */ + #define offsetof(type, field) __offsetof(type, field) #endif /* !_KERNEL */ |