commit 525b0d3fcdfe93004014cdb978f703ae84e71d5b
Author: Ingo Weinhold <ingo_weinhold@gmx.de>
Date:   Fri Feb 10 19:40:27 2012 +0100

    Stash work in progress

diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup
index 41e72a2..63bfea2 100644
--- a/build/jam/BuildSetup
+++ b/build/jam/BuildSetup
@@ -773,8 +773,8 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
 	HOST_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ;
 } else {
 	HOST_LIBSTDC++ = stdc++ ;
-	HOST_LIBROOT = libroot_build_function_remapper.a libroot_build.so ;
-	HOST_STATIC_LIBROOT = libroot_build_function_remapper.a libroot_build.a ;
+	HOST_LIBROOT = libroot_build.so ;
+	HOST_STATIC_LIBROOT = libroot_build.a ;
 	HOST_LIBBE = libbe_build.so ;
 	if $(HOST_PLATFORM) = cygwin {
 		HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
@@ -897,7 +897,9 @@ HOST_BE_API_C++FLAGS = ;
 
 if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
 	HOST_BE_API_HEADERS =
+		[ FDirName $(HAIKU_BUILD_OUTPUT_DIR) ]
 		[ FDirName $(HAIKU_TOP) headers build ]
+		[ FDirName $(HAIKU_TOP) headers build posix ]
 		[ FDirName $(HAIKU_TOP) headers build os ]
 		[ FDirName $(HAIKU_TOP) headers build os app ]
 		[ FDirName $(HAIKU_TOP) headers build os drivers ]
@@ -908,8 +910,10 @@ if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
 		[ FDirName $(HAIKU_TOP) headers build os support ]
 		[ FDirName $(HAIKU_TOP) headers build private ]
 	;
-	HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ;
+#	HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ;
+	HOST_BE_API_CCFLAGS += -nostdinc ;
 	HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
+	HOST_BE_API_C++FLAGS += -nostdinc++ ;
 }
 
 # Add directory with system headers we need when building something for the host
diff --git a/configure b/configure
index 3caedf2..57ce800 100755
--- a/configure
+++ b/configure
@@ -581,7 +581,7 @@ cat << EOF > "$buildOutputDir/libgccObjects"
 HAIKU_GCC_LIBGCC_OBJECTS	?= ${HAIKU_GCC_LIBGCC_OBJECTS} ;
 EOF
 
-# Generate a boot strap Jamfile in the output directory.
+# Generate a bootstrap Jamfile in the output directory.
 
 cat << EOF > $outputDir/Jamfile
 # automatically generated Jamfile
@@ -592,3 +592,39 @@ HAIKU_OUTPUT_DIR	= ${outputDir} ;
 include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
 
 EOF
+
+
+
+# hostFeaturesFile=$outputDir/build/HostFeatures
+# rm -f "$hostFeaturesFile"
+# touch "$hostFeaturesFile"
+# jam -a configure_build
+# 
+# hostBuildConfigHeader=$outputDir/build/HaikuHostBuildConfig.h
+# rm -f "$hostBuildConfigHeader"
+# echo >> "$buildConfigFile"
+# for feature in `cat $hostFeaturesFile`; do
+# 	echo "#define _HAIKU_HOST_FEATURE_$feature 1" >> "$hostBuildConfigHeader"
+# 	echo "HAIKU_HOST_FEATURE_$feature = 1 ;" >> "$buildConfigFile"
+# done
+
+
+
+hostBuildConfigHeader=$outputDir/build/HaikuHostBuildConfig.h
+cat << EOF > "$hostBuildConfigHeader"
+/* auto-generated by configure */
+#ifndef _HAIKU_BUILD_HOST_BUILD_CONFIG_H
+#define _HAIKU_BUILD_HOST_BUILD_CONFIG_H
+EOF
+
+jam -a configure_build
+
+cat << EOF >> "$hostBuildConfigHeader"
+#endif	/* _HAIKU_BUILD_HOST_BUILD_CONFIG_H */
+EOF
+
+
+echo >> "$buildConfigFile"
+cat "$hostBuildConfigHeader" | grep "#define _HAIKU_BUILD_FEATURE_" \
+	| sed -e 's@#define _\(HAIKU_BUILD_FEATURE_[^[:space:]]*\)[[:space:]]*\(.*\)@\1 = \2 ;@' \
+	>> "$buildConfigFile"
diff --git a/headers/build/HaikuBuild.h b/headers/build/HaikuBuild.h
new file mode 100644
index 0000000..044bf7a
--- /dev/null
+++ b/headers/build/HaikuBuild.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_H
+#define _HAIKU_BUILD_H
+
+
+#include <HaikuHostBuildConfig.h>
+
+
+#define _HAIKU_BUILD_STRING(string)
+#define _HAIKU_BUILD_ASMNAME(name) \
+	_HAIKU_BUILD_STRING(__USER_LABEL_PREFIX__) name
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	define _HAIKU_BUILD_DECLARE_FUNCTION(returnValue, name, parameters)	\
+		returnValue _haiku_build_##name parameters;
+#else
+#	define _HAIKU_BUILD_DECLARE_FUNCTION(returnValue, name, parameters)	\
+		returnValue _haiku_build_##name parameters;						\
+		returnValue name parameters										\
+			__asm__(_HAIKU_BUILD_ASMNAME("_haiku_build_" #name));
+#endif
+
+
+#endif	/* _HAIKU_BUILD_H */
diff --git a/headers/build/config_build/HaikuConfig.h b/headers/build/config_build/HaikuConfig.h
index 8d49522..91e5509 100644
--- a/headers/build/config_build/HaikuConfig.h
+++ b/headers/build/config_build/HaikuConfig.h
@@ -1,11 +1,14 @@
 /*
- * Copyright 2009-2010, Haiku, Inc. All Rights Reserved.
+ * Copyright 2009-2011, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  */
 #ifndef _CONFIG_HAIKU_CONFIG_H
 #define _CONFIG_HAIKU_CONFIG_H
 
 
+#include <HaikuBuild.h>
+
+
 /* Determine the architecture and define macros for some fundamental
    properties:
    __HAIKU_ARCH					- short name of the architecture (used in paths)
@@ -18,26 +21,26 @@
    								  (defaults to undefined)
 */
 #ifdef __INTEL__
-#	define __HAIKU_ARCH				x86
-#	define __HAIKU_ARCH_X86			1
+#	define __HAIKU_BUILD_HAIKU_ARCH				x86
+#	define __HAIKU_BUILD_HAIKU_ARCH_X86			1
 #elif __x86_64__
-#	define __HAIKU_ARCH				x86_64
-#	define __HAIKU_ARCH_X86_64		1
-#	define __HAIKU_ARCH_BITS		64
+#	define __HAIKU_BUILD_HAIKU_ARCH				x86_64
+#	define __HAIKU_BUILD_HAIKU_ARCH_X86_64		1
+#	define __HAIKU_BUILD_HAIKU_ARCH_BITS		64
 #elif __POWERPC__
-#	define __HAIKU_ARCH				ppc
-#	define __HAIKU_ARCH_PPC			1
-#	define __HAIKU_BIG_ENDIAN		1
+#	define __HAIKU_BUILD_HAIKU_ARCH				ppc
+#	define __HAIKU_BUILD_HAIKU_ARCH_PPC			1
+#	define __HAIKU_BUILD_HAIKU_BIG_ENDIAN		1
 #elif __M68K__
-#	define __HAIKU_ARCH				m68k
-#	define __HAIKU_ARCH_M68K		1
-#	define __HAIKU_BIG_ENDIAN		1
+#	define __HAIKU_BUILD_HAIKU_ARCH				m68k
+#	define __HAIKU_BUILD_HAIKU_ARCH_M68K		1
+#	define __HAIKU_BUILD_HAIKU_BIG_ENDIAN		1
 #elif __MIPSEL__
-#	define __HAIKU_ARCH				mipsel
-#	define __HAIKU_ARCH_MIPSEL		1
+#	define __HAIKU_BUILD_HAIKU_ARCH				mipsel
+#	define __HAIKU_BUILD_HAIKU_ARCH_MIPSEL		1
 #elif __ARM__
-#	define __HAIKU_ARCH				arm
-#	define __HAIKU_ARCH_ARM			1
+#	define __HAIKU_BUILD_HAIKU_ARCH				arm
+#	define __HAIKU_BUILD_HAIKU_ARCH_ARM			1
 #else
 #	error Unsupported architecture!
 #endif
@@ -53,40 +56,104 @@
 */
 
 /* bitness */
-#ifndef __HAIKU_ARCH_BITS
-#	define __HAIKU_ARCH_BITS		32
+#ifndef __HAIKU_BUILD_HAIKU_ARCH_BITS
+#	define __HAIKU_BUILD_HAIKU_ARCH_BITS		32
 #endif
 
-#if __HAIKU_ARCH_BITS == 32
-#	define __HAIKU_ARCH_32_BIT		1
-#elif __HAIKU_ARCH_BITS == 64
-#	define __HAIKU_ARCH_64_BIT		1
+#if __HAIKU_BUILD_HAIKU_ARCH_BITS == 32
+#	define __HAIKU_BUILD_HAIKU_ARCH_32_BIT		1
+#elif __HAIKU_BUILD_HAIKU_ARCH_BITS == 64
+#	define __HAIKU_BUILD_HAIKU_ARCH_64_BIT		1
 #else
 #	error Unsupported bitness!
 #endif
 
 /* physical bitness */
-#ifndef __HAIKU_ARCH_PHYSICAL_BITS
-#	define __HAIKU_ARCH_PHYSICAL_BITS	__HAIKU_ARCH_BITS
+#ifndef __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_BITS
+#	define __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_BITS	\
+		__HAIKU_BUILD_HAIKU_ARCH_BITS
 #endif
 
-#if __HAIKU_ARCH_PHYSICAL_BITS == 32
-#	define __HAIKU_ARCH_PHYSICAL_32_BIT	1
-#elif __HAIKU_ARCH_PHYSICAL_BITS == 64
-#	define __HAIKU_ARCH_PHYSICAL_64_BIT	1
+#if __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_BITS == 32
+#	define __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_32_BIT	1
+#elif __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_BITS == 64
+#	define __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_64_BIT	1
 #else
 #	error Unsupported physical bitness!
 #endif
 
 /* endianess */
-#ifndef __HAIKU_BIG_ENDIAN
-#	define	__HAIKU_LITTLE_ENDIAN	1
+#ifndef __HAIKU_BUILD_HAIKU_BIG_ENDIAN
+#	define	__HAIKU_BUILD_HAIKU_LITTLE_ENDIAN	1
 #endif
 
 /* architecture specific include macros */
-#define __HAIKU_ARCH_HEADER(header)					<arch/__HAIKU_ARCH/header>
+#define __HAIKU_BUILD_HAIKU_ARCH_HEADER(header)		<arch/__HAIKU_ARCH/header>
+#define __HAIKU_BUILD_HAIKU_SUBDIR_ARCH_HEADER(subdir, header)	\
+	<subdir/arch/__HAIKU_BUILD_HAIKU_ARCH/header>
+
+
+/* map the macros, if not building the libroot mapper functions */
+
+#ifndef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+
+#define __HAIKU_ARCH				__HAIKU_BUILD_HAIKU_ARCH
+#define __HAIKU_ARCH_BITS			__HAIKU_BUILD_HAIKU_ARCH_BITS
+#define __HAIKU_ARCH_PHYSICAL_BITS	__HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_BITS
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_X86
+#	define __HAIKU_ARCH_X86	__HAIKU_BUILD_HAIKU_ARCH_X86
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_X86_64
+#	define __HAIKU_ARCH_X86_64	__HAIKU_BUILD_HAIKU_ARCH_X86_64
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_PPC
+#	define __HAIKU_ARCH_PPC	__HAIKU_BUILD_HAIKU_ARCH_PPC
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_M68K
+#	define __HAIKU_ARCH_M68K	__HAIKU_BUILD_HAIKU_ARCH_M68K
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_MIPSEL
+#	define __HAIKU_ARCH_MIPSEL	__HAIKU_BUILD_HAIKU_ARCH_MIPSEL
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_ARM
+#	define __HAIKU_ARCH_ARM	__HAIKU_BUILD_HAIKU_ARCH_ARM
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_32_BIT
+#	define __HAIKU_ARCH_32_BIT	__HAIKU_BUILD_HAIKU_ARCH_32_BIT
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_64_BIT
+#	define __HAIKU_ARCH_64_BIT	__HAIKU_BUILD_HAIKU_ARCH_64_BIT
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_32_BIT
+#	define __HAIKU_ARCH_PHYSICAL_32_BIT	__HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_32_BIT
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_64_BIT
+#	define __HAIKU_ARCH_PHYSICAL_64_BIT	__HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_64_BIT
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_LITTLE_ENDIAN
+#	define __HAIKU_ARCH_LITTLE_ENDIAN	__HAIKU_BUILD_HAIKU_ARCH_LITTLE_ENDIAN
+#endif
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_BIG_ENDIAN
+#	define __HAIKU_ARCH_BIG_ENDIAN	__HAIKU_BUILD_HAIKU_ARCH_BIG_ENDIAN
+#endif
+
+
+#define __HAIKU_ARCH_HEADER(header)	__HAIKU_BUILD_HAIKU_ARCH_HEADER(header)
 #define __HAIKU_SUBDIR_ARCH_HEADER(subdir, header)	\
-	<subdir/arch/__HAIKU_ARCH/header>
+	__HAIKU_BUILD_HAIKU_SUBDIR_ARCH_HEADER(subdir, header)
 
+#endif	/* _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER */
 
 #endif	/* _CONFIG_HAIKU_CONFIG_H */
diff --git a/headers/build/config_build/types.h b/headers/build/config_build/types.h
index 960e1ce..53da55d 100644
--- a/headers/build/config_build/types.h
+++ b/headers/build/config_build/types.h
@@ -6,9 +6,9 @@
 #define _CONFIG_BUILD_TYPES_H
 
 
-#include <config_build/HaikuConfig.h>
+#include <HaikuBuild.h>
 
-#include <inttypes.h>
+#include <config_build/HaikuConfig.h>
 
 
 /* fixed-width types -- the __haiku_std_[u]int* types correspond to the POSIX
@@ -16,97 +16,154 @@
    __HAIKU_BEOS_COMPATIBLE_TYPES is not defined both sets are identical. Once
    we drop compatibility for good, we can consolidate the types.
 */
-typedef int8_t				__haiku_std_int8;
-typedef uint8_t				__haiku_std_uint8;
-typedef int16_t				__haiku_std_int16;
-typedef uint16_t			__haiku_std_uint16;
-typedef int32_t				__haiku_std_int32;
-typedef uint32_t			__haiku_std_uint32;
-typedef int64_t				__haiku_std_int64;
-typedef uint64_t			__haiku_std_uint64;
-
-typedef __haiku_std_int8	__haiku_int8;
-typedef __haiku_std_uint8	__haiku_uint8;
-typedef __haiku_std_int16	__haiku_int16;
-typedef __haiku_std_uint16	__haiku_uint16;
-typedef __haiku_std_int32	__haiku_int32;
-typedef __haiku_std_uint32	__haiku_uint32;
-typedef __haiku_std_int64	__haiku_int64;
-typedef __haiku_std_uint64	__haiku_uint64;
+typedef _HAIKU_BUILD_FEATURE_int8	__haiku_build_haiku_std_int8;
+typedef _HAIKU_BUILD_FEATURE_uint8	__haiku_build_haiku_std_uint8;
+typedef _HAIKU_BUILD_FEATURE_int16	__haiku_build_haiku_std_int16;
+typedef _HAIKU_BUILD_FEATURE_uint16	__haiku_build_haiku_std_uint16;
+typedef _HAIKU_BUILD_FEATURE_int32	__haiku_build_haiku_std_int32;
+typedef _HAIKU_BUILD_FEATURE_uint32	__haiku_build_haiku_std_uint32;
+typedef _HAIKU_BUILD_FEATURE_int64	__haiku_build_haiku_std_int64;
+typedef _HAIKU_BUILD_FEATURE_uint64	__haiku_build_haiku_std_uint64;
+
+typedef __haiku_build_haiku_std_int8	__haiku_build_haiku_int8;
+typedef __haiku_build_haiku_std_uint8	__haiku_build_haiku_uint8;
+typedef __haiku_build_haiku_std_int16	__haiku_build_haiku_int16;
+typedef __haiku_build_haiku_std_uint16	__haiku_build_haiku_uint16;
+typedef __haiku_build_haiku_std_int32	__haiku_build_haiku_int32;
+typedef __haiku_build_haiku_std_uint32	__haiku_build_haiku_uint32;
+typedef __haiku_build_haiku_std_int64	__haiku_build_haiku_int64;
+typedef __haiku_build_haiku_std_uint64	__haiku_build_haiku_uint64;
 
 /* address types */
-#ifdef __HAIKU_ARCH_64_BIT
-	typedef	__haiku_int64	__haiku_saddr_t;
-	typedef	__haiku_uint64	__haiku_addr_t;
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_64_BIT
+	typedef	__haiku_build_haiku_int64	__haiku_build_haiku_saddr_t;
+	typedef	__haiku_build_haiku_uint64	__haiku_build_haiku_addr_t;
 #else
-	typedef	__haiku_int32	__haiku_saddr_t;
-	typedef	__haiku_uint32	__haiku_addr_t;
+	typedef	__haiku_build_haiku_int32	__haiku_build_haiku_saddr_t;
+	typedef	__haiku_build_haiku_uint32	__haiku_build_haiku_addr_t;
 #endif
 
-#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
-	typedef	__haiku_int64	__haiku_phys_saddr_t;
-	typedef	__haiku_uint64	__haiku_phys_addr_t;
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_64_BIT
+	typedef	__haiku_build_haiku_int64	__haiku_build_haiku_phys_saddr_t;
+	typedef	__haiku_build_haiku_uint64	__haiku_build_haiku_phys_addr_t;
 #else
-	typedef	__haiku_int32	__haiku_phys_saddr_t;
-	typedef	__haiku_uint32	__haiku_phys_addr_t;
+	typedef	__haiku_build_haiku_int32	__haiku_build_haiku_phys_saddr_t;
+	typedef	__haiku_build_haiku_uint32	__haiku_build_haiku_phys_addr_t;
 #endif
 
 /* address type limits */
-#ifdef __HAIKU_ARCH_64_BIT
-#	define __HAIKU_SADDR_MAX		(9223372036854775807LL)
-#	define __HAIKU_ADDR_MAX			(18446744073709551615ULL)
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_64_BIT
+#	define __HAIKU_BUILD_HAIKU_SADDR_MAX		(9223372036854775807LL)
+#	define __HAIKU_BUILD_HAIKU_ADDR_MAX			(18446744073709551615ULL)
 #else
-#	define __HAIKU_SADDR_MAX		(2147483647)
-#	define __HAIKU_ADDR_MAX			(4294967295U)
+#	define __HAIKU_BUILD_HAIKU_SADDR_MAX		(2147483647)
+#	define __HAIKU_BUILD_HAIKU_ADDR_MAX			(4294967295U)
 #endif
-#define __HAIKU_SADDR_MIN			(-__HAIKU_SADDR_MAX-1)
+#define __HAIKU_BUILD_HAIKU_SADDR_MIN		(-__HAIKU_BUILD_HAIKU_SADDR_MAX-1)
 
-#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
-#	define __HAIKU_PHYS_SADDR_MAX	(9223372036854775807LL)
-#	define __HAIKU_PHYS_ADDR_MAX	(18446744073709551615ULL)
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_64_BIT
+#	define __HAIKU_BUILD_HAIKU_PHYS_SADDR_MAX	(9223372036854775807LL)
+#	define __HAIKU_BUILD_HAIKU_PHYS_ADDR_MAX	(18446744073709551615ULL)
 #else
-#	define __HAIKU_PHYS_SADDR_MAX	(2147483647)
-#	define __HAIKU_PHYS_ADDR_MAX	(4294967295U)
+#	define __HAIKU_BUILD_HAIKU_PHYS_SADDR_MAX	(2147483647)
+#	define __HAIKU_BUILD_HAIKU_PHYS_ADDR_MAX	(4294967295U)
 #endif
-#define __HAIKU_PHYS_SADDR_MIN		(-__HAIKU_SADDR_MAX-1)
+#define __HAIKU_BUILD_HAIKU_PHYS_SADDR_MIN	(-__HAIKU_BUILD_HAIKU_SADDR_MAX-1)
 
 
 /* printf()/scanf() format prefixes */
-/* TODO: The following are only guesses! We should define them in the
-   build/host headers. */
-#define	__HAIKU_STD_PRI_PREFIX_32	""
-#ifdef __HAIKU_ARCH_64_BIT
-#	define __HAIKU_STD_PRI_PREFIX_64	"l"
+#define	__HAIKU_BUILD_HAIKU_STD_PRI_PREFIX_32	\
+	_HAIKU_BUILD_FEATURE_FORMAT_PREFIX_int32
+#define __HAIKU_BUILD_HAIKU_STD_PRI_PREFIX_64	\
+	_HAIKU_BUILD_FEATURE_FORMAT_PREFIX_int64
+
+#define	__HAIKU_BUILD_HAIKU_PRI_PREFIX_32	\
+	__HAIKU_BUILD_HAIKU_STD_PRI_PREFIX_32
+#define	__HAIKU_BUILD_HAIKU_PRI_PREFIX_64	\
+	__HAIKU_BUILD_HAIKU_STD_PRI_PREFIX_64
+
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_64_BIT
+#	define __HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR	\
+		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64
 #else
-#	define __HAIKU_STD_PRI_PREFIX_64	"ll"
+#	define __HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR	\
+		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32
 #endif
 
-#define	__HAIKU_PRI_PREFIX_32		__HAIKU_STD_PRI_PREFIX_32
-#define	__HAIKU_PRI_PREFIX_64		__HAIKU_STD_PRI_PREFIX_64
-
-#ifdef __HAIKU_ARCH_64_BIT
-#	define __HAIKU_PRI_PREFIX_ADDR	__HAIKU_PRI_PREFIX_64
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_64_BIT
+#	define __HAIKU_BUILD_HAIKU_PRI_PREFIX_PHYS_ADDR	\
+		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64
 #else
-#	define __HAIKU_PRI_PREFIX_ADDR	__HAIKU_PRI_PREFIX_32
-#endif
-
-#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
-#	define __HAIKU_PRI_PREFIX_PHYS_ADDR	__HAIKU_PRI_PREFIX_64
-#else
-#	define __HAIKU_PRI_PREFIX_PHYS_ADDR	__HAIKU_PRI_PREFIX_32
+#	define __HAIKU_BUILD_HAIKU_PRI_PREFIX_PHYS_ADDR	\
+		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32
 #endif
 
 
 /* a generic address type wide enough for virtual and physical addresses */
-#if __HAIKU_ARCH_BITS >= __HAIKU_ARCH_PHYSICAL_BITS
-	typedef __haiku_addr_t					__haiku_generic_addr_t;
-#	define __HAIKU_GENERIC_ADDR_MAX			__HAIKU_ADDR_MAX
-#	define __HAIKU_PRI_PREFIX_GENERIC_ADDR	__HAIKU_PRI_PREFIX_ADDR
+#if __HAIKU_BUILD_HAIKU_ARCH_BITS >= __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_BITS
+	typedef __haiku_build_haiku_addr_t		__haiku_build_haiku_generic_addr_t;
+#	define __HAIKU_BUILD_HAIKU_GENERIC_ADDR_MAX			\
+		__HAIKU_BUILD_HAIKU_ADDR_MAX
+#	define __HAIKU_BUILD_HAIKU_PRI_PREFIX_GENERIC_ADDR	\
+		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR
 #else
-	typedef __haiku_phys_addr_t				__haiku_generic_addr_t;
-#	define __HAIKU_GENERIC_ADDR_MAX			__HAIKU_PHYS_ADDR_MAX
-#	define __HAIKU_PRI_PREFIX_GENERIC_ADDR	__HAIKU_PRI_PREFIX_PHYS_ADDR
+	typedef __haiku_build_haiku_phys_addr_t	__haiku_build_haiku_generic_addr_t;
+#	define __HAIKU_BUILD_HAIKU_GENERIC_ADDR_MAX			\
+		__HAIKU_BUILD_HAIKU_PHYS_ADDR_MAX
+#	define __HAIKU_BUILD_HAIKU_PRI_PREFIX_GENERIC_ADDR	\
+		__HAIKU_BUILD_HAIKU_PRI_PREFIX_PHYS_ADDR
 #endif
 
 
+/* map the macros/types, if not building the libroot mapper functions */
+
+#ifndef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+
+typedef __haiku_build_haiku_std_int8	__haiku_std_int8;
+typedef __haiku_build_haiku_std_uint8	__haiku_std_uint8;
+typedef __haiku_build_haiku_std_int16	__haiku_std_int16;
+typedef __haiku_build_haiku_std_uint16	__haiku_std_uint16;
+typedef __haiku_build_haiku_std_int32	__haiku_std_int32;
+typedef __haiku_build_haiku_std_uint32	__haiku_std_uint32;
+typedef __haiku_build_haiku_std_int64	__haiku_std_int64;
+typedef __haiku_build_haiku_std_uint64	__haiku_std_uint64;
+
+typedef __haiku_build_haiku_int8	__haiku_int8;
+typedef __haiku_build_haiku_uint8	__haiku_uint8;
+typedef __haiku_build_haiku_int16	__haiku_int16;
+typedef __haiku_build_haiku_uint16	__haiku_uint16;
+typedef __haiku_build_haiku_int32	__haiku_int32;
+typedef __haiku_build_haiku_uint32	__haiku_uint32;
+typedef __haiku_build_haiku_int64	__haiku_int64;
+typedef __haiku_build_haiku_uint64	__haiku_uint64;
+
+typedef	__haiku_build_haiku_saddr_t			__haiku_saddr_t;
+typedef	__haiku_build_haiku_addr_t			__haiku_addr_t;
+typedef	__haiku_build_haiku_phys_saddr_t	__haiku_phys_saddr_t;
+typedef	__haiku_build_haiku_phys_addr_t		__haiku_phys_addr_t;
+
+#define __HAIKU_SADDR_MAX	__HAIKU_BUILD_HAIKU_SADDR_MAX
+#define __HAIKU_ADDR_MAX	__HAIKU_BUILD_HAIKU_ADDR_MAX
+#define __HAIKU_SADDR_MIN	__HAIKU_BUILD_HAIKU_SADDR_MIN
+
+#define __HAIKU_PHYS_SADDR_MAX	__HAIKU_BUILD_HAIKU_PHYS_SADDR_MAX
+#define __HAIKU_PHYS_ADDR_MAX	__HAIKU_BUILD_HAIKU_PHYS_ADDR_MAX
+#define __HAIKU_PHYS_SADDR_MIN	__HAIKU_BUILD_HAIKU_PHYS_SADDR_MIN
+
+#define	__HAIKU_STD_PRI_PREFIX_32	__HAIKU_BUILD_HAIKU_STD_PRI_PREFIX_32
+#define __HAIKU_STD_PRI_PREFIX_64	__HAIKU_BUILD_HAIKU_STD_PRI_PREFIX_64
+
+#define	__HAIKU_PRI_PREFIX_32	__HAIKU_BUILD_HAIKU_PRI_PREFIX_32
+#define	__HAIKU_PRI_PREFIX_64	__HAIKU_BUILD_HAIKU_PRI_PREFIX_64
+
+#define __HAIKU_PRI_PREFIX_ADDR			__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR
+#define __HAIKU_PRI_PREFIX_PHYS_ADDR	__HAIKU_BUILD_HAIKU_PRI_PREFIX_PHYS_ADDR
+
+typedef __haiku_build_haiku_generic_addr_t		__haiku_generic_addr_t;
+#define __HAIKU_GENERIC_ADDR_MAX	__HAIKU_BUILD_HAIKU_GENERIC_ADDR_MAX
+#define __HAIKU_PRI_PREFIX_GENERIC_ADDR		\
+	__HAIKU_BUILD_HAIKU_PRI_PREFIX_GENERIC_ADDR
+
+#endif	/* _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER */
+
 #endif	/* _CONFIG_BUILD_TYPES_H */
diff --git a/headers/build/os/BeBuild.h b/headers/build/os/BeBuild.h
index 3130e03..6c34e0d 100644
--- a/headers/build/os/BeBuild.h
+++ b/headers/build/os/BeBuild.h
@@ -2,81 +2,86 @@
  * Copyright 2007-2010, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  */
-#ifndef _BE_BUILD_H
-#define _BE_BUILD_H
+#ifndef _HAIKU_BUILD_BE_BUILD_H
+#define _HAIKU_BUILD_BE_BUILD_H
 
 
 #include <config_build/HaikuConfig.h>
 
 
-#define B_BEOS_VERSION_4				0x0400
-#define B_BEOS_VERSION_4_5				0x0450
-#define B_BEOS_VERSION_5				0x0500
+#define HAIKU_BUILD_B_BEOS_VERSION_4				0x0400
+#define HAIKU_BUILD_B_BEOS_VERSION_4_5				0x0450
+#define HAIKU_BUILD_B_BEOS_VERSION_5				0x0500
 
-#define B_BEOS_VERSION					B_BEOS_VERSION_5
-#define B_BEOS_VERSION_MAUI				B_BEOS_VERSION_5
+#define HAIKU_BUILD_B_BEOS_VERSION					HAIKU_BUILD_B_BEOS_VERSION_5
+#define HAIKU_BUILD_B_BEOS_VERSION_MAUI				HAIKU_BUILD_B_BEOS_VERSION_5
 
 /* Haiku (API) version */
-#define B_HAIKU_VERSION_BEOS			0x00000001
-#define B_HAIKU_VERSION_BONE			0x00000002
-#define B_HAIKU_VERSION_DANO			0x00000003
-#define B_HAIKU_VERSION_1_ALPHA_1		0x00000100
-#define B_HAIKU_VERSION_1_PRE_ALPHA_2	0x00000101
-#define B_HAIKU_VERSION_1				0x00010000
+#define HAIKU_BUILD_B_HAIKU_VERSION_BEOS			0x00000001
+#define HAIKU_BUILD_B_HAIKU_VERSION_BONE			0x00000002
+#define HAIKU_BUILD_B_HAIKU_VERSION_DANO			0x00000003
+#define HAIKU_BUILD_B_HAIKU_VERSION_1_ALPHA_1		0x00000100
+#define HAIKU_BUILD_B_HAIKU_VERSION_1_PRE_ALPHA_2	0x00000101
+#define HAIKU_BUILD_B_HAIKU_VERSION_1				0x00010000
 
-#define B_HAIKU_VERSION					B_HAIKU_VERSION_1_PRE_ALPHA_2
+#define HAIKU_BUILD_B_HAIKU_VERSION					\
+	HAIKU_BUILD_B_HAIKU_VERSION_1_PRE_ALPHA_2
 
 /* Haiku ABI */
-#define B_HAIKU_ABI_MAJOR				0xffff0000
-#define B_HAIKU_ABI_GCC_2				0x00020000
-#define B_HAIKU_ABI_GCC_4				0x00040000
+#define HAIKU_BUILD_B_HAIKU_ABI_MAJOR				0xffff0000
+#define HAIKU_BUILD_B_HAIKU_ABI_GCC_2				0x00020000
+#define HAIKU_BUILD_B_HAIKU_ABI_GCC_4				0x00040000
 
-#define B_HAIKU_ABI_GCC_2_ANCIENT		0x00020000
-#define B_HAIKU_ABI_GCC_2_BEOS			0x00020001
-#define B_HAIKU_ABI_GCC_2_HAIKU			0x00020002
+#define HAIKU_BUILD_B_HAIKU_ABI_GCC_2_ANCIENT		0x00020000
+#define HAIKU_BUILD_B_HAIKU_ABI_GCC_2_BEOS			0x00020001
+#define HAIKU_BUILD_B_HAIKU_ABI_GCC_2_HAIKU			0x00020002
 
 #if __GNUC__ == 2
-#	define B_HAIKU_ABI					B_HAIKU_ABI_GCC_2_HAIKU
+#	define HAIKU_BUILD_B_HAIKU_ABI					\
+		HAIKU_BUILD_B_HAIKU_ABI_GCC_2_HAIKU
 #elif __GNUC__ == 3 || __GNUC__ == 4
-#	define B_HAIKU_ABI					B_HAIKU_ABI_GCC_4
+#	define HAIKU_BUILD_B_HAIKU_ABI					\
+		HAIKU_BUILD_B_HAIKU_ABI_GCC_4
 #else
 #	error Unsupported gcc version!
 #endif
 
 
-#define B_HAIKU_BITS					__HAIKU_ARCH_BITS
-#define B_HAIKU_PHYSICAL_BITS			__HAIKU_ARCH_PHYSICAL_BITS
+#define HAIKU_BUILD_B_HAIKU_BITS					\
+	__HAIKU_BUILD_HAIKU_ARCH_BITS
+#define HAIKU_BUILD_B_HAIKU_PHYSICAL_BITS			\
+	__HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_BITS
 
-#ifdef __HAIKU_ARCH_64_BIT
-#	define B_HAIKU_64_BIT				1
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_64_BIT
+#	define HAIKU_BUILD_B_HAIKU_64_BIT				1
 #else
-#	define B_HAIKU_32_BIT				1
+#	define HAIKU_BUILD_B_HAIKU_32_BIT				1
 #endif
 
-#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
-#	define B_HAIKU_PHYSICAL_64_BIT		1
+#ifdef __HAIKU_BUILD_HAIKU_ARCH_PHYSICAL_64_BIT
+#	define HAIKU_BUILD_B_HAIKU_PHYSICAL_64_BIT		1
 #else
-#	define B_HAIKU_PHYSICAL_32_BIT		1
+#	define HAIKU_BUILD_B_HAIKU_PHYSICAL_32_BIT		1
 #endif
 
-#ifdef __HAIKU_BEOS_COMPATIBLE
-#	define B_HAIKU_BEOS_COMPATIBLE		1
+#ifdef __HAIKU_BUILD_HAIKU_BEOS_COMPATIBLE
+#	define HAIKU_BUILD_B_HAIKU_BEOS_COMPATIBLE		1
 #endif
 
 
-#define _UNUSED(argument) argument
-#define _PACKED __attribute__((packed))
-#define _PRINTFLIKE(_format_, _args_) \
+#define _HAIKU_BUILD_UNUSED(argument) argument
+#define _HAIKU_BUILD_PACKED __attribute__((packed))
+#define _HAIKU_BUILD_PRINTFLIKE(_format_, _args_) \
 	__attribute__((format(__printf__, _format_, _args_)))
-#define _EXPORT
-#define _IMPORT
+#define _HAIKU_BUILD_EXPORT
+#define _HAIKU_BUILD_IMPORT
 
 #define B_DEFINE_SYMBOL_VERSION(function, versionedSymbol)	\
 	__asm__(".symver " function "," versionedSymbol)
 
 
-#define _IMPEXP_ROOT
-#define _IMPEXP_BE
+#define _HAIKU_BUILD_IMPEXP_ROOT
+#define _HAIKU_BUILD_IMPEXP_BE
 
 
-#endif	/* _BE_BUILD_H */
+#endif	/* _HAIKU_BUILD_BE_BUILD_H */
diff --git a/headers/build/os/storage/FindDirectory.h b/headers/build/os/storage/FindDirectory.h
index 96124a9..83721e2 100644
--- a/headers/build/os/storage/FindDirectory.h
+++ b/headers/build/os/storage/FindDirectory.h
@@ -1 +1,270 @@
-#include <../os/storage/FindDirectory.h>
+/*
+ * Copyright 2002-2009, Haiku Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_FIND_DIRECTORY_H
+#define _HAIKU_BUILD_FIND_DIRECTORY_H
+
+
+#include <HaikuBuild.h>
+
+#include <SupportDefs.h>
+
+
+typedef enum {
+	/* Per volume directories */
+	HAIKU_BUILD_B_DESKTOP_DIRECTORY					= 0,
+	HAIKU_BUILD_B_TRASH_DIRECTORY,
+
+	/* System directories */
+	HAIKU_BUILD_B_SYSTEM_DIRECTORY					= 1000,
+	HAIKU_BUILD_B_SYSTEM_ADDONS_DIRECTORY			= 1002,
+	HAIKU_BUILD_B_SYSTEM_BOOT_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_FONTS_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_LIB_DIRECTORY,
+ 	HAIKU_BUILD_B_SYSTEM_SERVERS_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_APPS_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_BIN_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_DOCUMENTATION_DIRECTORY	= 1010,
+	HAIKU_BUILD_B_SYSTEM_PREFERENCES_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_TRANSLATORS_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_MEDIA_NODES_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_SOUNDS_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_DATA_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_DEVELOP_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_PACKAGES_DIRECTORY,
+	HAIKU_BUILD_B_SYSTEM_HEADERS_DIRECTORY,
+
+	/* Common directories, shared among all users. */
+	HAIKU_BUILD_B_COMMON_DIRECTORY					= 2000,
+	HAIKU_BUILD_B_COMMON_SYSTEM_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_ADDONS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_BOOT_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_FONTS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_LIB_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_SERVERS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_BIN_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_ETC_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_DOCUMENTATION_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_SETTINGS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_DEVELOP_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_LOG_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_SPOOL_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_TEMP_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_VAR_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_TRANSLATORS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_MEDIA_NODES_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_SOUNDS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_DATA_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_CACHE_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_PACKAGES_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_HEADERS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_ADDONS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_TRANSLATORS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_MEDIA_NODES_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_BIN_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_DATA_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_FONTS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_SOUNDS_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_DOCUMENTATION_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_LIB_DIRECTORY,
+	HAIKU_BUILD_B_COMMON_NONPACKAGED_HEADERS_DIRECTORY,
+
+	/* User directories. These are interpreted in the context
+	   of the user making the find_directory call. */
+	HAIKU_BUILD_B_USER_DIRECTORY					= 3000,
+	HAIKU_BUILD_B_USER_CONFIG_DIRECTORY,
+	HAIKU_BUILD_B_USER_ADDONS_DIRECTORY,
+	HAIKU_BUILD_B_USER_BOOT_DIRECTORY,
+	HAIKU_BUILD_B_USER_FONTS_DIRECTORY,
+	HAIKU_BUILD_B_USER_LIB_DIRECTORY,
+	HAIKU_BUILD_B_USER_SETTINGS_DIRECTORY,
+	HAIKU_BUILD_B_USER_DESKBAR_DIRECTORY,
+	HAIKU_BUILD_B_USER_PRINTERS_DIRECTORY,
+	HAIKU_BUILD_B_USER_TRANSLATORS_DIRECTORY,
+	HAIKU_BUILD_B_USER_MEDIA_NODES_DIRECTORY,
+	HAIKU_BUILD_B_USER_SOUNDS_DIRECTORY,
+	HAIKU_BUILD_B_USER_DATA_DIRECTORY,
+	HAIKU_BUILD_B_USER_CACHE_DIRECTORY,
+	HAIKU_BUILD_B_USER_PACKAGES_DIRECTORY,
+	HAIKU_BUILD_B_USER_HEADERS_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_ADDONS_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_TRANSLATORS_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_MEDIA_NODES_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_BIN_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_DATA_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_FONTS_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_SOUNDS_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_DOCUMENTATION_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_LIB_DIRECTORY,
+	HAIKU_BUILD_B_USER_NONPACKAGED_HEADERS_DIRECTORY,
+
+	/* Global directories. */
+	HAIKU_BUILD_B_APPS_DIRECTORY					= 4000,
+	HAIKU_BUILD_B_PREFERENCES_DIRECTORY,
+	HAIKU_BUILD_B_UTILITIES_DIRECTORY,
+	HAIKU_BUILD_B_PACKAGE_LINKS_DIRECTORY,
+
+	/* Obsolete: Legacy BeOS definition to be phased out */
+	HAIKU_BUILD_B_BEOS_DIRECTORY					= 1000,
+	HAIKU_BUILD_B_BEOS_SYSTEM_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_ADDONS_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_BOOT_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_FONTS_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_LIB_DIRECTORY,
+ 	HAIKU_BUILD_B_BEOS_SERVERS_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_APPS_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_BIN_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_ETC_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_DOCUMENTATION_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_PREFERENCES_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_TRANSLATORS_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_MEDIA_NODES_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_SOUNDS_DIRECTORY,
+	HAIKU_BUILD_B_BEOS_DATA_DIRECTORY,
+} haiku_build_directory_which;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* C interface */
+
+_HAIKU_BUILD_DECLARE_FUNCTION(
+	status_t, find_directory,
+		(directory_which which, dev_t volume, bool createIt,
+		char* pathString, int32 length))
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#ifndef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+
+#define B_DESKTOP_DIRECTORY	HAIKU_BUILD_B_DESKTOP_DIRECTORY
+#define B_TRASH_DIRECTORY	HAIKU_BUILD_B_TRASH_DIRECTORY
+
+#define B_SYSTEM_DIRECTORY					HAIKU_BUILD_B_SYSTEM_DIRECTORY				
+#define B_SYSTEM_ADDONS_DIRECTORY			HAIKU_BUILD_B_SYSTEM_ADDONS_DIRECTORY			
+#define B_SYSTEM_BOOT_DIRECTORY				HAIKU_BUILD_B_SYSTEM_BOOT_DIRECTORY
+#define B_SYSTEM_FONTS_DIRECTORY			HAIKU_BUILD_B_SYSTEM_FONTS_DIRECTORY
+#define B_SYSTEM_LIB_DIRECTORY				HAIKU_BUILD_B_SYSTEM_LIB_DIRECTORY
+ #define B_SYSTEM_SERVERS_DIRECTORY			HAIKU_BUILD_B_SYSTEM_SERVERS_DIRECTORY
+#define B_SYSTEM_APPS_DIRECTORY				HAIKU_BUILD_B_SYSTEM_APPS_DIRECTORY
+#define B_SYSTEM_BIN_DIRECTORY				HAIKU_BUILD_B_SYSTEM_BIN_DIRECTORY
+#define B_SYSTEM_DOCUMENTATION_DIRECTORY	HAIKU_BUILD_B_SYSTEM_DOCUMENTATION_DIRECTORY	
+#define B_SYSTEM_PREFERENCES_DIRECTORY		HAIKU_BUILD_B_SYSTEM_PREFERENCES_DIRECTORY
+#define B_SYSTEM_TRANSLATORS_DIRECTORY		HAIKU_BUILD_B_SYSTEM_TRANSLATORS_DIRECTORY
+#define B_SYSTEM_MEDIA_NODES_DIRECTORY		HAIKU_BUILD_B_SYSTEM_MEDIA_NODES_DIRECTORY
+#define B_SYSTEM_SOUNDS_DIRECTORY			HAIKU_BUILD_B_SYSTEM_SOUNDS_DIRECTORY
+#define B_SYSTEM_DATA_DIRECTORY				HAIKU_BUILD_B_SYSTEM_DATA_DIRECTORY
+#define B_SYSTEM_DEVELOP_DIRECTORY			HAIKU_BUILD_B_SYSTEM_DEVELOP_DIRECTORY
+#define B_SYSTEM_PACKAGES_DIRECTORY			HAIKU_BUILD_B_SYSTEM_PACKAGES_DIRECTORY
+#define B_SYSTEM_HEADERS_DIRECTORY			HAIKU_BUILD_B_SYSTEM_HEADERS_DIRECTORY
+
+#define B_COMMON_DIRECTORY					HAIKU_BUILD_B_COMMON_DIRECTORY				
+#define B_COMMON_SYSTEM_DIRECTORY			HAIKU_BUILD_B_COMMON_SYSTEM_DIRECTORY
+#define B_COMMON_ADDONS_DIRECTORY			HAIKU_BUILD_B_COMMON_ADDONS_DIRECTORY
+#define B_COMMON_BOOT_DIRECTORY				HAIKU_BUILD_B_COMMON_BOOT_DIRECTORY
+#define B_COMMON_FONTS_DIRECTORY			HAIKU_BUILD_B_COMMON_FONTS_DIRECTORY
+#define B_COMMON_LIB_DIRECTORY				HAIKU_BUILD_B_COMMON_LIB_DIRECTORY
+#define B_COMMON_SERVERS_DIRECTORY			HAIKU_BUILD_B_COMMON_SERVERS_DIRECTORY
+#define B_COMMON_BIN_DIRECTORY				HAIKU_BUILD_B_COMMON_BIN_DIRECTORY
+#define B_COMMON_ETC_DIRECTORY				HAIKU_BUILD_B_COMMON_ETC_DIRECTORY
+#define B_COMMON_DOCUMENTATION_DIRECTORY	HAIKU_BUILD_B_COMMON_DOCUMENTATION_DIRECTORY
+#define B_COMMON_SETTINGS_DIRECTORY			HAIKU_BUILD_B_COMMON_SETTINGS_DIRECTORY
+#define B_COMMON_DEVELOP_DIRECTORY			HAIKU_BUILD_B_COMMON_DEVELOP_DIRECTORY
+#define B_COMMON_LOG_DIRECTORY				HAIKU_BUILD_B_COMMON_LOG_DIRECTORY
+#define B_COMMON_SPOOL_DIRECTORY			HAIKU_BUILD_B_COMMON_SPOOL_DIRECTORY
+#define B_COMMON_TEMP_DIRECTORY				HAIKU_BUILD_B_COMMON_TEMP_DIRECTORY
+#define B_COMMON_VAR_DIRECTORY				HAIKU_BUILD_B_COMMON_VAR_DIRECTORY
+#define B_COMMON_TRANSLATORS_DIRECTORY		HAIKU_BUILD_B_COMMON_TRANSLATORS_DIRECTORY
+#define B_COMMON_MEDIA_NODES_DIRECTORY		HAIKU_BUILD_B_COMMON_MEDIA_NODES_DIRECTORY
+#define B_COMMON_SOUNDS_DIRECTORY			HAIKU_BUILD_B_COMMON_SOUNDS_DIRECTORY
+#define B_COMMON_DATA_DIRECTORY				HAIKU_BUILD_B_COMMON_DATA_DIRECTORY
+#define B_COMMON_CACHE_DIRECTORY			HAIKU_BUILD_B_COMMON_CACHE_DIRECTORY
+#define B_COMMON_PACKAGES_DIRECTORY			HAIKU_BUILD_B_COMMON_PACKAGES_DIRECTORY
+#define B_COMMON_HEADERS_DIRECTORY			HAIKU_BUILD_B_COMMON_HEADERS_DIRECTORY
+#define B_COMMON_NONPACKAGED_DIRECTORY		HAIKU_BUILD_B_COMMON_NONPACKAGED_DIRECTORY
+#define B_COMMON_NONPACKAGED_ADDONS_DIRECTORY		HAIKU_BUILD_B_COMMON_NONPACKAGED_ADDONS_DIRECTORY
+#define B_COMMON_NONPACKAGED_TRANSLATORS_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_TRANSLATORS_DIRECTORY
+#define B_COMMON_NONPACKAGED_MEDIA_NODES_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_MEDIA_NODES_DIRECTORY
+#define B_COMMON_NONPACKAGED_BIN_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_BIN_DIRECTORY
+#define B_COMMON_NONPACKAGED_DATA_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_DATA_DIRECTORY
+#define B_COMMON_NONPACKAGED_FONTS_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_FONTS_DIRECTORY
+#define B_COMMON_NONPACKAGED_SOUNDS_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_SOUNDS_DIRECTORY
+#define B_COMMON_NONPACKAGED_DOCUMENTATION_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_DOCUMENTATION_DIRECTORY
+#define B_COMMON_NONPACKAGED_LIB_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_LIB_DIRECTORY
+#define B_COMMON_NONPACKAGED_HEADERS_DIRECTORY	HAIKU_BUILD_B_COMMON_NONPACKAGED_HEADERS_DIRECTORY
+
+#define B_USER_DIRECTORY				HAIKU_BUILD_B_USER_DIRECTORY					
+#define B_USER_CONFIG_DIRECTORY			HAIKU_BUILD_B_USER_CONFIG_DIRECTORY
+#define B_USER_ADDONS_DIRECTORY			HAIKU_BUILD_B_USER_ADDONS_DIRECTORY
+#define B_USER_BOOT_DIRECTORY			HAIKU_BUILD_B_USER_BOOT_DIRECTORY
+#define B_USER_FONTS_DIRECTORY			HAIKU_BUILD_B_USER_FONTS_DIRECTORY
+#define B_USER_LIB_DIRECTORY			HAIKU_BUILD_B_USER_LIB_DIRECTORY
+#define B_USER_SETTINGS_DIRECTORY		HAIKU_BUILD_B_USER_SETTINGS_DIRECTORY
+#define B_USER_DESKBAR_DIRECTORY		HAIKU_BUILD_B_USER_DESKBAR_DIRECTORY
+#define B_USER_PRINTERS_DIRECTORY		HAIKU_BUILD_B_USER_PRINTERS_DIRECTORY
+#define B_USER_TRANSLATORS_DIRECTORY	HAIKU_BUILD_B_USER_TRANSLATORS_DIRECTORY
+#define B_USER_MEDIA_NODES_DIRECTORY	HAIKU_BUILD_B_USER_MEDIA_NODES_DIRECTORY
+#define B_USER_SOUNDS_DIRECTORY			HAIKU_BUILD_B_USER_SOUNDS_DIRECTORY
+#define B_USER_DATA_DIRECTORY			HAIKU_BUILD_B_USER_DATA_DIRECTORY
+#define B_USER_CACHE_DIRECTORY			HAIKU_BUILD_B_USER_CACHE_DIRECTORY
+#define B_USER_PACKAGES_DIRECTORY		HAIKU_BUILD_B_USER_PACKAGES_DIRECTORY
+#define B_USER_HEADERS_DIRECTORY		HAIKU_BUILD_B_USER_HEADERS_DIRECTORY
+#define B_USER_NONPACKAGED_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_DIRECTORY
+#define B_USER_NONPACKAGED_ADDONS_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_ADDONS_DIRECTORY
+#define B_USER_NONPACKAGED_TRANSLATORS_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_TRANSLATORS_DIRECTORY
+#define B_USER_NONPACKAGED_MEDIA_NODES_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_MEDIA_NODES_DIRECTORY
+#define B_USER_NONPACKAGED_BIN_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_BIN_DIRECTORY
+#define B_USER_NONPACKAGED_DATA_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_DATA_DIRECTORY
+#define B_USER_NONPACKAGED_FONTS_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_FONTS_DIRECTORY
+#define B_USER_NONPACKAGED_SOUNDS_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_SOUNDS_DIRECTORY
+#define B_USER_NONPACKAGED_DOCUMENTATION_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_DOCUMENTATION_DIRECTORY
+#define B_USER_NONPACKAGED_LIB_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_LIB_DIRECTORY
+#define B_USER_NONPACKAGED_HEADERS_DIRECTORY	HAIKU_BUILD_B_USER_NONPACKAGED_HEADERS_DIRECTORY
+
+#define B_APPS_DIRECTORY			HAIKU_BUILD_B_APPS_DIRECTORY
+#define B_PREFERENCES_DIRECTORY		HAIKU_BUILD_B_PREFERENCES_DIRECTORY
+#define B_UTILITIES_DIRECTORY		HAIKU_BUILD_B_UTILITIES_DIRECTORY
+#define B_PACKAGE_LINKS_DIRECTORY	HAIKU_BUILD_B_PACKAGE_LINKS_DIRECTORY
+
+#define B_BEOS_DIRECTORY				HAIKU_BUILD_B_BEOS_DIRECTORY				
+#define B_BEOS_SYSTEM_DIRECTORY			HAIKU_BUILD_B_BEOS_SYSTEM_DIRECTORY
+#define B_BEOS_ADDONS_DIRECTORY			HAIKU_BUILD_B_BEOS_ADDONS_DIRECTORY
+#define B_BEOS_BOOT_DIRECTORY			HAIKU_BUILD_B_BEOS_BOOT_DIRECTORY
+#define B_BEOS_FONTS_DIRECTORY			HAIKU_BUILD_B_BEOS_FONTS_DIRECTORY
+#define B_BEOS_LIB_DIRECTORY			HAIKU_BUILD_B_BEOS_LIB_DIRECTORY
+#define B_BEOS_SERVERS_DIRECTORY		HAIKU_BUILD_B_BEOS_SERVERS_DIRECTORY
+#define B_BEOS_APPS_DIRECTORY			HAIKU_BUILD_B_BEOS_APPS_DIRECTORY
+#define B_BEOS_BIN_DIRECTORY			HAIKU_BUILD_B_BEOS_BIN_DIRECTORY
+#define B_BEOS_ETC_DIRECTORY			HAIKU_BUILD_B_BEOS_ETC_DIRECTORY
+#define B_BEOS_DOCUMENTATION_DIRECTORY	HAIKU_BUILD_B_BEOS_DOCUMENTATION_DIRECTORY
+#define B_BEOS_PREFERENCES_DIRECTORY	HAIKU_BUILD_B_BEOS_PREFERENCES_DIRECTORY
+#define B_BEOS_TRANSLATORS_DIRECTORY	HAIKU_BUILD_B_BEOS_TRANSLATORS_DIRECTORY
+#define B_BEOS_MEDIA_NODES_DIRECTORY	HAIKU_BUILD_B_BEOS_MEDIA_NODES_DIRECTORY
+#define B_BEOS_SOUNDS_DIRECTORY			HAIKU_BUILD_B_BEOS_SOUNDS_DIRECTORY
+#define B_BEOS_DATA_DIRECTORY			HAIKU_BUILD_B_BEOS_DATA_DIRECTORY
+
+typedef haiku_build_directory_which directory_which;
+
+
+/* C++ interface */
+
+#ifdef __cplusplus
+
+class BVolume;
+class BPath;
+
+status_t find_directory(directory_which which, BPath* path,
+	bool createIt = false, BVolume* volume = NULL);
+
+#endif	/* __cplusplus */
+
+#endif	// ! _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+
+#endif	/* _HAIKU_BUILD_FIND_DIRECTORY_H */
diff --git a/headers/build/os/support/ByteOrder.h b/headers/build/os/support/ByteOrder.h
index ea63f6d..933378f 100644
--- a/headers/build/os/support/ByteOrder.h
+++ b/headers/build/os/support/ByteOrder.h
@@ -1 +1,152 @@
-#include <../os/support/ByteOrder.h>
+/*
+ * Copyright 2007-2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_BYTEORDER_H
+#define _HAIKU_BUILD_BYTEORDER_H
+
+
+#include <BeBuild.h>
+#include <endian.h>
+#include <SupportDefs.h>
+#include <TypeConstants.h>
+	/* for convenience */
+
+
+/* swap directions */
+typedef enum {
+	HAIKU_BUILD_B_SWAP_HOST_TO_LENDIAN,
+	HAIKU_BUILD_B_SWAP_HOST_TO_BENDIAN,
+	HAIKU_BUILD_B_SWAP_LENDIAN_TO_HOST,
+	HAIKU_BUILD_B_SWAP_BENDIAN_TO_HOST,
+	HAIKU_BUILD_B_SWAP_ALWAYS
+} haiku_build_swap_action;
+
+
+/* BSD/networking macros */
+#ifndef haiku_build_htonl
+#	define haiku_build_htonl(x) HAIKU_BUILD_B_HOST_TO_BENDIAN_INT32(x)
+#	define haiku_build_ntohl(x) HAIKU_BUILD_B_BENDIAN_TO_HOST_INT32(x)
+#	define haiku_build_htons(x) HAIKU_BUILD_B_HOST_TO_BENDIAN_INT16(x)
+#	define haiku_build_ntohs(x) HAIKU_BUILD_B_BENDIAN_TO_HOST_INT16(x)
+#endif
+
+/* always swap macros */
+#define HAIKU_BUILD_B_SWAP_DOUBLE(arg)   __haiku_build_swap_double(arg)
+#define HAIKU_BUILD_B_SWAP_FLOAT(arg)    __haiku_build_swap_float(arg)
+#define HAIKU_BUILD_B_SWAP_INT64(arg)    __haiku_build_swap_int64(arg)
+#define HAIKU_BUILD_B_SWAP_INT32(arg)    __haiku_build_swap_int32(arg)
+#define HAIKU_BUILD_B_SWAP_INT16(arg)    __haiku_build_swap_int16(arg)
+
+#if HAIKU_BUILD_BYTE_ORDER == __LITTLE_ENDIAN
+/* Host is little endian */
+
+#define HAIKU_BUILD_B_HOST_IS_LENDIAN 1
+#define HAIKU_BUILD_B_HOST_IS_BENDIAN 0
+
+/* Host native to little endian */
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_DOUBLE(arg)	(double)(arg)
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_FLOAT(arg)	(float)(arg)
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_INT64(arg)	(haiku_build_uint64)(arg)
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_INT32(arg)	(haiku_build_uint32)(arg)
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_INT16(arg)	(haiku_build_uint16)(arg)
+
+/* Little endian to host native */
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_DOUBLE(arg)	(double)(arg)
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_FLOAT(arg)	(float)(arg)
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_INT64(arg)	(haiku_build_uint64)(arg)
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_INT32(arg)	(haiku_build_uint32)(arg)
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_INT16(arg)	(haiku_build_uint16)(arg)
+
+/* Host native to big endian */
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_DOUBLE(arg)	\
+	__haiku_build_swap_double(arg)
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_FLOAT(arg)	\
+	__haiku_build_swap_float(arg)
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_INT64(arg)	\
+	__haiku_build_swap_int64(arg)
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_INT32(arg)	\
+	__haiku_build_swap_int32(arg)
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_INT16(arg)	\
+	__haiku_build_swap_int16(arg)
+
+/* Big endian to host native */
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_DOUBLE(arg)	\
+	__haiku_build_swap_double(arg)
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_FLOAT(arg)	\
+	__haiku_build_swap_float(arg)
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_INT64(arg)	\
+	__haiku_build_swap_int64(arg)
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_INT32(arg)	\
+	__haiku_build_swap_int32(arg)
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_INT16(arg)	\
+	__haiku_build_swap_int16(arg)
+
+#else	/* BYTE_ORDER */
+/* Host is big endian */
+
+#define HAIKU_BUILD_B_HOST_IS_LENDIAN 0
+#define HAIKU_BUILD_B_HOST_IS_BENDIAN 1
+
+/* Host native to little endian */
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_DOUBLE(arg)	\
+	__haiku_build_swap_double(arg)
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_FLOAT(arg)	\
+	__haiku_build_swap_float(arg)
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_INT64(arg)	\
+	__haiku_build_swap_int64(arg)
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_INT32(arg)	\
+	__haiku_build_swap_int32(arg)
+#define HAIKU_BUILD_B_HOST_TO_LENDIAN_INT16(arg)	\
+	__haiku_build_swap_int16(arg)
+
+/* Little endian to host native */
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_DOUBLE(arg)	\
+	__haiku_build_swap_double(arg)
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_FLOAT(arg)	\
+	__haiku_build_swap_float(arg)
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_INT64(arg)	\
+	__haiku_build_swap_int64(arg)
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_INT32(arg)	\
+	__haiku_build_swap_int32(arg)
+#define HAIKU_BUILD_B_LENDIAN_TO_HOST_INT16(arg)	\
+	__haiku_build_swap_int16(arg)
+
+/* Host native to big endian */
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_DOUBLE(arg)	(double)(arg)
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_FLOAT(arg)	(float)(arg)
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_INT64(arg)	(haiku_build_uint64)(arg)
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_INT32(arg)	(haiku_build_uint32)(arg)
+#define HAIKU_BUILD_B_HOST_TO_BENDIAN_INT16(arg)	(haiku_build_uint16)(arg)
+
+/* Big endian to host native */
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_DOUBLE(arg)	(double)(arg)
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_FLOAT(arg)	(float)(arg)
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_INT64(arg)	(haiku_build_uint64)(arg)
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_INT32(arg)	(haiku_build_uint32)(arg)
+#define HAIKU_BUILD_B_BENDIAN_TO_HOST_INT16(arg)	(haiku_build_uint16)(arg)
+
+#endif	/* BYTE_ORDER */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+
+extern haiku_build_status_t haiku_build_swap_data(haiku_build_type_code type,
+	void *data, size_t length, haiku_build_swap_action action);
+extern bool haiku_build_is_type_swapped(haiku_build_type_code type);
+
+
+/* Private implementations */
+extern double __haiku_build_swap_double(double arg);
+extern float  __haiku_build_swap_float(float arg);
+extern haiku_build_uint64 __haiku_build_swap_int64(haiku_build_uint64 arg);
+extern haiku_build_uint32 __haiku_build_swap_int32(haiku_build_uint32 arg);
+extern haiku_build_uint16 __haiku_build_swap_int16(haiku_build_uint16 arg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _HAIKU_BUILD_BYTEORDER_H */
diff --git a/headers/build/os/support/Errors.h b/headers/build/os/support/Errors.h
index 750a660..81321e2 100644
--- a/headers/build/os/support/Errors.h
+++ b/headers/build/os/support/Errors.h
@@ -1,499 +1,339 @@
-/******************************************************************************
-/
-/	File:			Errors.h
-/
-/	Description:	Error code constants.
-/
-/	Copyright 1993-98, Be Incorporated
-/
-******************************************************************************/
+/*
+ * Copyright 2007-2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_ERRORS_H
+#define _HAIKU_BUILD_ERRORS_H
 
 
-#ifndef _ERRORS_H
-#define _ERRORS_H
-
-#include <errno.h>
 #include <limits.h>
 
-/*-------------------------------------------------------------*/
-/*----- Error baselines ---------------------------------------*/
-
-#define B_GENERAL_ERROR_BASE		INT_MIN
-#define B_OS_ERROR_BASE				B_GENERAL_ERROR_BASE + 0x1000
-#define B_APP_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x2000
-#define B_INTERFACE_ERROR_BASE		B_GENERAL_ERROR_BASE + 0x3000
-#define B_MEDIA_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x4000 /* - 0x41ff */
-#define B_TRANSLATION_ERROR_BASE	B_GENERAL_ERROR_BASE + 0x4800 /* - 0x48ff */
-#define B_MIDI_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x5000
-#define B_STORAGE_ERROR_BASE		B_GENERAL_ERROR_BASE + 0x6000
-#define B_POSIX_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x7000
-#define B_MAIL_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x8000
-#define B_PRINT_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x9000
-#define B_DEVICE_ERROR_BASE			B_GENERAL_ERROR_BASE + 0xa000
-
-/*--- Developer-defined errors start at (B_ERRORS_END+1)----*/
-
-#define B_ERRORS_END		(B_GENERAL_ERROR_BASE + 0xffff)
-
-
-/*-------------------------------------------------------------*/
-/*----- General Errors ----------------------------------------*/
-enum {
-	B_NO_MEMORY = B_GENERAL_ERROR_BASE,
-	B_IO_ERROR,
-	B_PERMISSION_DENIED,
-	B_BAD_INDEX,
-	B_BAD_TYPE,
-	B_BAD_VALUE,
-	B_MISMATCHED_VALUES,
-	B_NAME_NOT_FOUND,
-	B_NAME_IN_USE,
-	B_TIMED_OUT,
-    B_INTERRUPTED,
-	B_WOULD_BLOCK,
-    B_CANCELED,
-	B_NO_INIT,
-	B_BUSY,
-	B_NOT_ALLOWED,
-	B_BAD_DATA,
-
-	B_ERROR = -1,
-	B_OK = 0,
-	B_NO_ERROR = 0
-};
-
-/*-------------------------------------------------------------*/
-/*----- Kernel Kit Errors -------------------------------------*/
-enum {
-	B_BAD_SEM_ID = B_OS_ERROR_BASE,
-	B_NO_MORE_SEMS,
-
-	B_BAD_THREAD_ID = B_OS_ERROR_BASE + 0x100,
-	B_NO_MORE_THREADS,
-	B_BAD_THREAD_STATE,
-	B_BAD_TEAM_ID,
-	B_NO_MORE_TEAMS,
-
-	B_BAD_PORT_ID = B_OS_ERROR_BASE + 0x200,
-	B_NO_MORE_PORTS,
-
-	B_BAD_IMAGE_ID = B_OS_ERROR_BASE + 0x300,
-	B_BAD_ADDRESS,
-	B_NOT_AN_EXECUTABLE,
-	B_MISSING_LIBRARY,
-	B_MISSING_SYMBOL,
-
-	B_DEBUGGER_ALREADY_INSTALLED = B_OS_ERROR_BASE + 0x400
-};
-
-
-/*-------------------------------------------------------------*/
-/*----- Application Kit Errors --------------------------------*/
-enum
-{
-	B_BAD_REPLY = B_APP_ERROR_BASE,
-	B_DUPLICATE_REPLY,
-	B_MESSAGE_TO_SELF,
-	B_BAD_HANDLER,
-	B_ALREADY_RUNNING,
-	B_LAUNCH_FAILED,
-	B_AMBIGUOUS_APP_LAUNCH,
-	B_UNKNOWN_MIME_TYPE,
-	B_BAD_SCRIPT_SYNTAX,
-	B_LAUNCH_FAILED_NO_RESOLVE_LINK,
-	B_LAUNCH_FAILED_EXECUTABLE,
-	B_LAUNCH_FAILED_APP_NOT_FOUND,
-	B_LAUNCH_FAILED_APP_IN_TRASH,
-	B_LAUNCH_FAILED_NO_PREFERRED_APP,
-	B_LAUNCH_FAILED_FILES_APP_NOT_FOUND,
-	B_BAD_MIME_SNIFFER_RULE,
-	B_NOT_A_MESSAGE,
-	B_SHUTDOWN_CANCELLED,
-	B_SHUTTING_DOWN
-};
-
-
-/*-------------------------------------------------------------*/
-/*----- Storage Kit/File System Errors ------------------------*/
-enum {
-	B_FILE_ERROR = B_STORAGE_ERROR_BASE,
-	B_FILE_NOT_FOUND,	/* discouraged; use B_ENTRY_NOT_FOUND in new code*/
-	B_FILE_EXISTS,
-	B_ENTRY_NOT_FOUND,
-	B_NAME_TOO_LONG,
-	B_NOT_A_DIRECTORY,
-	B_DIRECTORY_NOT_EMPTY,
-	B_DEVICE_FULL,
-	B_READ_ONLY_DEVICE,
-	B_IS_A_DIRECTORY,
-	B_NO_MORE_FDS,
-	B_CROSS_DEVICE_LINK,
-	B_LINK_LIMIT,
-	B_BUSTED_PIPE,
-	B_UNSUPPORTED,
-	B_PARTITION_TOO_SMALL
-};
-
-
-/*-------------------------------------------------------------*/
-/*----- POSIX Errors ------------------------------------------*/
-#define HAIKU_E2BIG			(B_POSIX_ERROR_BASE + 1)
-#define HAIKU_ECHILD			(B_POSIX_ERROR_BASE + 2)
-#define HAIKU_EDEADLK			(B_POSIX_ERROR_BASE + 3)
-#define HAIKU_EFBIG			(B_POSIX_ERROR_BASE + 4)
-#define HAIKU_EMLINK			(B_POSIX_ERROR_BASE + 5)
-#define HAIKU_ENFILE			(B_POSIX_ERROR_BASE + 6)
-#define HAIKU_ENODEV			(B_POSIX_ERROR_BASE + 7)
-#define HAIKU_ENOLCK			(B_POSIX_ERROR_BASE + 8)
-#define HAIKU_ENOSYS			(B_POSIX_ERROR_BASE + 9)
-#define HAIKU_ENOTTY			(B_POSIX_ERROR_BASE + 10)
-#define HAIKU_ENXIO			(B_POSIX_ERROR_BASE + 11)
-#define HAIKU_ESPIPE			(B_POSIX_ERROR_BASE + 12)
-#define HAIKU_ESRCH			(B_POSIX_ERROR_BASE + 13)
-#define HAIKU_EFPOS			(B_POSIX_ERROR_BASE + 14)
-#define HAIKU_ESIGPARM		(B_POSIX_ERROR_BASE + 15)
-#define HAIKU_EDOM			(B_POSIX_ERROR_BASE + 16)
-#define HAIKU_ERANGE			(B_POSIX_ERROR_BASE + 17)
-#define HAIKU_EPROTOTYPE		(B_POSIX_ERROR_BASE + 18)
-#define HAIKU_EPROTONOSUPPORT	(B_POSIX_ERROR_BASE + 19)
-#define HAIKU_EPFNOSUPPORT	(B_POSIX_ERROR_BASE + 20)
-#define HAIKU_EAFNOSUPPORT	(B_POSIX_ERROR_BASE + 21)
-#define HAIKU_EADDRINUSE		(B_POSIX_ERROR_BASE + 22)
-#define HAIKU_EADDRNOTAVAIL	(B_POSIX_ERROR_BASE + 23)
-#define HAIKU_ENETDOWN		(B_POSIX_ERROR_BASE + 24)
-#define HAIKU_ENETUNREACH		(B_POSIX_ERROR_BASE + 25)
-#define HAIKU_ENETRESET		(B_POSIX_ERROR_BASE + 26)
-#define HAIKU_ECONNABORTED	(B_POSIX_ERROR_BASE + 27)
-#define HAIKU_ECONNRESET		(B_POSIX_ERROR_BASE + 28)
-#define HAIKU_EISCONN			(B_POSIX_ERROR_BASE + 29)
-#define HAIKU_ENOTCONN		(B_POSIX_ERROR_BASE + 30)
-#define HAIKU_ESHUTDOWN		(B_POSIX_ERROR_BASE + 31)
-#define HAIKU_ECONNREFUSED	(B_POSIX_ERROR_BASE + 32)
-#define HAIKU_EHOSTUNREACH	(B_POSIX_ERROR_BASE + 33)
-#define HAIKU_ENOPROTOOPT		(B_POSIX_ERROR_BASE + 34)
-#define HAIKU_ENOBUFS			(B_POSIX_ERROR_BASE + 35)
-#define HAIKU_EINPROGRESS		(B_POSIX_ERROR_BASE + 36)
-#define HAIKU_EALREADY		(B_POSIX_ERROR_BASE + 37)
-#define HAIKU_EILSEQ          (B_POSIX_ERROR_BASE + 38)
-#define HAIKU_ENOMSG          (B_POSIX_ERROR_BASE + 39)
-#define HAIKU_ESTALE          (B_POSIX_ERROR_BASE + 40)
-#define HAIKU_EOVERFLOW       (B_POSIX_ERROR_BASE + 41)
-#define HAIKU_EMSGSIZE        (B_POSIX_ERROR_BASE + 42)
-#define HAIKU_EOPNOTSUPP      (B_POSIX_ERROR_BASE + 43)
-#define HAIKU_ENOTSOCK		(B_POSIX_ERROR_BASE + 44)
-#define HAIKU_EHOSTDOWN		(B_POSIX_ERROR_BASE + 45)
-#define HAIKU_EBADMSG			(B_POSIX_ERROR_BASE + 46)
-#define HAIKU_ECANCELED		(B_POSIX_ERROR_BASE + 47)
-#define HAIKU_EDESTADDRREQ	(B_POSIX_ERROR_BASE + 48)
-#define HAIKU_EDQUOT			(B_POSIX_ERROR_BASE + 49)
-#define HAIKU_EIDRM			(B_POSIX_ERROR_BASE + 50)
-#define HAIKU_EMULTIHOP		(B_POSIX_ERROR_BASE + 51)
-#define HAIKU_ENODATA			(B_POSIX_ERROR_BASE + 52)
-#define HAIKU_ENOLINK			(B_POSIX_ERROR_BASE + 53)
-#define HAIKU_ENOSR			(B_POSIX_ERROR_BASE + 54)
-#define HAIKU_ENOSTR			(B_POSIX_ERROR_BASE + 55)
-#define HAIKU_ENOTSUP			(B_POSIX_ERROR_BASE + 56)
-#define HAIKU_EPROTO			(B_POSIX_ERROR_BASE + 57)
-#define HAIKU_ETIME			(B_POSIX_ERROR_BASE + 58)
-#define HAIKU_ETXTBSY			(B_POSIX_ERROR_BASE + 59)
-#define HAIKU_ENOATTR			(B_POSIX_ERROR_BASE + 60)
-
-
-/*---- POSIX errors that can be mapped to BeOS error codes ----*/
-#define HAIKU_ENOMEM			B_NO_MEMORY
-#define HAIKU_EACCES			B_PERMISSION_DENIED
-#define HAIKU_EINTR			B_INTERRUPTED
-#define HAIKU_EIO				B_IO_ERROR
-#define HAIKU_EBUSY			B_BUSY
-#define HAIKU_EFAULT			B_BAD_ADDRESS
-#define HAIKU_ETIMEDOUT		B_TIMED_OUT
-#define HAIKU_EAGAIN 			B_WOULD_BLOCK	/* SysV compatibility */
-#define HAIKU_EWOULDBLOCK 	B_WOULD_BLOCK	/* BSD compatibility */
-#define HAIKU_EBADF			B_FILE_ERROR
-#define HAIKU_EEXIST			B_FILE_EXISTS
-#define HAIKU_EINVAL			B_BAD_VALUE
-#define HAIKU_ENAMETOOLONG	B_NAME_TOO_LONG
-#define HAIKU_ENOENT			B_ENTRY_NOT_FOUND
-#define HAIKU_EPERM			B_NOT_ALLOWED
-#define HAIKU_ENOTDIR			B_NOT_A_DIRECTORY
-#define HAIKU_EISDIR			B_IS_A_DIRECTORY
-#define HAIKU_ENOTEMPTY		B_DIRECTORY_NOT_EMPTY
-#define HAIKU_ENOSPC			B_DEVICE_FULL
-#define HAIKU_EROFS			B_READ_ONLY_DEVICE
-#define HAIKU_EMFILE			B_NO_MORE_FDS
-#define HAIKU_EXDEV			B_CROSS_DEVICE_LINK
-#define HAIKU_ELOOP			B_LINK_LIMIT
-#define HAIKU_ENOEXEC			B_NOT_AN_EXECUTABLE
-#define HAIKU_EPIPE			B_BUSTED_PIPE
-
-#ifndef BUILDING_HAIKU_ERROR_MAPPER
-	#undef E2BIG
-	#undef ECHILD
-	#undef EDEADLK
-	#undef EFBIG
-	#undef EMLINK
-	#undef ENFILE
-	#undef ENODEV
-	#undef ENOLCK
-	#undef ENOSYS
-	#undef ENOTTY
-	#undef ENXIO
-	#undef ESPIPE
-	#undef ESRCH
-	#undef EFPOS
-	#undef ESIGPARM
-	#undef EDOM
-	#undef ERANGE
-	#undef EPROTOTYPE
-	#undef EPROTONOSUPPORT
-	#undef EPFNOSUPPORT
-	#undef EAFNOSUPPORT
-	#undef EADDRINUSE
-	#undef EADDRNOTAVAIL
-	#undef ENETDOWN
-	#undef ENETUNREACH
-	#undef ENETRESET
-	#undef ECONNABORTED
-	#undef ECONNRESET
-	#undef EISCONN
-	#undef ENOTCONN
-	#undef ESHUTDOWN
-	#undef ECONNREFUSED
-	#undef EHOSTUNREACH
-	#undef ENOPROTOOPT
-	#undef ENOBUFS
-	#undef EINPROGRESS
-	#undef EALREADY
-	#undef EILSEQ
-	#undef ENOMSG
-	#undef ESTALE
-	#undef EOVERFLOW
-	#undef EMSGSIZE
-	#undef EOPNOTSUPP
-	#undef ENOTSOCK
-	#undef EHOSTDOWN
-	#undef EBADMSG
-	#undef ECANCELED
-	#undef EDESTADDRREQ
-	#undef EDQUOT
-	#undef EIDRM
-	#undef EMULTIHOP
-	#undef ENODATA
-	#undef ENOLINK
-	#undef ENOSR
-	#undef ENOSTR
-	#undef ENOTSUP
-	#undef EPROTO
-	#undef ETIME
-	#undef ETXTBSY
-	#undef ENOMEM
-	#undef EACCES
-	#undef EINTR
-	#undef EIO
-	#undef EBUSY
-	#undef EFAULT
-	#undef ETIMEDOUT
-	#undef EAGAIN
-	#undef EWOULDBLOCK
-	#undef EBADF
-	#undef EEXIST
-	#undef EINVAL
-	#undef ENAMETOOLONG
-	#undef ENOENT
-	#undef EPERM
-	#undef ENOTDIR
-	#undef EISDIR
-	#undef ENOTEMPTY
-	#undef ENOSPC
-	#undef EROFS
-	#undef EMFILE
-	#undef EXDEV
-	#undef ELOOP
-	#undef ENOEXEC
-	#undef EPIPE
-	#undef ENOATTR
-
-	#define E2BIG HAIKU_E2BIG
-	#define ECHILD HAIKU_ECHILD
-	#define EDEADLK HAIKU_EDEADLK
-	#define EFBIG HAIKU_EFBIG
-	#define EMLINK HAIKU_EMLINK
-	#define ENFILE HAIKU_ENFILE
-	#define ENODEV HAIKU_ENODEV
-	#define ENOLCK HAIKU_ENOLCK
-	#define ENOSYS HAIKU_ENOSYS
-	#define ENOTTY HAIKU_ENOTTY
-	#define ENXIO HAIKU_ENXIO
-	#define ESPIPE HAIKU_ESPIPE
-	#define ESRCH HAIKU_ESRCH
-	#define EFPOS HAIKU_EFPOS
-	#define ESIGPARM HAIKU_ESIGPARM
-	#define EDOM HAIKU_EDOM
-	#define ERANGE HAIKU_ERANGE
-	#define EPROTOTYPE HAIKU_EPROTOTYPE
-	#define EPROTONOSUPPORT HAIKU_EPROTONOSUPPORT
-	#define EPFNOSUPPORT HAIKU_EPFNOSUPPORT
-	#define EAFNOSUPPORT HAIKU_EAFNOSUPPORT
-	#define EADDRINUSE HAIKU_EADDRINUSE
-	#define EADDRNOTAVAIL HAIKU_EADDRNOTAVAIL
-	#define ENETDOWN HAIKU_ENETDOWN
-	#define ENETUNREACH HAIKU_ENETUNREACH
-	#define ENETRESET HAIKU_ENETRESET
-	#define ECONNABORTED HAIKU_ECONNABORTED
-	#define ECONNRESET HAIKU_ECONNRESET
-	#define EISCONN HAIKU_EISCONN
-	#define ENOTCONN HAIKU_ENOTCONN
-	#define ESHUTDOWN HAIKU_ESHUTDOWN
-	#define ECONNREFUSED HAIKU_ECONNREFUSED
-	#define EHOSTUNREACH HAIKU_EHOSTUNREACH
-	#define ENOPROTOOPT HAIKU_ENOPROTOOPT
-	#define ENOBUFS HAIKU_ENOBUFS
-	#define EINPROGRESS HAIKU_EINPROGRESS
-	#define EALREADY HAIKU_EALREADY
-	#define EILSEQ HAIKU_EILSEQ
-	#define ENOMSG HAIKU_ENOMSG
-	#define ESTALE HAIKU_ESTALE
-	#define EOVERFLOW HAIKU_EOVERFLOW
-	#define EMSGSIZE HAIKU_EMSGSIZE
-	#define EOPNOTSUPP HAIKU_EOPNOTSUPP
-	#define ENOTSOCK HAIKU_ENOTSOCK
-	#define EHOSTDOWN HAIKU_EHOSTDOWN
-	#define	EBADMSG HAIKU_EBADMSG
-	#define ECANCELED HAIKU_ECANCELED
-	#define EDESTADDRREQ HAIKU_EDESTADDRREQ
-	#define EDQUOT HAIKU_EDQUOT
-	#define EIDRM HAIKU_EIDRM
-	#define EMULTIHOP HAIKU_EMULTIHOP
-	#define ENODATA HAIKU_ENODATA
-	#define ENOLINK HAIKU_ENOLINK
-	#define ENOSR HAIKU_ENOSR
-	#define ENOSTR HAIKU_ENOSTR
-	#define ENOTSUP HAIKU_ENOTSUP
-	#define EPROTO HAIKU_EPROTO
-	#define ETIME HAIKU_ETIME
-	#define ETXTBSY HAIKU_ETXTBSY
-	#define ENOMEM HAIKU_ENOMEM
-	#define EACCES HAIKU_EACCES
-	#define EINTR HAIKU_EINTR
-	#define EIO HAIKU_EIO
-	#define EBUSY HAIKU_EBUSY
-	#define EFAULT HAIKU_EFAULT
-	#define ETIMEDOUT HAIKU_ETIMEDOUT
-	#define EAGAIN HAIKU_EAGAIN
-	#define EWOULDBLOCK HAIKU_EWOULDBLOCK
-	#define EBADF HAIKU_EBADF
-	#define EEXIST HAIKU_EEXIST
-	#define EINVAL HAIKU_EINVAL
-	#define ENAMETOOLONG HAIKU_ENAMETOOLONG
-	#define ENOENT HAIKU_ENOENT
-	#define EPERM HAIKU_EPERM
-	#define ENOTDIR HAIKU_ENOTDIR
-	#define EISDIR HAIKU_EISDIR
-	#define ENOTEMPTY HAIKU_ENOTEMPTY
-	#define ENOSPC HAIKU_ENOSPC
-	#define EROFS HAIKU_EROFS
-	#define EMFILE HAIKU_EMFILE
-	#define EXDEV HAIKU_EXDEV
-	#define ELOOP HAIKU_ELOOP
-	#define ENOEXEC HAIKU_ENOEXEC
-	#define EPIPE HAIKU_EPIPE
-	#define ENOATTR HAIKU_ENOATTR
-
-	#undef errno
-	#define errno (*_haiku_build_errno())
-
-#endif	// ! BUILDING_HAIKU_ERROR_MAPPER
+
+/* Error baselines */
+#define HAIKU_BUILD_B_GENERAL_ERROR_BASE		HAIKU_BUILD_INT_MIN
+#define HAIKU_BUILD_B_OS_ERROR_BASE				(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x1000)
+#define HAIKU_BUILD_B_APP_ERROR_BASE			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x2000)
+#define HAIKU_BUILD_B_INTERFACE_ERROR_BASE		(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x3000)
+#define HAIKU_BUILD_B_MEDIA_ERROR_BASE			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x4000)
+										/* - 0x41ff */
+#define HAIKU_BUILD_B_TRANSLATION_ERROR_BASE	(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x4800)
+										/* - 0x48ff */
+#define HAIKU_BUILD_B_MIDI_ERROR_BASE			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x5000)
+#define HAIKU_BUILD_B_STORAGE_ERROR_BASE		(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x6000)
+#define HAIKU_BUILD_B_POSIX_ERROR_BASE			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x7000)
+#define HAIKU_BUILD_B_MAIL_ERROR_BASE			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x8000)
+#define HAIKU_BUILD_B_PRINT_ERROR_BASE			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0x9000)
+#define HAIKU_BUILD_B_DEVICE_ERROR_BASE			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0xa000)
+
+/* Developer-defined errors start at (B_ERRORS_END+1) */
+#define HAIKU_BUILD_B_ERRORS_END				(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0xffff)
+
+/* General Errors */
+#define HAIKU_BUILD_B_NO_MEMORY					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 0)
+#define HAIKU_BUILD_B_IO_ERROR					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 1)
+#define HAIKU_BUILD_B_PERMISSION_DENIED			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 2)
+#define HAIKU_BUILD_B_BAD_INDEX					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 3)
+#define HAIKU_BUILD_B_BAD_TYPE					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 4)
+#define HAIKU_BUILD_B_BAD_VALUE					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 5)
+#define HAIKU_BUILD_B_MISMATCHED_VALUES			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 6)
+#define HAIKU_BUILD_B_NAME_NOT_FOUND			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 7)
+#define HAIKU_BUILD_B_NAME_IN_USE				(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 8)
+#define HAIKU_BUILD_B_TIMED_OUT					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 9)
+#define HAIKU_BUILD_B_INTERRUPTED				(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 10)
+#define HAIKU_BUILD_B_WOULD_BLOCK				(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 11)
+#define HAIKU_BUILD_B_CANCELED					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 12)
+#define HAIKU_BUILD_B_NO_INIT					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 13)
+#define HAIKU_BUILD_B_NOT_INITIALIZED			(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 13)
+#define HAIKU_BUILD_B_BUSY						(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 14)
+#define HAIKU_BUILD_B_NOT_ALLOWED				(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 15)
+#define HAIKU_BUILD_B_BAD_DATA					(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 16)
+#define HAIKU_BUILD_B_DONT_DO_THAT				(HAIKU_BUILD_B_GENERAL_ERROR_BASE + 17)
+
+#define HAIKU_BUILD_B_ERROR						(-1)
+#define HAIKU_BUILD_B_OK						((int)0)
+#define HAIKU_BUILD_B_NO_ERROR					((int)0)
+
+/* Kernel Kit Errors */
+#define HAIKU_BUILD_B_BAD_SEM_ID				(HAIKU_BUILD_B_OS_ERROR_BASE + 0)
+#define HAIKU_BUILD_B_NO_MORE_SEMS				(HAIKU_BUILD_B_OS_ERROR_BASE + 1)
+
+#define HAIKU_BUILD_B_BAD_THREAD_ID				(HAIKU_BUILD_B_OS_ERROR_BASE + 0x100)
+#define HAIKU_BUILD_B_NO_MORE_THREADS			(HAIKU_BUILD_B_OS_ERROR_BASE + 0x101)
+#define HAIKU_BUILD_B_BAD_THREAD_STATE			(HAIKU_BUILD_B_OS_ERROR_BASE + 0x102)
+#define HAIKU_BUILD_B_BAD_TEAM_ID				(HAIKU_BUILD_B_OS_ERROR_BASE + 0x103)
+#define HAIKU_BUILD_B_NO_MORE_TEAMS				(HAIKU_BUILD_B_OS_ERROR_BASE + 0x104)
+
+#define HAIKU_BUILD_B_BAD_PORT_ID				(HAIKU_BUILD_B_OS_ERROR_BASE + 0x200)
+#define HAIKU_BUILD_B_NO_MORE_PORTS				(HAIKU_BUILD_B_OS_ERROR_BASE + 0x201)
+
+#define HAIKU_BUILD_B_BAD_IMAGE_ID				(HAIKU_BUILD_B_OS_ERROR_BASE + 0x300)
+#define HAIKU_BUILD_B_BAD_ADDRESS				(HAIKU_BUILD_B_OS_ERROR_BASE + 0x301)
+#define HAIKU_BUILD_B_NOT_AN_EXECUTABLE			(HAIKU_BUILD_B_OS_ERROR_BASE + 0x302)
+#define HAIKU_BUILD_B_MISSING_LIBRARY			(HAIKU_BUILD_B_OS_ERROR_BASE + 0x303)
+#define HAIKU_BUILD_B_MISSING_SYMBOL			(HAIKU_BUILD_B_OS_ERROR_BASE + 0x304)
+
+#define HAIKU_BUILD_B_DEBUGGER_ALREADY_INSTALLED	(HAIKU_BUILD_B_OS_ERROR_BASE + 0x400)
+
+/* Application Kit Errors */
+#define HAIKU_BUILD_B_BAD_REPLY							(HAIKU_BUILD_B_APP_ERROR_BASE + 0)
+#define HAIKU_BUILD_B_DUPLICATE_REPLY					(HAIKU_BUILD_B_APP_ERROR_BASE + 1)
+#define HAIKU_BUILD_B_MESSAGE_TO_SELF					(HAIKU_BUILD_B_APP_ERROR_BASE + 2)
+#define HAIKU_BUILD_B_BAD_HANDLER						(HAIKU_BUILD_B_APP_ERROR_BASE + 3)
+#define HAIKU_BUILD_B_ALREADY_RUNNING					(HAIKU_BUILD_B_APP_ERROR_BASE + 4)
+#define HAIKU_BUILD_B_LAUNCH_FAILED						(HAIKU_BUILD_B_APP_ERROR_BASE + 5)
+#define HAIKU_BUILD_B_AMBIGUOUS_APP_LAUNCH				(HAIKU_BUILD_B_APP_ERROR_BASE + 6)
+#define HAIKU_BUILD_B_UNKNOWN_MIME_TYPE					(HAIKU_BUILD_B_APP_ERROR_BASE + 7)
+#define HAIKU_BUILD_B_BAD_SCRIPT_SYNTAX					(HAIKU_BUILD_B_APP_ERROR_BASE + 8)
+#define HAIKU_BUILD_B_LAUNCH_FAILED_NO_RESOLVE_LINK		(HAIKU_BUILD_B_APP_ERROR_BASE + 9)
+#define HAIKU_BUILD_B_LAUNCH_FAILED_EXECUTABLE			(HAIKU_BUILD_B_APP_ERROR_BASE + 10)
+#define HAIKU_BUILD_B_LAUNCH_FAILED_APP_NOT_FOUND		(HAIKU_BUILD_B_APP_ERROR_BASE + 11)
+#define HAIKU_BUILD_B_LAUNCH_FAILED_APP_IN_TRASH		(HAIKU_BUILD_B_APP_ERROR_BASE + 12)
+#define HAIKU_BUILD_B_LAUNCH_FAILED_NO_PREFERRED_APP	(HAIKU_BUILD_B_APP_ERROR_BASE + 13)
+#define HAIKU_BUILD_B_LAUNCH_FAILED_FILES_APP_NOT_FOUND	(HAIKU_BUILD_B_APP_ERROR_BASE + 14)
+#define HAIKU_BUILD_B_BAD_MIME_SNIFFER_RULE				(HAIKU_BUILD_B_APP_ERROR_BASE + 15)
+#define HAIKU_BUILD_B_NOT_A_MESSAGE						(HAIKU_BUILD_B_APP_ERROR_BASE + 16)
+#define HAIKU_BUILD_B_SHUTDOWN_CANCELLED				(HAIKU_BUILD_B_APP_ERROR_BASE + 17)
+#define HAIKU_BUILD_B_SHUTTING_DOWN						(HAIKU_BUILD_B_APP_ERROR_BASE + 18)
+
+/* Storage Kit/File System Errors */
+#define HAIKU_BUILD_B_FILE_ERROR						(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 0)
+#define HAIKU_BUILD_B_FILE_NOT_FOUND					(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 1)
+			/* deprecated: use B_ENTRY_NOT_FOUND instead */
+#define HAIKU_BUILD_B_FILE_EXISTS						(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 2)
+#define HAIKU_BUILD_B_ENTRY_NOT_FOUND					(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 3)
+#define HAIKU_BUILD_B_NAME_TOO_LONG						(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 4)
+#define HAIKU_BUILD_B_NOT_A_DIRECTORY					(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 5)
+#define HAIKU_BUILD_B_DIRECTORY_NOT_EMPTY				(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 6)
+#define HAIKU_BUILD_B_DEVICE_FULL						(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 7)
+#define HAIKU_BUILD_B_READ_ONLY_DEVICE					(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 8)
+#define HAIKU_BUILD_B_IS_A_DIRECTORY					(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 9)
+#define HAIKU_BUILD_B_NO_MORE_FDS						(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 10)
+#define HAIKU_BUILD_B_CROSS_DEVICE_LINK					(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 11)
+#define HAIKU_BUILD_B_LINK_LIMIT						(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 12)
+#define HAIKU_BUILD_B_BUSTED_PIPE						(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 13)
+#define HAIKU_BUILD_B_UNSUPPORTED						(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 14)
+#define HAIKU_BUILD_B_PARTITION_TOO_SMALL				(HAIKU_BUILD_B_STORAGE_ERROR_BASE + 15)
+
+/* POSIX Errors */
+#ifdef HAIKU_BUILD_B_USE_POSITIVE_POSIX_ERRORS
+#	define HAIKU_BUILD_B_TO_POSIX_ERROR(error)		(-(error))
+#	define HAIKU_BUILD_B_FROM_POSIX_ERROR(error)	(-(error))
+#else
+#	define HAIKU_BUILD_B_TO_POSIX_ERROR(error)		(error)
+#	define HAIKU_BUILD_B_FROM_POSIX_ERROR(error)	(error)
+#endif
+
+#define HAIKU_BUILD_B_POSIX_ENOMEM	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 0)
+#define HAIKU_BUILD_E2BIG			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 1)
+#define HAIKU_BUILD_ECHILD			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 2)
+#define HAIKU_BUILD_EDEADLK			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 3)
+#define HAIKU_BUILD_EFBIG			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 4)
+#define HAIKU_BUILD_EMLINK			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 5)
+#define HAIKU_BUILD_ENFILE			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 6)
+#define HAIKU_BUILD_ENODEV			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 7)
+#define HAIKU_BUILD_ENOLCK			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 8)
+#define HAIKU_BUILD_ENOSYS			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 9)
+#define HAIKU_BUILD_ENOTTY			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 10)
+#define HAIKU_BUILD_ENXIO			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 11)
+#define HAIKU_BUILD_ESPIPE			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 12)
+#define HAIKU_BUILD_ESRCH			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 13)
+#define HAIKU_BUILD_EFPOS			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 14)
+#define HAIKU_BUILD_ESIGPARM		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 15)
+#define HAIKU_BUILD_EDOM			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 16)
+#define HAIKU_BUILD_ERANGE			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 17)
+#define HAIKU_BUILD_EPROTOTYPE		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 18)
+#define HAIKU_BUILD_EPROTONOSUPPORT	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 19)
+#define HAIKU_BUILD_EPFNOSUPPORT	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 20)
+#define HAIKU_BUILD_EAFNOSUPPORT	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 21)
+#define HAIKU_BUILD_EADDRINUSE		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 22)
+#define HAIKU_BUILD_EADDRNOTAVAIL	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 23)
+#define HAIKU_BUILD_ENETDOWN		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 24)
+#define HAIKU_BUILD_ENETUNREACH		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 25)
+#define HAIKU_BUILD_ENETRESET		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 26)
+#define HAIKU_BUILD_ECONNABORTED	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 27)
+#define HAIKU_BUILD_ECONNRESET		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 28)
+#define HAIKU_BUILD_EISCONN			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 29)
+#define HAIKU_BUILD_ENOTCONN		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 30)
+#define HAIKU_BUILD_ESHUTDOWN		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 31)
+#define HAIKU_BUILD_ECONNREFUSED	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 32)
+#define HAIKU_BUILD_EHOSTUNREACH	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 33)
+#define HAIKU_BUILD_ENOPROTOOPT		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 34)
+#define HAIKU_BUILD_ENOBUFS			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 35)
+#define HAIKU_BUILD_EINPROGRESS		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 36)
+#define HAIKU_BUILD_EALREADY		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 37)
+#define HAIKU_BUILD_EILSEQ          HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 38)
+#define HAIKU_BUILD_ENOMSG          HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 39)
+#define HAIKU_BUILD_ESTALE          HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 40)
+#define HAIKU_BUILD_EOVERFLOW       HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 41)
+#define HAIKU_BUILD_EMSGSIZE        HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 42)
+#define HAIKU_BUILD_EOPNOTSUPP      HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 43)
+#define HAIKU_BUILD_ENOTSOCK		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 44)
+#define HAIKU_BUILD_EHOSTDOWN		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 45)
+#define	HAIKU_BUILD_EBADMSG			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 46)
+#define HAIKU_BUILD_ECANCELED		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 47)
+#define HAIKU_BUILD_EDESTADDRREQ	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 48)
+#define HAIKU_BUILD_EDQUOT			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 49)
+#define HAIKU_BUILD_EIDRM			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 50)
+#define HAIKU_BUILD_EMULTIHOP		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 51)
+#define HAIKU_BUILD_ENODATA			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 52)
+#define HAIKU_BUILD_ENOLINK			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 53)
+#define HAIKU_BUILD_ENOSR			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 54)
+#define HAIKU_BUILD_ENOSTR			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 55)
+#define HAIKU_BUILD_ENOTSUP			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 56)
+#define HAIKU_BUILD_EPROTO			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 57)
+#define HAIKU_BUILD_ETIME			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 58)
+#define HAIKU_BUILD_ETXTBSY			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 59)
+#define HAIKU_BUILD_ENOATTR			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_POSIX_ERROR_BASE + 60)
+
+/* B_NO_MEMORY (0x80000000) can't be negated, so it needs special handling */
+#ifdef HAIKU_BUILD_B_USE_POSITIVE_POSIX_ERRORS
+#	define HAIKU_BUILD_ENOMEM		HAIKU_BUILD_B_POSIX_ENOMEM
+#else
+#	define HAIKU_BUILD_ENOMEM		HAIKU_BUILD_B_NO_MEMORY
+#endif
+
+/* POSIX errors that can be mapped to BeOS error codes */
+#define HAIKU_BUILD_EACCES			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_PERMISSION_DENIED)
+#define HAIKU_BUILD_EINTR			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_INTERRUPTED)
+#define HAIKU_BUILD_EIO				HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_IO_ERROR)
+#define HAIKU_BUILD_EBUSY			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_BUSY)
+#define HAIKU_BUILD_EFAULT			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_BAD_ADDRESS)
+#define HAIKU_BUILD_ETIMEDOUT		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_TIMED_OUT)
+#define HAIKU_BUILD_EAGAIN 			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_WOULD_BLOCK)	/* SysV compatibility */
+#define HAIKU_BUILD_EWOULDBLOCK 	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_WOULD_BLOCK)	/* BSD compatibility */
+#define HAIKU_BUILD_EBADF			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_FILE_ERROR)
+#define HAIKU_BUILD_EEXIST			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_FILE_EXISTS)
+#define HAIKU_BUILD_EINVAL			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_BAD_VALUE)
+#define HAIKU_BUILD_ENAMETOOLONG	HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_NAME_TOO_LONG)
+#define HAIKU_BUILD_ENOENT			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_ENTRY_NOT_FOUND)
+#define HAIKU_BUILD_EPERM			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_NOT_ALLOWED)
+#define HAIKU_BUILD_ENOTDIR			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_NOT_A_DIRECTORY)
+#define HAIKU_BUILD_EISDIR			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_IS_A_DIRECTORY)
+#define HAIKU_BUILD_ENOTEMPTY		HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_DIRECTORY_NOT_EMPTY)
+#define HAIKU_BUILD_ENOSPC			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_DEVICE_FULL)
+#define HAIKU_BUILD_EROFS			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_READ_ONLY_DEVICE)
+#define HAIKU_BUILD_EMFILE			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_NO_MORE_FDS)
+#define HAIKU_BUILD_EXDEV			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_CROSS_DEVICE_LINK)
+#define HAIKU_BUILD_ELOOP			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_LINK_LIMIT)
+#define HAIKU_BUILD_ENOEXEC			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_NOT_AN_EXECUTABLE)
+#define HAIKU_BUILD_EPIPE			HAIKU_BUILD_B_TO_POSIX_ERROR(HAIKU_BUILD_B_BUSTED_PIPE)
+
+/* new error codes that can be mapped to POSIX errors */
+#define	HAIKU_BUILD_B_BUFFER_OVERFLOW			HAIKU_BUILD_B_FROM_POSIX_ERROR(HAIKU_BUILD_EOVERFLOW)
+#define HAIKU_BUILD_B_TOO_MANY_ARGS				HAIKU_BUILD_B_FROM_POSIX_ERROR(HAIKU_BUILD_E2BIG)
+#define	HAIKU_BUILD_B_FILE_TOO_LARGE			HAIKU_BUILD_B_FROM_POSIX_ERROR(HAIKU_BUILD_EFBIG)
+#define HAIKU_BUILD_B_RESULT_NOT_REPRESENTABLE	HAIKU_BUILD_B_FROM_POSIX_ERROR(HAIKU_BUILD_ERANGE)
+#define	HAIKU_BUILD_B_DEVICE_NOT_FOUND			HAIKU_BUILD_B_FROM_POSIX_ERROR(HAIKU_BUILD_ENODEV)
+#define HAIKU_BUILD_B_NOT_SUPPORTED				HAIKU_BUILD_B_FROM_POSIX_ERROR(HAIKU_BUILD_EOPNOTSUPP)
+
+/* Media Kit Errors */
+#define HAIKU_BUILD_B_STREAM_NOT_FOUND				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 0)
+#define HAIKU_BUILD_B_SERVER_NOT_FOUND				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 1)
+#define HAIKU_BUILD_B_RESOURCE_NOT_FOUND			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 2)
+#define HAIKU_BUILD_B_RESOURCE_UNAVAILABLE			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 3)
+#define HAIKU_BUILD_B_BAD_SUBSCRIBER				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 4)
+#define HAIKU_BUILD_B_SUBSCRIBER_NOT_ENTERED		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 5)
+#define HAIKU_BUILD_B_BUFFER_NOT_AVAILABLE			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 6)
+#define HAIKU_BUILD_B_LAST_BUFFER_ERROR				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 7)
+
+#define HAIKU_BUILD_B_MEDIA_SYSTEM_FAILURE			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 100)
+#define HAIKU_BUILD_B_MEDIA_BAD_NODE				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 101)
+#define HAIKU_BUILD_B_MEDIA_NODE_BUSY				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 102)
+#define HAIKU_BUILD_B_MEDIA_BAD_FORMAT				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 103)
+#define HAIKU_BUILD_B_MEDIA_BAD_BUFFER				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 104)
+#define HAIKU_BUILD_B_MEDIA_TOO_MANY_NODES			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 105)
+#define HAIKU_BUILD_B_MEDIA_TOO_MANY_BUFFERS		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 106)
+#define HAIKU_BUILD_B_MEDIA_NODE_ALREADY_EXISTS		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 107)
+#define HAIKU_BUILD_B_MEDIA_BUFFER_ALREADY_EXISTS	(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 108)
+#define HAIKU_BUILD_B_MEDIA_CANNOT_SEEK				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 109)
+#define HAIKU_BUILD_B_MEDIA_CANNOT_CHANGE_RUN_MODE	(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 110)
+#define HAIKU_BUILD_B_MEDIA_APP_ALREADY_REGISTERED	(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 111)
+#define HAIKU_BUILD_B_MEDIA_APP_NOT_REGISTERED		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 112)
+#define HAIKU_BUILD_B_MEDIA_CANNOT_RECLAIM_BUFFERS	(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 113)
+#define HAIKU_BUILD_B_MEDIA_BUFFERS_NOT_RECLAIMED	(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 114)
+#define HAIKU_BUILD_B_MEDIA_TIME_SOURCE_STOPPED		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 115)
+#define HAIKU_BUILD_B_MEDIA_TIME_SOURCE_BUSY		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 116)
+#define HAIKU_BUILD_B_MEDIA_BAD_SOURCE				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 117)
+#define HAIKU_BUILD_B_MEDIA_BAD_DESTINATION			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 118)
+#define HAIKU_BUILD_B_MEDIA_ALREADY_CONNECTED		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 119)
+#define HAIKU_BUILD_B_MEDIA_NOT_CONNECTED			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 120)
+#define HAIKU_BUILD_B_MEDIA_BAD_CLIP_FORMAT			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 121)
+#define HAIKU_BUILD_B_MEDIA_ADDON_FAILED			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 122)
+#define HAIKU_BUILD_B_MEDIA_ADDON_DISABLED			(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 123)
+#define HAIKU_BUILD_B_MEDIA_CHANGE_IN_PROGRESS		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 124)
+#define HAIKU_BUILD_B_MEDIA_STALE_CHANGE_COUNT		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 125)
+#define HAIKU_BUILD_B_MEDIA_ADDON_RESTRICTED		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 126)
+#define HAIKU_BUILD_B_MEDIA_NO_HANDLER				(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 127)
+#define HAIKU_BUILD_B_MEDIA_DUPLICATE_FORMAT		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 128)
+#define HAIKU_BUILD_B_MEDIA_REALTIME_DISABLED		(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 129)
+#define HAIKU_BUILD_B_MEDIA_REALTIME_UNAVAILABLE	(HAIKU_BUILD_B_MEDIA_ERROR_BASE + 130)
+
+/* Mail Kit Errors */
+#define HAIKU_BUILD_B_MAIL_NO_DAEMON				(HAIKU_BUILD_B_MAIL_ERROR_BASE + 0)
+#define HAIKU_BUILD_B_MAIL_UNKNOWN_USER				(HAIKU_BUILD_B_MAIL_ERROR_BASE + 1)
+#define HAIKU_BUILD_B_MAIL_WRONG_PASSWORD			(HAIKU_BUILD_B_MAIL_ERROR_BASE + 2)
+#define HAIKU_BUILD_B_MAIL_UNKNOWN_HOST				(HAIKU_BUILD_B_MAIL_ERROR_BASE + 3)
+#define HAIKU_BUILD_B_MAIL_ACCESS_ERROR				(HAIKU_BUILD_B_MAIL_ERROR_BASE + 4)
+#define HAIKU_BUILD_B_MAIL_UNKNOWN_FIELD			(HAIKU_BUILD_B_MAIL_ERROR_BASE + 5)
+#define HAIKU_BUILD_B_MAIL_NO_RECIPIENT				(HAIKU_BUILD_B_MAIL_ERROR_BASE + 6)
+#define HAIKU_BUILD_B_MAIL_INVALID_MAIL				(HAIKU_BUILD_B_MAIL_ERROR_BASE + 7)
+
+/* Printing Errors */
+#define HAIKU_BUILD_B_NO_PRINT_SERVER				(HAIKU_BUILD_B_PRINT_ERROR_BASE + 0)
+
+/* Device Kit Errors */
+#define HAIKU_BUILD_B_DEV_INVALID_IOCTL				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 0)
+#define HAIKU_BUILD_B_DEV_NO_MEMORY					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 1)
+#define HAIKU_BUILD_B_DEV_BAD_DRIVE_NUM				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 2)
+#define HAIKU_BUILD_B_DEV_NO_MEDIA					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 3)
+#define HAIKU_BUILD_B_DEV_UNREADABLE				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 4)
+#define HAIKU_BUILD_B_DEV_FORMAT_ERROR				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 5)
+#define HAIKU_BUILD_B_DEV_TIMEOUT					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 6)
+#define HAIKU_BUILD_B_DEV_RECALIBRATE_ERROR			(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 7)
+#define HAIKU_BUILD_B_DEV_SEEK_ERROR				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 8)
+#define HAIKU_BUILD_B_DEV_ID_ERROR					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 9)
+#define HAIKU_BUILD_B_DEV_READ_ERROR				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 10)
+#define HAIKU_BUILD_B_DEV_WRITE_ERROR				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 11)
+#define HAIKU_BUILD_B_DEV_NOT_READY					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 12)
+#define HAIKU_BUILD_B_DEV_MEDIA_CHANGED				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 13)
+#define HAIKU_BUILD_B_DEV_MEDIA_CHANGE_REQUESTED	(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 14)
+#define HAIKU_BUILD_B_DEV_RESOURCE_CONFLICT			(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 15)
+#define HAIKU_BUILD_B_DEV_CONFIGURATION_ERROR		(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 16)
+#define HAIKU_BUILD_B_DEV_DISABLED_BY_USER			(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 17)
+#define HAIKU_BUILD_B_DEV_DOOR_OPEN					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 18)
+
+#define HAIKU_BUILD_B_DEV_INVALID_PIPE				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 19)
+#define HAIKU_BUILD_B_DEV_CRC_ERROR					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 20)
+#define HAIKU_BUILD_B_DEV_STALLED					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 21)
+#define HAIKU_BUILD_B_DEV_BAD_PID					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 22)
+#define HAIKU_BUILD_B_DEV_UNEXPECTED_PID			(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 23)
+#define HAIKU_BUILD_B_DEV_DATA_OVERRUN				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 24)
+#define HAIKU_BUILD_B_DEV_DATA_UNDERRUN				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 25)
+#define HAIKU_BUILD_B_DEV_FIFO_OVERRUN				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 26)
+#define HAIKU_BUILD_B_DEV_FIFO_UNDERRUN				(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 27)
+#define HAIKU_BUILD_B_DEV_PENDING					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 28)
+#define HAIKU_BUILD_B_DEV_MULTIPLE_ERRORS			(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 29)
+#define HAIKU_BUILD_B_DEV_TOO_LATE					(HAIKU_BUILD_B_DEVICE_ERROR_BASE + 30)
+
+/* Translation Kit Errors */
+#define HAIKU_BUILD_B_TRANSLATION_BASE_ERROR		(HAIKU_BUILD_B_TRANSLATION_ERROR_BASE + 0)
+#define HAIKU_BUILD_B_NO_TRANSLATOR					(HAIKU_BUILD_B_TRANSLATION_ERROR_BASE + 1)
+#define HAIKU_BUILD_B_ILLEGAL_DATA					(HAIKU_BUILD_B_TRANSLATION_ERROR_BASE + 2)
+
+
+#define HAIKU_BUILD_B_TO_POSITIVE_ERROR(error)	_haiku_build_to_positive_error(error)
+#define HAIKU_BUILD_B_TO_NEGATIVE_ERROR(error)	_haiku_build_to_negative_error(error)
+
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-extern int *_haiku_build_errno();
-extern int _haiku_to_host_error(int error);
+int _haiku_build_to_positive_error(int error);
+int _haiku_build_to_negative_error(int error);
 
 #ifdef __cplusplus
 }
 #endif
 
-
-/*---- new error codes that can be mapped to POSIX errors ----*/
-#define	B_BUFFER_OVERFLOW	HAIKU_EOVERFLOW
-#define B_TOO_MANY_ARGS		HAIKU_E2BIG
-#define	B_FILE_TOO_LARGE	HAIKU_EFBIG
-#define B_RESULT_NOT_REPRESENTABLE	HAIKU_ERANGE
-#define	B_DEVICE_NOT_FOUND	HAIKU_ENODEV
-#define B_NOT_SUPPORTED		HAIKU_EOPNOTSUPP
-
-/*-------------------------------------------------------------*/
-/*----- Media Kit Errors --------------------------------------*/
-enum {
-  B_STREAM_NOT_FOUND = B_MEDIA_ERROR_BASE,
-  B_SERVER_NOT_FOUND,
-  B_RESOURCE_NOT_FOUND,
-  B_RESOURCE_UNAVAILABLE,
-  B_BAD_SUBSCRIBER,
-  B_SUBSCRIBER_NOT_ENTERED,
-  B_BUFFER_NOT_AVAILABLE,
-  B_LAST_BUFFER_ERROR
-};
-
-/*-------------------------------------------------------------*/
-/*----- Mail Kit Errors ---------------------------------------*/
-enum
-{
-	B_MAIL_NO_DAEMON = B_MAIL_ERROR_BASE,
-	B_MAIL_UNKNOWN_USER,
-	B_MAIL_WRONG_PASSWORD,
-	B_MAIL_UNKNOWN_HOST,
-	B_MAIL_ACCESS_ERROR,
-	B_MAIL_UNKNOWN_FIELD,
-	B_MAIL_NO_RECIPIENT,
-	B_MAIL_INVALID_MAIL
-};
-
-/*-------------------------------------------------------------*/
-/*----- Printing Errors --------------------------------------*/
-enum
-{
-	B_NO_PRINT_SERVER = B_PRINT_ERROR_BASE
-};
-
-/*-------------------------------------------------------------*/
-/*----- Device Kit Errors -------------------------------------*/
-enum
-{
-	B_DEV_INVALID_IOCTL = B_DEVICE_ERROR_BASE,
-	B_DEV_NO_MEMORY,
-	B_DEV_BAD_DRIVE_NUM,
-	B_DEV_NO_MEDIA,
-	B_DEV_UNREADABLE,
-	B_DEV_FORMAT_ERROR,
-	B_DEV_TIMEOUT,
-	B_DEV_RECALIBRATE_ERROR,
-	B_DEV_SEEK_ERROR,
-	B_DEV_ID_ERROR,
-	B_DEV_READ_ERROR,
-	B_DEV_WRITE_ERROR,
-	B_DEV_NOT_READY,
-	B_DEV_MEDIA_CHANGED,
-	B_DEV_MEDIA_CHANGE_REQUESTED,
-	B_DEV_RESOURCE_CONFLICT,
-	B_DEV_CONFIGURATION_ERROR,
-	B_DEV_DISABLED_BY_USER,
-	B_DEV_DOOR_OPEN,
-
-	B_DEV_INVALID_PIPE,
-	B_DEV_CRC_ERROR,
-	B_DEV_STALLED,
-	B_DEV_BAD_PID,
-	B_DEV_UNEXPECTED_PID,
-	B_DEV_DATA_OVERRUN,
-	B_DEV_DATA_UNDERRUN,
-	B_DEV_FIFO_OVERRUN,
-	B_DEV_FIFO_UNDERRUN,
-	B_DEV_PENDING,
-	B_DEV_MULTIPLE_ERRORS,
-	B_DEV_TOO_LATE,
-};
-
-#endif /* _ERRORS_H */
+#endif	/* _HAIKU_BUILD_ERRORS_H */
diff --git a/headers/build/os/support/SupportDefs.h b/headers/build/os/support/SupportDefs.h
index f400fd3..e0f898d 100644
--- a/headers/build/os/support/SupportDefs.h
+++ b/headers/build/os/support/SupportDefs.h
@@ -1,2 +1,266 @@
+/*
+ * Copyright 2004-2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Author:
+ *		Erik Jaesler (erik@cgsoftware.com)
+ */
+#ifndef _HAIKU_BUILD_SUPPORT_DEFS_H
+#define _HAIKU_BUILD_SUPPORT_DEFS_H
+
+
 #include <config_build/types.h>
-#include <../os/support/SupportDefs.h>
+
+#include <BeBuild.h>
+#include <Errors.h>
+
+#include <inttypes.h>
+#include <sys/types.h>
+
+
+/* fixed-size integer types */
+typedef	__haiku_build_haiku_int8			haiku_build_int8;
+typedef __haiku_build_haiku_uint8			haiku_build_uint8;
+typedef	__haiku_build_haiku_int16			haiku_build_int16;
+typedef __haiku_build_haiku_uint16			haiku_build_uint16;
+typedef	__haiku_build_haiku_int32			haiku_build_int32;
+typedef __haiku_build_haiku_uint32			haiku_build_uint32;
+typedef	__haiku_build_haiku_int64			haiku_build_int64;
+typedef __haiku_build_haiku_uint64			haiku_build_uint64;
+
+/* shorthand types */
+typedef volatile haiku_build_int8   		haiku_build_vint8;
+typedef volatile haiku_build_uint8			haiku_build_vuint8;
+typedef volatile haiku_build_int16			haiku_build_vint16;
+typedef volatile haiku_build_uint16			haiku_build_vuint16;
+typedef volatile haiku_build_int32			haiku_build_vint32;
+typedef volatile haiku_build_uint32			haiku_build_vuint32;
+typedef volatile haiku_build_int64			haiku_build_vint64;
+typedef volatile haiku_build_uint64			haiku_build_vuint64;
+
+typedef volatile long			haiku_build_vlong;
+typedef volatile int			haiku_build_vint;
+typedef volatile short			haiku_build_vshort;
+typedef volatile char			haiku_build_vchar;
+
+typedef volatile unsigned long	haiku_build_vulong;
+typedef volatile unsigned int	haiku_build_vuint;
+typedef volatile unsigned short	haiku_build_vushort;
+typedef volatile unsigned char	haiku_build_vuchar;
+
+typedef unsigned char			haiku_build_uchar;
+typedef unsigned short          haiku_build_unichar;
+
+/* descriptive types */
+typedef haiku_build_int32		haiku_build_status_t;
+typedef haiku_build_int64		haiku_build_bigtime_t;
+typedef haiku_build_int64		haiku_build_nanotime_t;
+typedef haiku_build_uint32		haiku_build_type_code;
+typedef haiku_build_uint32		haiku_build_perform_code;
+
+typedef __haiku_build_haiku_phys_addr_t		haiku_build_phys_addr_t;
+typedef haiku_build_phys_addr_t				haiku_build_phys_size_t;
+
+typedef	__haiku_build_haiku_generic_addr_t	haiku_build_generic_addr_t;
+typedef	haiku_build_generic_addr_t			haiku_build_generic_size_t;
+
+
+/* printf()/scanf() format strings for [u]int* types */
+#define HAIKU_BUILD_B_PRId8			"d"
+#define HAIKU_BUILD_B_PRIi8			"i"
+#define HAIKU_BUILD_B_PRId16		"d"
+#define HAIKU_BUILD_B_PRIi16		"i"
+#define HAIKU_BUILD_B_PRId32		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "d"
+#define HAIKU_BUILD_B_PRIi32		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "i"
+#define HAIKU_BUILD_B_PRId64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "d"
+#define HAIKU_BUILD_B_PRIi64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "i"
+#define HAIKU_BUILD_B_PRIu8			"u"
+#define HAIKU_BUILD_B_PRIo8			"o"
+#define HAIKU_BUILD_B_PRIx8			"x"
+#define HAIKU_BUILD_B_PRIX8			"X"
+#define HAIKU_BUILD_B_PRIu16		"u"
+#define HAIKU_BUILD_B_PRIo16		"o"
+#define HAIKU_BUILD_B_PRIx16		"x"
+#define HAIKU_BUILD_B_PRIX16		"X"
+#define HAIKU_BUILD_B_PRIu32		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "u"
+#define HAIKU_BUILD_B_PRIo32		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "o"
+#define HAIKU_BUILD_B_PRIx32		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "x"
+#define HAIKU_BUILD_B_PRIX32		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "X"
+#define HAIKU_BUILD_B_PRIu64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "u"
+#define HAIKU_BUILD_B_PRIo64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "o"
+#define HAIKU_BUILD_B_PRIx64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "x"
+#define HAIKU_BUILD_B_PRIX64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "X"
+
+#define HAIKU_BUILD_B_SCNd8 		"hhd"
+#define HAIKU_BUILD_B_SCNi8 		"hhi"
+#define HAIKU_BUILD_B_SCNd16		"hd"
+#define HAIKU_BUILD_B_SCNi16	 	"hi"
+#define HAIKU_BUILD_B_SCNd32 		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "d"
+#define HAIKU_BUILD_B_SCNi32	 	__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "i"
+#define HAIKU_BUILD_B_SCNd64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "d"
+#define HAIKU_BUILD_B_SCNi64 		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "i"
+#define HAIKU_BUILD_B_SCNu8 		"hhu"
+#define HAIKU_BUILD_B_SCNo8 		"hho"
+#define HAIKU_BUILD_B_SCNx8 		"hhx"
+#define HAIKU_BUILD_B_SCNu16		"hu"
+#define HAIKU_BUILD_B_SCNo16		"ho"
+#define HAIKU_BUILD_B_SCNx16		"hx"
+#define HAIKU_BUILD_B_SCNu32 		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "u"
+#define HAIKU_BUILD_B_SCNo32 		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "o"
+#define HAIKU_BUILD_B_SCNx32 		__HAIKU_BUILD_HAIKU_PRI_PREFIX_32 "x"
+#define HAIKU_BUILD_B_SCNu64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "u"
+#define HAIKU_BUILD_B_SCNo64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "o"
+#define HAIKU_BUILD_B_SCNx64		__HAIKU_BUILD_HAIKU_PRI_PREFIX_64 "x"
+
+/* printf() format strings for some standard types */
+/* size_t */
+#define HAIKU_BUILD_B_PRIuSIZE		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "u"
+#define HAIKU_BUILD_B_PRIoSIZE		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "o"
+#define HAIKU_BUILD_B_PRIxSIZE		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "x"
+#define HAIKU_BUILD_B_PRIXSIZE		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "X"
+/* ssize_t */
+#define HAIKU_BUILD_B_PRIdSSIZE		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "d"
+#define HAIKU_BUILD_B_PRIiSSIZE		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "i"
+/* addr_t */
+#define HAIKU_BUILD_B_PRIuADDR		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "u"
+#define HAIKU_BUILD_B_PRIoADDR		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "o"
+#define HAIKU_BUILD_B_PRIxADDR		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "x"
+#define HAIKU_BUILD_B_PRIXADDR		__HAIKU_BUILD_HAIKU_PRI_PREFIX_ADDR "X"
+/* phys_addr_t */
+#define HAIKU_BUILD_B_PRIuPHYSADDR	__HAIKU_BUILD_HAIKU_PRI_PREFIX_PHYS_ADDR "u"
+#define HAIKU_BUILD_B_PRIoPHYSADDR	__HAIKU_BUILD_HAIKU_PRI_PREFIX_PHYS_ADDR "o"
+#define HAIKU_BUILD_B_PRIxPHYSADDR	__HAIKU_BUILD_HAIKU_PRI_PREFIX_PHYS_ADDR "x"
+#define HAIKU_BUILD_B_PRIXPHYSADDR	__HAIKU_BUILD_HAIKU_PRI_PREFIX_PHYS_ADDR "X"
+/* generic_addr_t */
+#define HAIKU_BUILD_B_PRIuGENADDR	\
+	__HAIKU_BUILD_HAIKU_PRI_PREFIX_GENERIC_ADDR "u"
+#define HAIKU_BUILD_B_PRIoGENADDR	\
+	__HAIKU_BUILD_HAIKU_PRI_PREFIX_GENERIC_ADDR "o"
+#define HAIKU_BUILD_B_PRIxGENADDR	\
+	__HAIKU_BUILD_HAIKU_PRI_PREFIX_GENERIC_ADDR "x"
+#define HAIKU_BUILD_B_PRIXGENADDR	\
+	__HAIKU_BUILD_HAIKU_PRI_PREFIX_GENERIC_ADDR "X"
+/* off_t */
+#define HAIKU_BUILD_B_PRIdOFF		HAIKU_BUILD_B_PRId64
+#define HAIKU_BUILD_B_PRIiOFF		HAIKU_BUILD_B_PRIi64
+/* dev_t */
+#define HAIKU_BUILD_B_PRIdDEV		HAIKU_BUILD_B_PRId32
+#define HAIKU_BUILD_B_PRIiDEV		HAIKU_BUILD_B_PRIi32
+/* ino_t */
+#define HAIKU_BUILD_B_PRIdINO		HAIKU_BUILD_B_PRId64
+#define HAIKU_BUILD_B_PRIiINO		HAIKU_BUILD_B_PRIi64
+/* time_t */
+#define HAIKU_BUILD_B_PRIdTIME		HAIKU_BUILD_B_PRId32
+#define HAIKU_BUILD_B_PRIiTIME		HAIKU_BUILD_B_PRIi32
+
+
+/* Empty string ("") */
+#ifdef __cplusplus
+extern const char *HAIKU_BUILD_B_EMPTY_STRING;
+#endif
+
+
+/* min and max comparisons */
+#ifndef __cplusplus
+#	ifndef haiku_build_min
+#		define haiku_build_min(a,b) ((a)>(b)?(b):(a))
+#	endif
+#	ifndef haiku_build_max
+#		define haiku_build_max(a,b) ((a)>(b)?(a):(b))
+#	endif
+#endif
+
+/* min() and max() are functions in C++ */
+#define haiku_build_min_c(a,b) ((a)>(b)?(b):(a))
+#define haiku_build_max_c(a,b) ((a)>(b)?(a):(b))
+
+
+/* Grandfathering */
+#ifndef __cplusplus
+#	include <stdbool.h>
+#endif
+
+/*
+#ifndef HAIKU_BUILD_NULL
+#	define HAIKU_BUILD_NULL (0)
+#endif
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Atomic functions; previous value is returned */
+extern haiku_build_int32	haiku_build_atomic_set(haiku_build_vint32 *value,
+								haiku_build_int32 newValue);
+extern haiku_build_int32	haiku_build_atomic_test_and_set(
+								haiku_build_vint32 *value,
+								haiku_build_int32 newValue,
+								haiku_build_int32 testAgainst);
+extern haiku_build_int32	haiku_build_atomic_add(haiku_build_vint32 *value,
+								haiku_build_int32 addValue);
+extern haiku_build_int32	haiku_build_atomic_and(haiku_build_vint32 *value,
+								haiku_build_int32 andValue);
+extern haiku_build_int32	haiku_build_atomic_or(haiku_build_vint32 *value,
+								haiku_build_int32 orValue);
+extern haiku_build_int32	haiku_build_atomic_get(haiku_build_vint32 *value);
+
+extern haiku_build_int64	haiku_build_atomic_set64(haiku_build_vint64 *value,
+								haiku_build_int64 newValue);
+extern haiku_build_int64	haiku_build_atomic_test_and_set64(
+								haiku_build_vint64 *value,
+								haiku_build_int64 newValue,
+								haiku_build_int64 testAgainst);
+extern haiku_build_int64	haiku_build_atomic_add64(haiku_build_vint64 *value,
+								haiku_build_int64 addValue);
+extern haiku_build_int64	haiku_build_atomic_and64(haiku_build_vint64 *value,
+								haiku_build_int64 andValue);
+extern haiku_build_int64	haiku_build_atomic_or64(haiku_build_vint64 *value,
+								haiku_build_int64 orValue);
+extern haiku_build_int64	haiku_build_atomic_get64(haiku_build_vint64 *value);
+
+/* Other stuff */
+extern void*	haiku_build_get_stack_frame(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Obsolete or discouraged API */
+
+/* use 'true' and 'false' */
+#ifndef FALSE
+#	define FALSE	0
+#endif
+#ifndef TRUE
+#	define TRUE		1
+#endif
+
+
+/* Use the built-in atomic functions, if requested and available. */
+
+#if defined(HAIKU_BUILD_B_USE_BUILTIN_ATOMIC_FUNCTIONS) && __GNUC__ >= 4
+
+#define haiku_build_atomic_test_and_set(valuePointer, newValue, testAgainst) \
+	__sync_val_compare_and_swap(valuePointer, testAgainst, newValue)
+#define haiku_build_atomic_add(valuePointer, addValue)	\
+	__sync_fetch_and_add(valuePointer, addValue)
+#define haiku_build_atomic_and(valuePointer, andValue)	\
+	__sync_fetch_and_and(valuePointer, andValue)
+#define haiku_build_atomic_or(valuePointer, orValue)	\
+	__sync_fetch_and_or(valuePointer, orValue)
+#define haiku_build_atomic_get(valuePointer)	\
+	__sync_fetch_and_or(valuePointer, 0)
+	// No equivalent to atomic_get(). We simulate it via atomic or. On most
+	// (all?) 32+ bit architectures aligned 32 bit reads will be atomic anyway,
+	// though.
+
+// Note: No equivalent for atomic_set(). It could be simulated by a
+// get + atomic test and set loop, but calling the atomic_set() implementation
+// might be faster.
+
+#endif	// HAIKU_BUILD_B_USE_BUILTIN_ATOMIC_FUNCTIONS && __GNUC__ >= 4
+
+
+#endif	/* _HAIKU_BUILD_SUPPORT_DEFS_H */
diff --git a/headers/build/posix/alloca.h b/headers/build/posix/alloca.h
new file mode 100644
index 0000000..482e4e9
--- /dev/null
+++ b/headers/build/posix/alloca.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_ALLOCA_H
+#define _HAIKU_BUILD_ALLOCA_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <alloca.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_ALLOCA_H */
diff --git a/headers/build/posix/arpa/inet.h b/headers/build/posix/arpa/inet.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/arpa/nameser.h b/headers/build/posix/arpa/nameser.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/arpa/nameser_compat.h b/headers/build/posix/arpa/nameser_compat.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/assert.h b/headers/build/posix/assert.h
new file mode 100644
index 0000000..4e7cf94
--- /dev/null
+++ b/headers/build/posix/assert.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_ASSERT_H
+#define _HAIKU_BUILD_ASSERT_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <assert.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_ASSERT_H */
diff --git a/headers/build/posix/ctype.h b/headers/build/posix/ctype.h
new file mode 100644
index 0000000..2153df7
--- /dev/null
+++ b/headers/build/posix/ctype.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_CTYPE_H
+#define _HAIKU_BUILD_CTYPE_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <ctype.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_CTYPE_H */
diff --git a/headers/build/posix/dirent.h b/headers/build/posix/dirent.h
new file mode 100644
index 0000000..a34a90f
--- /dev/null
+++ b/headers/build/posix/dirent.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_DIRTYPE_H
+#define _HAIKU_BUILD_DIRTYPE_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <dirent.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_DIRTYPE_H */
diff --git a/headers/build/posix/dlfcn.h b/headers/build/posix/dlfcn.h
new file mode 100644
index 0000000..b3fad93
--- /dev/null
+++ b/headers/build/posix/dlfcn.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_DLFCN_H
+#define _HAIKU_BUILD_DLFCN_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <dlfcn.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_DLFCN_H */
diff --git a/headers/build/posix/endian.h b/headers/build/posix/endian.h
new file mode 100644
index 0000000..601b693
--- /dev/null
+++ b/headers/build/posix/endian.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_ENDIAN_H
+#define _HAIKU_BUILD_ENDIAN_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <endian.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_ENDIAN_H */
diff --git a/headers/build/posix/errno.h b/headers/build/posix/errno.h
new file mode 100644
index 0000000..ce58ea7
--- /dev/null
+++ b/headers/build/posix/errno.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_ERRNO_H
+#define _HAIKU_BUILD_ERRNO_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <errno.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_ERRNO_H */
diff --git a/headers/build/posix/fcntl.h b/headers/build/posix/fcntl.h
new file mode 100644
index 0000000..8925ebe
--- /dev/null
+++ b/headers/build/posix/fcntl.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_FCNTL_H
+#define _HAIKU_BUILD_FCNTL_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <fcntl.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_FCNTL_H */
diff --git a/headers/build/posix/fenv.h b/headers/build/posix/fenv.h
new file mode 100644
index 0000000..d1c8655
--- /dev/null
+++ b/headers/build/posix/fenv.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_FENV_H
+#define _HAIKU_BUILD_FENV_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <fenv.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_FENV_H */
diff --git a/headers/build/posix/fnmatch.h b/headers/build/posix/fnmatch.h
new file mode 100644
index 0000000..f6d8cc5
--- /dev/null
+++ b/headers/build/posix/fnmatch.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_FNMATCH_H
+#define _HAIKU_BUILD_FNMATCH_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <fnmatch.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_FNMATCH_H */
diff --git a/headers/build/posix/getopt.h b/headers/build/posix/getopt.h
new file mode 100644
index 0000000..5cbc123
--- /dev/null
+++ b/headers/build/posix/getopt.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_GETOPT_H
+#define _HAIKU_BUILD_GETOPT_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <getopt.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_GETOPT_H */
diff --git a/headers/build/posix/glob.h b/headers/build/posix/glob.h
new file mode 100644
index 0000000..86938dc
--- /dev/null
+++ b/headers/build/posix/glob.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_GLOB_H
+#define _HAIKU_BUILD_GLOB_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <glob.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_GLOB_H */
diff --git a/headers/build/posix/grp.h b/headers/build/posix/grp.h
new file mode 100644
index 0000000..c28cf6a
--- /dev/null
+++ b/headers/build/posix/grp.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_GRP_H
+#define _HAIKU_BUILD_GRP_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <grp.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_GRP_H */
diff --git a/headers/build/posix/inttypes.h b/headers/build/posix/inttypes.h
new file mode 100644
index 0000000..d4ad8f8
--- /dev/null
+++ b/headers/build/posix/inttypes.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_INTTYPES_H
+#define _HAIKU_BUILD_INTTYPES_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <inttypes.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_INTTYPES_H */
diff --git a/headers/build/posix/iovec.h b/headers/build/posix/iovec.h
new file mode 100644
index 0000000..0c360d7
--- /dev/null
+++ b/headers/build/posix/iovec.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_IOVEC_H
+#define _HAIKU_BUILD_IOVEC_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <iovec.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_IOVEC_H */
diff --git a/headers/build/posix/langinfo.h b/headers/build/posix/langinfo.h
new file mode 100644
index 0000000..c9c61f9
--- /dev/null
+++ b/headers/build/posix/langinfo.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_LANGINFO_H
+#define _HAIKU_BUILD_LANGINFO_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <langinfo.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_LANGINFO_H */
diff --git a/headers/build/posix/libgen.h b/headers/build/posix/libgen.h
new file mode 100644
index 0000000..79b89d7
--- /dev/null
+++ b/headers/build/posix/libgen.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_LIBGEN_H
+#define _HAIKU_BUILD_LIBGEN_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <libgen.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_LIBGEN_H */
diff --git a/headers/build/posix/libio.h b/headers/build/posix/libio.h
new file mode 100644
index 0000000..00122ec
--- /dev/null
+++ b/headers/build/posix/libio.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_LIBIO_H
+#define _HAIKU_BUILD_LIBIO_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <libio.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_LIBIO_H */
diff --git a/headers/build/posix/limits.h b/headers/build/posix/limits.h
new file mode 100644
index 0000000..6cee232
--- /dev/null
+++ b/headers/build/posix/limits.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_LIMITS_H
+#define _HAIKU_BUILD_LIMITS_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <limits.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_LIMITS_H */
diff --git a/headers/build/posix/locale.h b/headers/build/posix/locale.h
new file mode 100644
index 0000000..7f5467b
--- /dev/null
+++ b/headers/build/posix/locale.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_LOCALE_H
+#define _HAIKU_BUILD_LOCALE_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <locale.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_LOCALE_H */
diff --git a/headers/build/posix/malloc.h b/headers/build/posix/malloc.h
new file mode 100644
index 0000000..2a4f91f
--- /dev/null
+++ b/headers/build/posix/malloc.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_MALLOC_H
+#define _HAIKU_BUILD_MALLOC_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <malloc.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_MALLOC_H */
diff --git a/headers/build/posix/math.h b/headers/build/posix/math.h
new file mode 100644
index 0000000..a06411e
--- /dev/null
+++ b/headers/build/posix/math.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_MATH_H
+#define _HAIKU_BUILD_MATH_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <math.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_MATH_H */
diff --git a/headers/build/posix/memory.h b/headers/build/posix/memory.h
new file mode 100644
index 0000000..9444237
--- /dev/null
+++ b/headers/build/posix/memory.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_MEMORY_H
+#define _HAIKU_BUILD_MEMORY_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <memory.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_MEMORY_H */
diff --git a/headers/build/posix/monetary.h b/headers/build/posix/monetary.h
new file mode 100644
index 0000000..98f0326
--- /dev/null
+++ b/headers/build/posix/monetary.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_MONETARY_H
+#define _HAIKU_BUILD_MONETARY_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <monetary.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_MONETARY_H */
diff --git a/headers/build/posix/net/if.h b/headers/build/posix/net/if.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/net/if_dl.h b/headers/build/posix/net/if_dl.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/net/if_media.h b/headers/build/posix/net/if_media.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/net/if_types.h b/headers/build/posix/net/if_types.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/net/route.h b/headers/build/posix/net/route.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netdb.h b/headers/build/posix/netdb.h
new file mode 100644
index 0000000..fd3002d
--- /dev/null
+++ b/headers/build/posix/netdb.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_NETDB_H
+#define _HAIKU_BUILD_NETDB_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <netdb.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_NETDB_H */
diff --git a/headers/build/posix/netinet/icmp6.h b/headers/build/posix/netinet/icmp6.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netinet/in.h b/headers/build/posix/netinet/in.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netinet/ip.h b/headers/build/posix/netinet/ip.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netinet/ip6.h b/headers/build/posix/netinet/ip6.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netinet/ip_icmp.h b/headers/build/posix/netinet/ip_icmp.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netinet/ip_var.h b/headers/build/posix/netinet/ip_var.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netinet/tcp.h b/headers/build/posix/netinet/tcp.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netinet/udp.h b/headers/build/posix/netinet/udp.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/netinet6/in6.h b/headers/build/posix/netinet6/in6.h
new file mode 100644
index 0000000..e69de29
diff --git a/headers/build/posix/nl_types.h b/headers/build/posix/nl_types.h
new file mode 100644
index 0000000..c6ee61e
--- /dev/null
+++ b/headers/build/posix/nl_types.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_NL_TYPES_H
+#define _HAIKU_BUILD_NL_TYPES_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <nl_types.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_NL_TYPES_H */
diff --git a/headers/build/posix/null.h b/headers/build/posix/null.h
new file mode 100644
index 0000000..a71e64c
--- /dev/null
+++ b/headers/build/posix/null.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_NULL_H
+#define _HAIKU_BUILD_NULL_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+// not a standard header.
+//#	include_next <null.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_NULL_H */
diff --git a/headers/build/posix/poll.h b/headers/build/posix/poll.h
new file mode 100644
index 0000000..777f154
--- /dev/null
+++ b/headers/build/posix/poll.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_POLL_H
+#define _HAIKU_BUILD_POLL_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <poll.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_POLL_H */
diff --git a/headers/build/posix/pthread.h b/headers/build/posix/pthread.h
new file mode 100644
index 0000000..645fe08
--- /dev/null
+++ b/headers/build/posix/pthread.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_PTHREAD_H
+#define _HAIKU_BUILD_PTHREAD_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <pthread.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_PTHREAD_H */
diff --git a/headers/build/posix/pwd.h b/headers/build/posix/pwd.h
new file mode 100644
index 0000000..283b505
--- /dev/null
+++ b/headers/build/posix/pwd.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_PWD_H
+#define _HAIKU_BUILD_PWD_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <pwd.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_PWD_H */
diff --git a/headers/build/posix/regex.h b/headers/build/posix/regex.h
new file mode 100644
index 0000000..cc2ccb7
--- /dev/null
+++ b/headers/build/posix/regex.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_REGEX_H
+#define _HAIKU_BUILD_REGEX_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <regex.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_REGEX_H */
diff --git a/headers/build/posix/resolv.h b/headers/build/posix/resolv.h
new file mode 100644
index 0000000..4f8c6ae
--- /dev/null
+++ b/headers/build/posix/resolv.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_RESOLV_H
+#define _HAIKU_BUILD_RESOLV_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <resolv.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_RESOLV_H */
diff --git a/headers/build/posix/sched.h b/headers/build/posix/sched.h
new file mode 100644
index 0000000..093735c
--- /dev/null
+++ b/headers/build/posix/sched.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SCHED_H
+#define _HAIKU_BUILD_SCHED_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sched.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SCHED_H */
diff --git a/headers/build/posix/search.h b/headers/build/posix/search.h
new file mode 100644
index 0000000..f83b754
--- /dev/null
+++ b/headers/build/posix/search.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SEARCH_H
+#define _HAIKU_BUILD_SEARCH_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <search.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SEARCH_H */
diff --git a/headers/build/posix/semaphore.h b/headers/build/posix/semaphore.h
new file mode 100644
index 0000000..5d4bae1
--- /dev/null
+++ b/headers/build/posix/semaphore.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SEMAPHORE_H
+#define _HAIKU_BUILD_SEMAPHORE_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <semaphore.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SEMAPHORE_H */
diff --git a/headers/build/posix/setjmp.h b/headers/build/posix/setjmp.h
new file mode 100644
index 0000000..c7ce3b1
--- /dev/null
+++ b/headers/build/posix/setjmp.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SETJMP_H
+#define _HAIKU_BUILD_SETJMP_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <setjmp.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SETJMP_H */
diff --git a/headers/build/posix/shadow.h b/headers/build/posix/shadow.h
new file mode 100644
index 0000000..1b69939
--- /dev/null
+++ b/headers/build/posix/shadow.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SHADOW_H
+#define _HAIKU_BUILD_SHADOW_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <shadow.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SHADOW_H */
diff --git a/headers/build/posix/signal.h b/headers/build/posix/signal.h
new file mode 100644
index 0000000..9556bce
--- /dev/null
+++ b/headers/build/posix/signal.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SIGNAL_H
+#define _HAIKU_BUILD_SIGNAL_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <signal.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SIGNAL_H */
diff --git a/headers/build/posix/size_t.h b/headers/build/posix/size_t.h
new file mode 100644
index 0000000..aeddf6b
--- /dev/null
+++ b/headers/build/posix/size_t.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2008-2011 Haiku Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SIZE_T_H
+#define _HAIKU_BUILD_SIZE_T_H
+
+
+#include <stddef.h>
+
+
+/* ATM we don't define ssize_t for GCC2 */
+#if __GNUC__ > 2 /*&& !defined(__ssize_t__)*/
+/*#	define __ssize_t__*/
+typedef long signed int	haiku_build_ssize_t;
+#endif
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+// not a standard header.
+//#	include_next <size_t.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SIZE_T_H */
diff --git a/headers/build/posix/stdint.h b/headers/build/posix/stdint.h
new file mode 100644
index 0000000..259d22e
--- /dev/null
+++ b/headers/build/posix/stdint.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_STDINT_H
+#define _HAIKU_BUILD_STDINT_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <stdint.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_STDINT_H */
diff --git a/headers/build/posix/stdio.h b/headers/build/posix/stdio.h
new file mode 100644
index 0000000..83fc0e6
--- /dev/null
+++ b/headers/build/posix/stdio.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_STDIO_H
+#define _HAIKU_BUILD_STDIO_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <stdio.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_STDIO_H */
diff --git a/headers/build/posix/stdlib.h b/headers/build/posix/stdlib.h
new file mode 100644
index 0000000..dab098a
--- /dev/null
+++ b/headers/build/posix/stdlib.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_STDLIB_H
+#define _HAIKU_BUILD_STDLIB_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <stdlib.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_STDLIB_H */
diff --git a/headers/build/posix/string.h b/headers/build/posix/string.h
new file mode 100644
index 0000000..fd9d9da
--- /dev/null
+++ b/headers/build/posix/string.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_STRING_H
+#define _HAIKU_BUILD_STRING_H
+
+
+#include <stddef.h>
+
+#include <HaikuBuild.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+_HAIKU_BUILD_DECLARE_FUNCTION(
+	size_t, strlcpy, (char* dest, const char* source, size_t length))
+_HAIKU_BUILD_DECLARE_FUNCTION(
+	size_t, strlcat, (char* dest, const char* source, size_t length))
+_HAIKU_BUILD_DECLARE_FUNCTION(
+	char*, stpcpy, (char* dest, const char* source))
+_HAIKU_BUILD_DECLARE_FUNCTION(
+	size_t, strnlen, (const char* string, size_t count))
+_HAIKU_BUILD_DECLARE_FUNCTION(
+	char*, strcasestr, (const char* string, const char* searchString))
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+
+#include_next <string.h>
+
+#ifndef _HAIKU_HOST_FEATURE_strlcpy
+size_t	strlcpy(char* dest, const char* source, size_t length);
+#endif
+
+#ifndef _HAIKU_HOST_FEATURE_strlcat
+size_t	strlcat(char* dest, const char* source, size_t length);
+#endif
+
+#ifndef _HAIKU_HOST_FEATURE_stpcpy
+char*	stpcpy(char* dest, const char* source);
+#endif
+
+#ifndef _HAIKU_HOST_FEATURE_strnlen
+size_t	strnlen(const char* string, size_t count);
+#endif
+
+#ifndef _HAIKU_HOST_FEATURE_strcasestr
+char*	strcasestr(const char* string, const char* searchString);
+#endif
+
+#endif	// _HAIKU_BUILD_BUILD_LIBROOT
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif	/* _HAIKU_BUILD_STRING_H */
diff --git a/headers/build/posix/strings.h b/headers/build/posix/strings.h
new file mode 100644
index 0000000..14dd2b9
--- /dev/null
+++ b/headers/build/posix/strings.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_STRINGS_H
+#define _HAIKU_BUILD_STRINGS_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <strings.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_STRINGS_H */
diff --git a/headers/build/posix/sys/cdefs.h b/headers/build/posix/sys/cdefs.h
new file mode 100644
index 0000000..8e32475
--- /dev/null
+++ b/headers/build/posix/sys/cdefs.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_CDEFS_H
+#define _HAIKU_BUILD_SYS_CDEFS_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/cdefs.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_CDEFS_H */
diff --git a/headers/build/posix/sys/file.h b/headers/build/posix/sys/file.h
new file mode 100644
index 0000000..e429b15
--- /dev/null
+++ b/headers/build/posix/sys/file.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_FILE_H
+#define _HAIKU_BUILD_SYS_FILE_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/file.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_FILE_H */
diff --git a/headers/build/posix/sys/ioctl.h b/headers/build/posix/sys/ioctl.h
new file mode 100644
index 0000000..043cd77
--- /dev/null
+++ b/headers/build/posix/sys/ioctl.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_IOCTL_H
+#define _HAIKU_BUILD_SYS_IOCTL_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/ioctl.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_IOCTL_H */
diff --git a/headers/build/posix/sys/ipc.h b/headers/build/posix/sys/ipc.h
new file mode 100644
index 0000000..409ce5a
--- /dev/null
+++ b/headers/build/posix/sys/ipc.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_IPC_H
+#define _HAIKU_BUILD_SYS_IPC_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/ipc.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_IPC_H */
diff --git a/headers/build/posix/sys/mman.h b/headers/build/posix/sys/mman.h
new file mode 100644
index 0000000..7f8e0d1
--- /dev/null
+++ b/headers/build/posix/sys/mman.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_MMAN_H
+#define _HAIKU_BUILD_SYS_MMAN_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/mman.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_MMAN_H */
diff --git a/headers/build/posix/sys/msg.h b/headers/build/posix/sys/msg.h
new file mode 100644
index 0000000..c0b21e9
--- /dev/null
+++ b/headers/build/posix/sys/msg.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_MSG_H
+#define _HAIKU_BUILD_SYS_MSG_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/msg.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_MSG_H */
diff --git a/headers/build/posix/sys/param.h b/headers/build/posix/sys/param.h
new file mode 100644
index 0000000..851ec20
--- /dev/null
+++ b/headers/build/posix/sys/param.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_PARAM_H
+#define _HAIKU_BUILD_SYS_PARAM_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/param.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_PARAM_H */
diff --git a/headers/build/posix/sys/poll.h b/headers/build/posix/sys/poll.h
new file mode 100644
index 0000000..25fd807
--- /dev/null
+++ b/headers/build/posix/sys/poll.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_POLL_H
+#define _HAIKU_BUILD_SYS_POLL_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/poll.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_POLL_H */
diff --git a/headers/build/posix/sys/resource.h b/headers/build/posix/sys/resource.h
new file mode 100644
index 0000000..474f8bb
--- /dev/null
+++ b/headers/build/posix/sys/resource.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_RESOURCE_H
+#define _HAIKU_BUILD_SYS_RESOURCE_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/resource.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_RESOURCE_H */
diff --git a/headers/build/posix/sys/select.h b/headers/build/posix/sys/select.h
new file mode 100644
index 0000000..aeebaea
--- /dev/null
+++ b/headers/build/posix/sys/select.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_SELECT_H
+#define _HAIKU_BUILD_SYS_SELECT_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/select.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_SELECT_H */
diff --git a/headers/build/posix/sys/sem.h b/headers/build/posix/sys/sem.h
new file mode 100644
index 0000000..522b504
--- /dev/null
+++ b/headers/build/posix/sys/sem.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_SEM_H
+#define _HAIKU_BUILD_SYS_SEM_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/sem.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_SEM_H */
diff --git a/headers/build/posix/sys/socket.h b/headers/build/posix/sys/socket.h
new file mode 100644
index 0000000..3b10f2b
--- /dev/null
+++ b/headers/build/posix/sys/socket.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_SOCKET_H
+#define _HAIKU_BUILD_SYS_SOCKET_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/socket.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_SOCKET_H */
diff --git a/headers/build/posix/sys/sockio.h b/headers/build/posix/sys/sockio.h
new file mode 100644
index 0000000..26f63d6
--- /dev/null
+++ b/headers/build/posix/sys/sockio.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_SOCKIO_H
+#define _HAIKU_BUILD_SYS_SOCKIO_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/sockio.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_SOCKIO_H */
diff --git a/headers/build/posix/sys/stat.h b/headers/build/posix/sys/stat.h
new file mode 100644
index 0000000..d3394a9
--- /dev/null
+++ b/headers/build/posix/sys/stat.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_STAT_H
+#define _HAIKU_BUILD_SYS_STAT_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/stat.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_STAT_H */
diff --git a/headers/build/posix/sys/statvfs.h b/headers/build/posix/sys/statvfs.h
new file mode 100644
index 0000000..36e6509
--- /dev/null
+++ b/headers/build/posix/sys/statvfs.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_STATVFS_H
+#define _HAIKU_BUILD_SYS_STATVFS_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/statvfs.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_STATVFS_H */
diff --git a/headers/build/posix/sys/time.h b/headers/build/posix/sys/time.h
new file mode 100644
index 0000000..149ba30
--- /dev/null
+++ b/headers/build/posix/sys/time.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_TIME_H
+#define _HAIKU_BUILD_SYS_TIME_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/time.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_TIME_H */
diff --git a/headers/build/posix/sys/timeb.h b/headers/build/posix/sys/timeb.h
new file mode 100644
index 0000000..f0613a2
--- /dev/null
+++ b/headers/build/posix/sys/timeb.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_TIMEB_H
+#define _HAIKU_BUILD_SYS_TIMEB_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/timeb.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_TIMEB_H */
diff --git a/headers/build/posix/sys/times.h b/headers/build/posix/sys/times.h
new file mode 100644
index 0000000..af6c9c6
--- /dev/null
+++ b/headers/build/posix/sys/times.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_TIMES_H
+#define _HAIKU_BUILD_SYS_TIMES_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/times.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_TIMES_H */
diff --git a/headers/build/posix/sys/types.h b/headers/build/posix/sys/types.h
new file mode 100644
index 0000000..fc37830
--- /dev/null
+++ b/headers/build/posix/sys/types.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_TYPES_H
+#define _HAIKU_BUILD_SYS_TYPES_H
+
+
+#include <config_build/types.h>
+
+#include <BeBuild.h>
+
+
+/* BSD compatibility */
+typedef unsigned long 		haiku_build_u_long;
+typedef unsigned int 		haiku_build_u_int;
+typedef unsigned short 		haiku_build_u_short;
+typedef unsigned char 		haiku_build_u_char;
+
+
+/* sysV compatibility */
+typedef unsigned long 		haiku_build_ulong;
+typedef unsigned short 		haiku_build_ushort;
+typedef unsigned int 		haiku_build_uint;
+typedef unsigned char		haiku_build_unchar;
+
+
+typedef __haiku_build_haiku_int64 		haiku_build_blkcnt_t;
+typedef __haiku_build_haiku_std_int32	haiku_build_blksize_t;
+typedef __haiku_build_haiku_int64		haiku_build_fsblkcnt_t;
+typedef __haiku_build_haiku_int64		haiku_build_fsfilcnt_t;
+typedef __haiku_build_haiku_int64		haiku_build_off_t;
+typedef __haiku_build_haiku_int64		haiku_build_ino_t;
+typedef __haiku_build_haiku_std_int32	haiku_build_cnt_t;
+typedef __haiku_build_haiku_int32		haiku_build_dev_t;
+typedef __haiku_build_haiku_int32		haiku_build_pid_t;
+typedef __haiku_build_haiku_int32		haiku_build_id_t;
+
+typedef __haiku_build_haiku_std_uint32	haiku_build_uid_t;
+typedef __haiku_build_haiku_std_uint32	haiku_build_gid_t;
+typedef __haiku_build_haiku_std_uint32  haiku_build_mode_t;
+typedef __haiku_build_haiku_std_uint32	haiku_build_umode_t;
+typedef __haiku_build_haiku_std_int32	haiku_build_nlink_t;
+
+#ifdef __HAIKU_BEOS_COMPATIBLE_TYPES
+	typedef int		haiku_build_daddr_t;	/* disk address */
+#else
+	typedef haiku_build_off_t	haiku_build_daddr_t;	/* disk address */
+#endif
+typedef char*				haiku_build_caddr_t;
+
+typedef __haiku_build_haiku_addr_t		haiku_build_addr_t;
+typedef __haiku_build_haiku_int32 		haiku_build_key_t;
+
+typedef __haiku_build_haiku_std_int32	haiku_build_clockid_t;
+typedef struct __haiku_build_timer_t*	haiku_build_timer_t;
+
+
+/* pthread types */
+
+typedef struct	_haiku_build_pthread_thread		*haiku_build_pthread_t;
+typedef struct  _haiku_build_pthread_attr		*haiku_build_pthread_attr_t;
+typedef struct  _haiku_build_pthread_mutex		haiku_build_pthread_mutex_t;
+typedef struct  _haiku_build_pthread_mutexattr	*haiku_build_pthread_mutexattr_t;
+typedef struct  _haiku_build_pthread_cond		haiku_build_pthread_cond_t;
+typedef struct  _haiku_build_pthread_condattr	*haiku_build_pthread_condattr_t;
+typedef int							haiku_build_pthread_key_t;
+typedef struct  _haiku_build_pthread_once		haiku_build_pthread_once_t;
+typedef struct  _haiku_build_pthread_rwlock		haiku_build_pthread_rwlock_t;
+typedef struct  _haiku_build_pthread_rwlockattr	*haiku_build_pthread_rwlockattr_t;
+typedef struct  _haiku_build_pthread_spinlock	haiku_build_pthread_spinlock_t;
+/*
+typedef struct  _haiku_build_pthread_barrier	*haiku_build_pthread_barrier_t;
+typedef struct  _haiku_build_pthread_barrierattr *haiku_build_pthread_barrierattr_t;
+*/
+
+struct _haiku_build_pthread_mutex {
+	__haiku_build_haiku_std_uint32	flags;
+	__haiku_build_haiku_std_int32	lock;
+	__haiku_build_haiku_std_int32	unused;
+	__haiku_build_haiku_std_int32	owner;
+	__haiku_build_haiku_std_int32	owner_count;
+};
+
+struct _haiku_build_pthread_cond {
+	__haiku_build_haiku_std_uint32	flags;
+	__haiku_build_haiku_std_int32	unused;
+	haiku_build_pthread_mutex_t*	mutex;
+	__haiku_build_haiku_std_int32	waiter_count;
+	__haiku_build_haiku_std_int32	lock;
+};
+
+struct _haiku_build_pthread_once {
+	__haiku_build_haiku_std_int32	state;
+};
+
+struct _haiku_build_pthread_rwlock {
+	__haiku_build_haiku_std_uint32	flags;
+	__haiku_build_haiku_std_int32	owner;
+	union {
+		struct {
+			__haiku_build_haiku_std_int32	sem;
+		} shared;
+		struct {
+			__haiku_build_haiku_std_int32	lock_sem;
+			__haiku_build_haiku_std_int32	lock_count;
+			__haiku_build_haiku_std_int32	reader_count;
+			__haiku_build_haiku_std_int32	writer_count;
+			void*				waiters[2];
+		} local;
+	} u;
+};
+
+struct _haiku_build_pthread_spinlock {
+	__haiku_build_haiku_std_int32		lock;
+};
+
+
+#include <null.h>
+#include <size_t.h>
+#include <time.h>
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/types.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_TYPES_H */
diff --git a/headers/build/posix/sys/uio.h b/headers/build/posix/sys/uio.h
new file mode 100644
index 0000000..5a62d0f
--- /dev/null
+++ b/headers/build/posix/sys/uio.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_UIO_H
+#define _HAIKU_BUILD_SYS_UIO_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/uio.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_UIO_H */
diff --git a/headers/build/posix/sys/un.h b/headers/build/posix/sys/un.h
new file mode 100644
index 0000000..e174ed8
--- /dev/null
+++ b/headers/build/posix/sys/un.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_UN_H
+#define _HAIKU_BUILD_SYS_UN_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/un.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_UN_H */
diff --git a/headers/build/posix/sys/utsname.h b/headers/build/posix/sys/utsname.h
new file mode 100644
index 0000000..b44f3ab
--- /dev/null
+++ b/headers/build/posix/sys/utsname.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_UTSNAME_H
+#define _HAIKU_BUILD_SYS_UTSNAME_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/utsname.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_UTSNAME_H */
diff --git a/headers/build/posix/sys/wait.h b/headers/build/posix/sys/wait.h
new file mode 100644
index 0000000..e2dfc6d
--- /dev/null
+++ b/headers/build/posix/sys/wait.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYS_WAIT_H
+#define _HAIKU_BUILD_SYS_WAIT_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <sys/wait.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYS_WAIT_H */
diff --git a/headers/build/posix/syslog.h b/headers/build/posix/syslog.h
new file mode 100644
index 0000000..b071c7c
--- /dev/null
+++ b/headers/build/posix/syslog.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_SYSLOG_H
+#define _HAIKU_BUILD_SYSLOG_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <syslog.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_SYSLOG_H */
diff --git a/headers/build/posix/termios.h b/headers/build/posix/termios.h
new file mode 100644
index 0000000..c06fc8d
--- /dev/null
+++ b/headers/build/posix/termios.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_TERMIOS_H
+#define _HAIKU_BUILD_TERMIOS_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <termios.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_TERMIOS_H */
diff --git a/headers/build/posix/time.h b/headers/build/posix/time.h
new file mode 100644
index 0000000..57ace36
--- /dev/null
+++ b/headers/build/posix/time.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_TIME_H
+#define _HAIKU_BUILD_TIME_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <time.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_TIME_H */
diff --git a/headers/build/posix/unistd.h b/headers/build/posix/unistd.h
new file mode 100644
index 0000000..8f97986
--- /dev/null
+++ b/headers/build/posix/unistd.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_UNISTD_H
+#define _HAIKU_BUILD_UNISTD_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <unistd.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_UNISTD_H */
diff --git a/headers/build/posix/utime.h b/headers/build/posix/utime.h
new file mode 100644
index 0000000..a198496
--- /dev/null
+++ b/headers/build/posix/utime.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_UTIME_H
+#define _HAIKU_BUILD_UTIME_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <utime.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_UTIME_H */
diff --git a/headers/build/posix/wchar.h b/headers/build/posix/wchar.h
new file mode 100644
index 0000000..2c03351
--- /dev/null
+++ b/headers/build/posix/wchar.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_WCHAR_H
+#define _HAIKU_BUILD_WCHAR_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <wchar.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_WCHAR_H */
diff --git a/headers/build/posix/wchar_t.h b/headers/build/posix/wchar_t.h
new file mode 100644
index 0000000..ebd111d
--- /dev/null
+++ b/headers/build/posix/wchar_t.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_WCHAR_T_H
+#define _HAIKU_BUILD_WCHAR_T_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <wchar_t.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_WCHAR_T_H */
diff --git a/headers/build/posix/wctype.h b/headers/build/posix/wctype.h
new file mode 100644
index 0000000..200a60e
--- /dev/null
+++ b/headers/build/posix/wctype.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _HAIKU_BUILD_WCTYPE_H
+#define _HAIKU_BUILD_WCTYPE_H
+
+
+#ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER
+#	include_next <wctype.h>
+#endif
+
+
+#endif	/* _HAIKU_BUILD_WCTYPE_H */
diff --git a/src/build/Jamfile b/src/build/Jamfile
index 17634b0..3b7aa4c 100644
--- a/src/build/Jamfile
+++ b/src/build/Jamfile
@@ -1,5 +1,6 @@
 SubDir HAIKU_TOP src build ;
 
+SubInclude HAIKU_TOP src build configure ;
 SubInclude HAIKU_TOP src build libbe ;
 SubInclude HAIKU_TOP src build libhaikucompat ;
 SubInclude HAIKU_TOP src build libpackage ;
diff --git a/src/build/configure/Jamfile b/src/build/configure/Jamfile
new file mode 100644
index 0000000..ea888d5
--- /dev/null
+++ b/src/build/configure/Jamfile
@@ -0,0 +1,118 @@
+SubDir HAIKU_TOP src build configure ;
+
+HAIKU_BUILD_HOST_FEATURES = <build!configure>HostFeatures ;
+MakeLocate $(HAIKU_BUILD_HOST_FEATURES) : $(HAIKU_BUILD_OUTPUT_DIR) ;
+
+HAIKU_BUILD_CONFIG_HEADER = <build!configure>HaikuHostBuildConfig.h ;
+MakeLocate $(HAIKU_BUILD_CONFIG_HEADER) : $(HAIKU_BUILD_OUTPUT_DIR) ;
+
+local configureTargets ;
+
+rule ConfigureCheckExists feature : fileTarget
+{
+	local target = $(fileTarget:G=build!configure!test) ;
+
+	FEATURE on $(target) = $(feature) ;
+	NotFile $(target) ;
+	Depends $(target) : $(HAIKU_BUILD_CONFIG_HEADER) $(fileTarget) ;
+
+	ConfigureCheckExists1 $(target)
+		: $(HAIKU_BUILD_CONFIG_HEADER) $(fileTarget) ;
+
+	configureTargets += $(target) ;
+}
+
+
+actions ConfigureCheckExists1
+{
+	if [ -f "$(2[2-])" ]; then
+		echo "#define _HAIKU_BUILD_FEATURE_$(FEATURE) 1" >> $(2[1])
+#		echo $(FEATURE) >> $(2[1])
+	fi
+}
+
+
+rule ConfigureTestCompile feature : sources : libraries
+{
+	local executable = <build!configure>test_$(feature) ;
+
+	BuildPlatformMain $(executable) : $(sources) : $(libraries) ;
+	ConfigureCheckExists $(feature) : $(executable) ;
+}
+
+
+rule ConfigureCheckFunction function : code : headers : libraries
+{
+	local source = [ FGristFiles test_$(function).cpp ] ;
+	CODE on $(source) = $(code) ;
+	HEADERS on $(source) = $(headers) ;
+
+	MakeLocateCommonPlatform $(source) ;
+	ConfigureCheckFunction1 $(source) ;
+
+	ConfigureTestCompile $(function) : $(source) : $(libraries) ;
+}
+
+
+actions ConfigureCheckFunction1
+{
+	rm -f $(1)
+	for header in $(HEADERS); do
+		echo "#include <$header>" >> $(1)
+	done
+
+	cat << EOF >> $(1)
+		int main()
+		{
+			$(CODE)
+			return 0;
+		}
+	EOF
+}
+
+
+rule ConfigureRunProgram name : sources : libraries
+{
+	local program = $(name:G=build!configure) ;
+	local target = $(name:G=build!configure!test) ;
+
+	BuildPlatformMain $(program) : $(sources) : $(libraries) ;
+
+	ConfigureRunProgram1 ;
+
+	NotFile $(target) ;
+	Depends $(target) : $(HAIKU_BUILD_CONFIG_HEADER) $(program) ;
+
+	ConfigureRunProgram1 $(target) : $(HAIKU_BUILD_CONFIG_HEADER) $(program) ;
+
+	configureTargets += $(target) ;
+}
+
+
+actions ConfigureRunProgram1
+{
+	$(2[2-]) >> $(2[1])
+}
+
+
+ConfigureCheckFunction strnlen
+	: "(void)strnlen(\"test\", 4);"
+	: string.h ;
+
+ConfigureCheckFunction strlcpy
+	: "char buffer[10]; strlcpy(buffer, \"test\", sizeof(buffer));"
+	: string.h ;
+
+ConfigureCheckFunction stpcpy
+	: "char buffer[10]; stpcpy(buffer, \"test\");"
+	: string.h ;
+
+ConfigureCheckFunction strcasestr
+	: "(void)strcasestr(\"foo\", \"bar\");"
+	: string.h ;
+
+ConfigureRunProgram test_int_types : test_int_types.cpp ;
+
+
+Depends configure_build : $(configureTargets) ;
+NotFile configure_build ;
diff --git a/src/build/configure/test_int_types.cpp b/src/build/configure/test_int_types.cpp
new file mode 100644
index 0000000..6937c2b
--- /dev/null
+++ b/src/build/configure/test_int_types.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <inttypes.h>
+#include <stdio.h>
+
+
+template<typename Type>
+struct TypeInfo {
+	static const char* const TypeName();
+	static const char* const Prefix();
+};
+
+
+#define DEFINE_TYPE_INFO_TEMPLATE(type, prefix)	\
+	template<>									\
+	struct TypeInfo<type> {						\
+		static const char* const TypeName()		\
+		{										\
+			return #type;						\
+		}										\
+		static const char* const Prefix()		\
+		{										\
+			return prefix;						\
+		}										\
+	};
+
+#define DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(type, prefix)	\
+	DEFINE_TYPE_INFO_TEMPLATE(type, prefix)							\
+	DEFINE_TYPE_INFO_TEMPLATE(unsigned type, prefix)
+
+
+DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(char, "")
+DEFINE_TYPE_INFO_TEMPLATE(signed char, "")
+DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(short, "")
+DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(int, "")
+DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(long, "l")
+DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(long long, "ll")
+
+
+template<typename Type>
+struct PrintTypeInfo {
+	static void Print(const char* name)
+	{
+		printf("#define _HAIKU_BUILD_FEATURE_%s %s\n", name,
+			TypeInfo<Type>::TypeName());
+		printf("#define _HAIKU_BUILD_FEATURE_FORMAT_PREFIX_%s \"%s\"\n", name,
+			TypeInfo<Type>::Prefix());
+	}
+};
+
+
+#define PRINT_TYPE_INFO(type)	PrintTypeInfo<type##_t>::Print(#type)
+
+#define PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(type)	\
+	PRINT_TYPE_INFO(type);							\
+	PRINT_TYPE_INFO(u##type)
+
+
+int
+main()
+{
+	PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(int8);
+	PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(int16);
+	PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(int32);
+	PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(int64);
+	return 0;
+}
diff --git a/src/build/libroot/Jamfile b/src/build/libroot/Jamfile
index e1ebd9d..99430ce 100644
--- a/src/build/libroot/Jamfile
+++ b/src/build/libroot/Jamfile
@@ -1,16 +1,20 @@
 SubDir HAIKU_TOP src build libroot ;
 
-UseHeaders [ FDirName $(HAIKU_TOP) headers build ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) headers build os ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) headers build os app ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) headers build os drivers ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) headers build os kernel ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) headers build os interface ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) headers build os storage ] : true ;
-UseHeaders [ FDirName $(HAIKU_TOP) headers build os support ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build os ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build os app ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build os drivers ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build os kernel ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build os interface ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build os storage ] : true ;
+# UseHeaders [ FDirName $(HAIKU_TOP) headers build os support ] : true ;
+UseHeaders $(HOST_BE_API_HEADERS) : true ;
 
 UsePrivateBuildHeaders kernel system ;
 
+#DEFINES += _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER=1 ;
+
 {
 	local defines = [ FDefines
 		HAIKU_BUILD_ATTRIBUTES_DIR="\\\"$(HAIKU_BUILD_ATTRIBUTES_DIR)\\\""
@@ -30,19 +34,20 @@ UsePrivateBuildHeaders kernel system ;
 	defines = [ FDefines KMESSAGE_CONTAINER_ONLY=1 ] ;
 	ObjectC++Flags KMessage.cpp : $(defines) ;
 
+	defines = [ FDefines _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER=1 ] ;
+	ObjectC++Flags atomic.cpp : $(defines) ;
 }
 
 # locate the library
 MakeLocate libroot_build.so : $(HOST_BUILD_COMPATIBILITY_LIB_DIR) ;
 
-# darwin already has strlcpy and strlcat in libSystem
+# add string functions not provided by the host platform
 local strlSources ;
-if $(HOST_PLATFORM) != darwin {
-	strlSources = strlcpy.c strlcat.c ;
-}
-
-if $(HOST_PLATFORM) = cygwin || $(HOST_PLATFORM) = sunos {
-	strlSources += stpcpy.c strcasestr.c ;
+local function ;
+for function in strlcpy strlcat stpcpy strcasestr strnlen {
+	if $(HAIKU_HOST_FEATURE_$(function)) != 1 {
+		strlSources = $(function).c ;
+	}
 }
 
 local hostPlatformSources ;
@@ -53,7 +58,7 @@ if $(HOST_PLATFORM) = freebsd {
 local librootSources =
 	atomic.cpp
 	byteorder.cpp
-	errors.cpp
+#	errors.cpp
 	find_directory.cpp
 	fs.cpp
 	fs_attr.cpp
@@ -67,12 +72,11 @@ local librootSources =
 	driver_settings.cpp
 
 	$(strlSources)
-	strnlen.c
 
 	KMessage.cpp
 ;
 
-USES_BE_API on [ FGristFiles $(librootSources:S=$(SUFOBJ)) ] = true ;
+#USES_BE_API on [ FGristFiles $(librootSources:S=$(SUFOBJ)) ] = true ;
 
 BuildPlatformSharedLibrary libroot_build.so :
 	$(librootSources)
@@ -85,7 +89,7 @@ BuildPlatformStaticLibrary libroot_build.a :
 	[ FGristFiles $(librootSources:S=$(SUFOBJ)) ]
 ;
 
-USES_BE_API on [ FGristFiles function_remapper$(SUFOBJ) ] = true ;
+#USES_BE_API on [ FGristFiles function_remapper$(SUFOBJ) ] = true ;
 
 BuildPlatformStaticLibraryPIC libroot_build_function_remapper.a :
 	function_remapper.cpp
@@ -93,7 +97,7 @@ BuildPlatformStaticLibraryPIC libroot_build_function_remapper.a :
 
 SEARCH on [ FGristFiles driver_settings.cpp ]
 	= [ FDirName $(HAIKU_TOP) src system libroot os ] ;
-SEARCH on [ FGristFiles $(strlSources) strnlen.c ]
+SEARCH on [ FGristFiles $(strlSources) ]
 	= [ FDirName $(HAIKU_TOP) src system libroot posix string ] ;
 SEARCH on [ FGristFiles KMessage.cpp ]
     = [ FDirName $(HAIKU_TOP) src system kernel messaging ] ;
diff --git a/src/build/libroot/atomic.cpp b/src/build/libroot/atomic.cpp
index f7a7269..bbaef15 100644
--- a/src/build/libroot/atomic.cpp
+++ b/src/build/libroot/atomic.cpp
@@ -1,108 +1,109 @@
-#include <BeOSBuildCompatibility.h>
+//#include <BeOSBuildCompatibility.h>
 
-#include <string.h>
+//#include <string.h>
 
-#include <OS.h>
+//#include <OS.h>
 #include <SupportDefs.h>
 
 
-int32
-atomic_set(vint32 *value, int32 newValue)
+haiku_build_int32
+_haiku_build_atomic_set(haiku_build_vint32 *value, haiku_build_int32 newValue)
 {
-	int32 oldValue = *value;
+	haiku_build_int32 oldValue = *value;
 	*value = newValue;
 	return oldValue;
 }
 
 
-int32
-atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst)
+haiku_build_int32
+_haiku_build_atomic_test_and_set(haiku_build_vint32 *value,
+	haiku_build_int32 newValue, haiku_build_int32 testAgainst)
 {
-	int32 oldValue = *value;
+	haiku_build_int32 oldValue = *value;
 	if (oldValue == testAgainst)
 		*value = newValue;
 	return oldValue;
 }
 
 
-int32
-atomic_add(vint32 *value, int32 addValue)
+haiku_build_int32
+_haiku_build_atomic_add(haiku_build_vint32 *value, haiku_build_int32 addValue)
 {
-	int32 oldValue = *value;
+	haiku_build_int32 oldValue = *value;
 	*value += addValue;
 	return oldValue;
 }
 
 
-int32
-atomic_and(vint32 *value, int32 andValue)
+haiku_build_int32
+_haiku_build_atomic_and(haiku_build_vint32 *value, haiku_build_int32 andValue)
 {
-	int32 oldValue = *value;
+	haiku_build_int32 oldValue = *value;
 	*value &= andValue;
 	return oldValue;
 }
 
 
-int32
-atomic_or(vint32 *value, int32 orValue)	
+haiku_build_int32
+_haiku_build_atomic_or(haiku_build_vint32 *value, haiku_build_int32 orValue)	
 {
-	int32 oldValue = *value;
+	haiku_build_int32 oldValue = *value;
 	*value |= orValue;
 	return oldValue;
 }
 
 
-int32
-atomic_get(vint32 *value)
+haiku_build_int32
+_haiku_build_atomic_get(haiku_build_vint32 *value)
 {
 	return *value;
 }
 
 
-int64
-atomic_set64(vint64 *value, int64 newValue)
+haiku_build_int64
+_haiku_build_atomic_set64(haiku_build_vint64 *value, haiku_build_int64 newValue)
 {
-	int64 oldValue = *value;
+	haiku_build_int64 oldValue = *value;
 	*value = newValue;
 	return oldValue;
 }
 
-int64
-atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst)
+haiku_build_int64
+_haiku_build_atomic_test_and_set64(haiku_build_vint64 *value,
+	haiku_build_int64 newValue, haiku_build_int64 testAgainst)
 {
-	int64 oldValue = *value;
+	haiku_build_int64 oldValue = *value;
 	if (oldValue == testAgainst)
 		*value = newValue;
 	return oldValue;
 }
 
-int64
-atomic_add64(vint64 *value, int64 addValue)
+haiku_build_int64
+_haiku_build_atomic_add64(haiku_build_vint64 *value, haiku_build_int64 addValue)
 {
-	int64 oldValue = *value;
+	haiku_build_int64 oldValue = *value;
 	*value += addValue;
 	return oldValue;
 }
 
-int64
-atomic_and64(vint64 *value, int64 andValue)
+haiku_build_int64
+_haiku_build_atomic_and64(haiku_build_vint64 *value, haiku_build_int64 andValue)
 {
-	int64 oldValue = *value;
+	haiku_build_int64 oldValue = *value;
 	*value &= andValue;
 	return oldValue;
 }
 
-int64
-atomic_or64(vint64 *value, int64 orValue)
+haiku_build_int64
+_haiku_build_atomic_or64(haiku_build_vint64 *value, haiku_build_int64 orValue)
 {
-	int64 oldValue = *value;
+	haiku_build_int64 oldValue = *value;
 	*value |= orValue;
 	return oldValue;
 }
 
-int64
-atomic_get64(vint64 *value)
+haiku_build_int64
+_haiku_build_atomic_get64(haiku_build_vint64 *value)
 {
 	return *value;
 }
-
diff --git a/src/build/libroot/byteorder.cpp b/src/build/libroot/byteorder.cpp
index fdcbf32..536b203 100644
--- a/src/build/libroot/byteorder.cpp
+++ b/src/build/libroot/byteorder.cpp
@@ -1,28 +1,30 @@
 
-#ifdef BUILDING_FS_SHELL
-#	include "compat.h"
-#else
-#	include <BeOSBuildCompatibility.h>
-#endif
+//#ifdef BUILDING_FS_SHELL
+//#	include "compat.h"
+//#else
+//#	include <BeOSBuildCompatibility.h>
+//#endif
 
 #include <ByteOrder.h>
 
-uint16
-__swap_int16(uint16 value)
+haiku_build_uint16
+__haiku_build_swap_int16(haiku_build_uint16 value)
 {
 	return (value >> 8) | (value << 8);
 }
 
-uint32
-__swap_int32(uint32 value)
+haiku_build_uint32
+__haiku_build_swap_int32(haiku_build_uint32 value)
 {
 	return (value >> 24) | ((value & 0xff0000) >> 8) | ((value & 0xff00) << 8)
 		| (value << 24);
 }
 
-uint64
-__swap_int64(uint64 value)
+haiku_build_uint64
+__haiku_build_swap_int64(haiku_build_uint64 value)
 {
-	return uint64(__swap_int32(uint32(value >> 32)))
-		| (uint64(__swap_int32(uint32(value))) << 32);
+	return haiku_build_uint64(__haiku_build_swap_int32(haiku_build_uint32(
+			value >> 32)))
+		| (haiku_build_uint64(
+			__haiku_build_swap_int32(haiku_build_uint32(value))) << 32);
 }
diff --git a/src/build/libroot/fs.cpp b/src/build/libroot/fs.cpp
index 5de5bfa..9377765 100644
--- a/src/build/libroot/fs.cpp
+++ b/src/build/libroot/fs.cpp
@@ -4,7 +4,7 @@
  */
 
 
-#include <BeOSBuildCompatibility.h>
+//#include <BeOSBuildCompatibility.h>
 
 #include "fs_impl.h"
 
@@ -13,6 +13,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <utime.h>
 #include <sys/stat.h>
diff --git a/src/build/libroot/fs_attr_generic.cpp b/src/build/libroot/fs_attr_generic.cpp
index c43875b..3db1968 100644
--- a/src/build/libroot/fs_attr_generic.cpp
+++ b/src/build/libroot/fs_attr_generic.cpp
@@ -1,5 +1,5 @@
 
-#include <BeOSBuildCompatibility.h>
+//#include <BeOSBuildCompatibility.h>
 #include <syscalls.h>
 
 #include <dirent.h>
diff --git a/src/build/libroot/fs_attr_untyped.cpp b/src/build/libroot/fs_attr_untyped.cpp
index 02ea2af..e47b30c 100644
--- a/src/build/libroot/fs_attr_untyped.cpp
+++ b/src/build/libroot/fs_attr_untyped.cpp
@@ -17,7 +17,7 @@
 #	define B_ENTRY_NOT_FOUND	ENOENT
 #	define B_NO_MEMORY			ENOMEM
 #else
-#	include <BeOSBuildCompatibility.h>
+//#	include <BeOSBuildCompatibility.h>
 #	include <syscalls.h>
 
 #	include "fs_impl.h"
diff --git a/src/build/libroot/fs_descriptors.cpp b/src/build/libroot/fs_descriptors.cpp
index 68103e3..06ba480 100644
--- a/src/build/libroot/fs_descriptors.cpp
+++ b/src/build/libroot/fs_descriptors.cpp
@@ -9,7 +9,7 @@
 #	define B_OK			0
 #	define B_FILE_ERROR	EBADF
 #else
-#	include <BeOSBuildCompatibility.h>
+//#	include <BeOSBuildCompatibility.h>
 #endif
 
 #include "fs_descriptors.h"
diff --git a/src/build/libroot/misc.cpp b/src/build/libroot/misc.cpp
index 7fae5be..fbfccba 100644
--- a/src/build/libroot/misc.cpp
+++ b/src/build/libroot/misc.cpp
@@ -1,5 +1,5 @@
 
-#include <BeOSBuildCompatibility.h>
+//#include <BeOSBuildCompatibility.h>
 
 #include <errno.h>
 #include <stdio.h>
diff --git a/src/build/libroot/sem.cpp b/src/build/libroot/sem.cpp
index 0e2d0c9..1a9116b 100644
--- a/src/build/libroot/sem.cpp
+++ b/src/build/libroot/sem.cpp
@@ -1,5 +1,5 @@
 
-#include <BeOSBuildCompatibility.h>
+//#include <BeOSBuildCompatibility.h>
 
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/build/libroot/thread.cpp b/src/build/libroot/thread.cpp
index 7998694..438a541 100644
--- a/src/build/libroot/thread.cpp
+++ b/src/build/libroot/thread.cpp
@@ -1,5 +1,5 @@
 
-#include <BeOSBuildCompatibility.h>
+//#include <BeOSBuildCompatibility.h>
 
 #include <OS.h>
 
