This needs more cleanup
Signed-off-by: Arnd Bergmann <[email protected]>
---
include/linux/compat.h | 36 ++++++++++++++++++++++++++----------
include/linux/compat_time.h | 30 ++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 10 deletions(-)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 41b0dae6203b..f550ff00fd30 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,14 +15,6 @@
#include <linux/unistd.h>
#include <linux/compat_time.h>
-#include <asm/compat.h>
-#include <asm/siginfo.h>
-#include <asm/signal.h>
-
-#ifndef __SC_DELOUSE
-#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
-#endif
-
#define COMPAT_SYSCALL_DEFINE0(name) \
asmlinkage long compat_sys_##name(void)
@@ -41,6 +31,32 @@
#define COMPAT_SYSCALL_DEFINE6(name, ...) \
COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
+#ifndef __SC_DELOUSE
+#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
+#endif
+
+#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
+ asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\
+ __attribute__((alias(__stringify(compat_SyS##name)))); \
+ static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
+ asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\
+ asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
+ { \
+ return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
+ } \
+ static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
+
+extern void __user *compat_alloc_user_space(unsigned long len);
+
+#ifdef CONFIG_COMPAT
+#include <asm/compat.h>
+#include <asm/siginfo.h>
+#include <asm/signal.h>
+
+#ifndef __SC_DELOUSE
+#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
+#endif
+
#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\
__attribute__((alias(__stringify(compat_SyS##name)))); \
diff --git a/include/linux/compat_time.h b/include/linux/compat_time.h
index 37564582f6a5..b5ed064c601c 100644
--- a/include/linux/compat_time.h
+++ b/include/linux/compat_time.h
@@ -78,6 +78,36 @@ 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 compat_ipc_pid_t __kernel_ipc_pid_t
+#define compat_ipc64_perm ipc64_perm
+#define compat_semid64_ds semid64_ds
+#define compat_shmid64_ds shmid64_ds
+#define compat_msgid64_ds msgid64_ds
+#define compat_msqid64_ds msqid64_ds
+#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
_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038