This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 05/19] y2038: make linux/compat_time.h usable on 32-bit
- From: Arnd Bergmann <arnd at arndb dot de>
- To: y2038 at lists dot linaro dot org
- Cc: baolin dot wang at linaro dot org, tglx at linutronix dot de, albert dot aribaud at 3adev dot fr, john dot stultz at linaro dot org, bamvor dot zhangjian at linaro dot org, ruchandani dot tina at gmail dot com, linux-api at vger dot kernel dot org, linux-kernel at vger dot kernel dot org, libc-alpha at sourceware dot org, Arnd Bergmann <arnd at arndb dot de>
- Date: Wed, 6 May 2015 18:30:12 +0200
- Subject: [PATCH 05/19] y2038: make linux/compat_time.h usable on 32-bit
- Authentication-results: sourceware.org; auth=none
- References: <1430929826-318934-1-git-send-email-arnd at arndb dot de>
This adds the necessary type definitions to allow using the
linux/compat_time.h header file on 32-bit architectures without
adding an asm/compat.h header in each architecture.
The types we define here are used in the compat system call
definitions of some system calls that also pass a time_t
in another structure, but are themselves not depending on the
size of time_t.
This also adds a way to use COMPAT_SYSCALL_DEFINE() by
including the compat.h header file. Some code may need to
get reshuffled here.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/linux/compat.h | 6 ++++--
include/linux/compat_time.h | 24 ++++++++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 41b0dae6203b..fefc45094107 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -5,8 +5,6 @@
* syscall compatibility layer.
*/
-#ifdef CONFIG_COMPAT
-
#include <linux/stat.h>
#include <linux/param.h> /* for HZ */
#include <linux/sem.h>
@@ -17,7 +15,9 @@
#include <linux/unistd.h>
#include <linux/compat_time.h>
+#ifdef CONFIG_COMPAT
#include <asm/compat.h>
+#endif
#include <asm/siginfo.h>
#include <asm/signal.h>
@@ -52,6 +52,8 @@
} \
static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
+#ifdef CONFIG_COMPAT
+
#ifndef compat_user_stack_pointer
#define compat_user_stack_pointer() current_user_stack_pointer()
#endif
diff --git a/include/linux/compat_time.h b/include/linux/compat_time.h
index 37564582f6a5..e17375a91f76 100644
--- a/include/linux/compat_time.h
+++ b/include/linux/compat_time.h
@@ -78,6 +78,30 @@ struct compat_timex {
compat_int_t:32; compat_int_t:32; compat_int_t:32;
};
+#ifdef CONFIG_COMPAT
+#include <asm/compat.h>
+
+#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
+typedef struct {
+ compat_sigset_word sig[_COMPAT_NSIG_WORDS];
+} compat_sigset_t;
+
+#else
+
+#define compat_mmsghdr mmsghdr
+#define compat_stat stat
+#define compat_siginfo siginfo
+#define compat_sigevent sigevent
+#define compat_sigset_t sigset_t
+#define __compat_uid_t __kernel_uid_t
+#define __compat_gid_t __kernel_gid_t
+#define compat_mode_t __kernel_mode_t
+#define copy_siginfo_to_user32(uinfo, info) copy_siginfo_to_user(uinfo, info)
+static inline void __user *compat_ptr(compat_uptr_t ptr)
+{
+ return (void __user*)ptr;
+}
+#endif
/*
* These functions operate on 32- or 64-bit specs depending on
--
2.1.0.rc2