svn commit: r229285 - in stable/9: include sys/sys
Matthew D Fleming
mdf at FreeBSD.org
Mon Jan 2 16:14:53 UTC 2012
Author: mdf
Date: Mon Jan 2 16:14:52 2012
New Revision: 229285
URL: http://svn.freebsd.org/changeset/base/229285
Log:
MFC r228444:
- 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 rebuilt with this change. Bump __FreeBSD_version.
No KBI change is expected based on review of the code.
Modified:
stable/9/include/stdbool.h
stable/9/sys/sys/param.h
stable/9/sys/sys/types.h
Directory Properties:
stable/9/include/ (props changed)
stable/9/sys/ (props changed)
Modified: stable/9/include/stdbool.h
==============================================================================
--- stable/9/include/stdbool.h Mon Jan 2 16:02:30 2012 (r229284)
+++ stable/9/include/stdbool.h Mon Jan 2 16:14:52 2012 (r229285)
@@ -29,6 +29,7 @@
#ifndef _STDBOOL_H_
#define _STDBOOL_H_
+#ifndef __bool_true_false_are_defined
#define __bool_true_false_are_defined 1
#ifndef __cplusplus
@@ -42,5 +43,6 @@ typedef int _Bool;
#endif
#endif /* !__cplusplus */
+#endif /* __bool_true_false_are_defined */
#endif /* !_STDBOOL_H_ */
Modified: stable/9/sys/sys/param.h
==============================================================================
--- stable/9/sys/sys/param.h Mon Jan 2 16:02:30 2012 (r229284)
+++ stable/9/sys/sys/param.h Mon Jan 2 16:14:52 2012 (r229285)
@@ -58,7 +58,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 900044 /* Master, propagated to newvers */
+#define __FreeBSD_version 900045 /* Master, propagated to newvers */
#ifdef _KERNEL
#define P_OSREL_SIGWAIT 700000
Modified: stable/9/sys/sys/types.h
==============================================================================
--- stable/9/sys/sys/types.h Mon Jan 2 16:02:30 2012 (r229284)
+++ stable/9/sys/sys/types.h Mon Jan 2 16:14:52 2012 (r229285)
@@ -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 */
More information about the svn-src-all
mailing list