From: Alexander Aring <alex.aring@googlemail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] sandbox: fix posix_types
Date: Tue, 11 Sep 2012 07:30:44 +0200 [thread overview]
Message-ID: <1347341445-2476-2-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1347341445-2476-1-git-send-email-alex.aring@gmail.com>
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>
---
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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-09-11 5:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-11 5:30 [PATCH 1/3] sandbox-unaligned: better usement of ifdef Alexander Aring
2012-09-11 5:30 ` Alexander Aring [this message]
2012-09-11 5:30 ` [PATCH 3/3] sandbox: add missed case statement Alexander Aring
2012-09-11 7:51 ` [PATCH 1/3] sandbox-unaligned: better usement of ifdef Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1347341445-2476-2-git-send-email-alex.aring@gmail.com \
--to=alex.aring@googlemail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox