aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/compat.h')
-rw-r--r--include/linux/compat.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index e4920bd58a47..dec7e2d18875 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -23,6 +23,61 @@
23#define COMPAT_USE_64BIT_TIME 0 23#define COMPAT_USE_64BIT_TIME 0
24#endif 24#endif
25 25
26#ifndef __SC_DELOUSE
27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
28#endif
29
30#define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1)
31#define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__)
32#define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__)
33#define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__)
34#define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__)
35#define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__)
36#define COMPAT_SYSCALL_DEFINE1(name, ...) \
37 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
38#define COMPAT_SYSCALL_DEFINE2(name, ...) \
39 COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
40#define COMPAT_SYSCALL_DEFINE3(name, ...) \
41 COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
42#define COMPAT_SYSCALL_DEFINE4(name, ...) \
43 COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
44#define COMPAT_SYSCALL_DEFINE5(name, ...) \
45 COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
46#define COMPAT_SYSCALL_DEFINE6(name, ...) \
47 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
48
49#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
50
51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
52 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \
53 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \
54 asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \
55 { \
56 return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \
57 } \
58 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
59 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__))
60
61#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
62
63#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
64 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__))
65
66#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
67
68#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer()
70#endif
71#ifdef CONFIG_GENERIC_SIGALTSTACK
72#ifndef compat_sigaltstack /* we'll need that for MIPS */
73typedef struct compat_sigaltstack {
74 compat_uptr_t ss_sp;
75 int ss_flags;
76 compat_size_t ss_size;
77} compat_stack_t;
78#endif
79#endif
80
26#define compat_jiffies_to_clock_t(x) \ 81#define compat_jiffies_to_clock_t(x) \
27 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 82 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
28 83
@@ -587,6 +642,13 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
587 642
588asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 643asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
589 compat_off_t __user *offset, compat_size_t count); 644 compat_off_t __user *offset, compat_size_t count);
645#ifdef CONFIG_GENERIC_SIGALTSTACK
646asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
647 compat_stack_t __user *uoss_ptr);
648
649int compat_restore_altstack(const compat_stack_t __user *uss);
650int __compat_save_altstack(compat_stack_t __user *, unsigned long);
651#endif
590 652
591asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 653asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
592 struct compat_timespec __user *interval); 654 struct compat_timespec __user *interval);