[PATCH 2/3] sandbox: fix posix_types
Alexander Aring
alex.aring at googlemail.com
Tue Sep 11 01:30:44 EDT 2012
Fix setting of size_t ssize_t and ptrdiff_t for 32 bit and
64 bit systems.
Signed-off-by: Alexander Aring <alex.aring at gmail.com>
---
arch/sandbox/include/asm/posix_types.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/sandbox/include/asm/posix_types.h b/arch/sandbox/include/asm/posix_types.h
index 4345141..6985b8e 100644
--- a/arch/sandbox/include/asm/posix_types.h
+++ b/arch/sandbox/include/asm/posix_types.h
@@ -15,9 +15,23 @@ typedef int __kernel_pid_t;
typedef unsigned short __kernel_ipc_pid_t;
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
+/*
+ * Most 32 bit architectures use "unsigned int" size_t,
+ * and all 64 bit architectures use "unsigned long" size_t.
+ *
+ * TODO: It's not clean to use __x86_64__ here. It's better
+ * to check on __BITS_PER_LONG here. But this is wrong set in
+ * arch/sandbox/include/asm/types.h.
+ */
+#ifdef __x86_64__
typedef unsigned long __kernel_size_t;
typedef long __kernel_ssize_t;
+typedef long __kernel_ptrdiff_t;
+#else
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
+#endif
typedef long __kernel_time_t;
typedef long __kernel_suseconds_t;
typedef long __kernel_clock_t;
--
1.7.12
More information about the barebox
mailing list