summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@googlemail.com>2012-09-11 07:30:44 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-11 09:50:28 +0200
commit650ef3853994b49182d0ee64b445ef7866fabe86 (patch)
tree8b32ab18d62e1c5f5b0cba759556001704b3b1d2
parentaf516a9a35f4863f0405d22348802fd29b839975 (diff)
downloadbarebox-650ef3853994b49182d0ee64b445ef7866fabe86.tar.gz
barebox-650ef3853994b49182d0ee64b445ef7866fabe86.tar.xz
sandbox: fix posix_types
Fix setting of size_t ssize_t and ptrdiff_t for 32 bit and 64 bit systems. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/sandbox/include/asm/posix_types.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/sandbox/include/asm/posix_types.h b/arch/sandbox/include/asm/posix_types.h
index 4345141d29..6985b8eb4a 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;