aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compat.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/compat.h
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/linux/compat.h')
-rw-r--r--include/linux/compat.h126
1 files changed, 10 insertions, 116 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index dec7e2d1887..c6e7523bf76 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -19,65 +19,6 @@
19#include <asm/siginfo.h> 19#include <asm/siginfo.h>
20#include <asm/signal.h> 20#include <asm/signal.h>
21 21
22#ifndef COMPAT_USE_64BIT_TIME
23#define COMPAT_USE_64BIT_TIME 0
24#endif
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
81#define compat_jiffies_to_clock_t(x) \ 22#define compat_jiffies_to_clock_t(x) \
82 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 23 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
83 24
@@ -142,26 +83,10 @@ typedef struct {
142 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 83 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
143} compat_sigset_t; 84} compat_sigset_t;
144 85
145/*
146 * These functions operate strictly on struct compat_time*
147 */
148extern int get_compat_timespec(struct timespec *, 86extern int get_compat_timespec(struct timespec *,
149 const struct compat_timespec __user *); 87 const struct compat_timespec __user *);
150extern int put_compat_timespec(const struct timespec *, 88extern int put_compat_timespec(const struct timespec *,
151 struct compat_timespec __user *); 89 struct compat_timespec __user *);
152extern int get_compat_timeval(struct timeval *,
153 const struct compat_timeval __user *);
154extern int put_compat_timeval(const struct timeval *,
155 struct compat_timeval __user *);
156/*
157 * These functions operate on 32- or 64-bit specs depending on
158 * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the
159 * naming as compat_get/put_ rather than get/put_compat_.
160 */
161extern int compat_get_timespec(struct timespec *, const void __user *);
162extern int compat_put_timespec(const struct timespec *, void __user *);
163extern int compat_get_timeval(struct timeval *, const void __user *);
164extern int compat_put_timeval(const struct timeval *, void __user *);
165 90
166struct compat_iovec { 91struct compat_iovec {
167 compat_uptr_t iov_base; 92 compat_uptr_t iov_base;
@@ -215,6 +140,11 @@ struct compat_ustat {
215 char f_fpack[6]; 140 char f_fpack[6];
216}; 141};
217 142
143typedef union compat_sigval {
144 compat_int_t sival_int;
145 compat_uptr_t sival_ptr;
146} compat_sigval_t;
147
218#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3) 148#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
219 149
220typedef struct compat_sigevent { 150typedef struct compat_sigevent {
@@ -294,7 +224,6 @@ struct compat_sysinfo;
294struct compat_sysctl_args; 224struct compat_sysctl_args;
295struct compat_kexec_segment; 225struct compat_kexec_segment;
296struct compat_mq_attr; 226struct compat_mq_attr;
297struct compat_msgbuf;
298 227
299extern void compat_exit_robust_list(struct task_struct *curr); 228extern void compat_exit_robust_list(struct task_struct *curr);
300 229
@@ -305,22 +234,13 @@ asmlinkage long
305compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, 234compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
306 compat_size_t __user *len_ptr); 235 compat_size_t __user *len_ptr);
307 236
308#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
309long compat_sys_semctl(int first, int second, int third, void __user *uptr); 237long compat_sys_semctl(int first, int second, int third, void __user *uptr);
310long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); 238long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
311long compat_sys_msgrcv(int first, int second, int msgtyp, int third, 239long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
312 int version, void __user *uptr); 240 int version, void __user *uptr);
241long compat_sys_msgctl(int first, int second, void __user *uptr);
313long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, 242long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
314 void __user *uptr); 243 void __user *uptr);
315#else
316long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
317long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
318 compat_ssize_t msgsz, int msgflg);
319long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp,
320 compat_ssize_t msgsz, long msgtyp, int msgflg);
321long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
322#endif
323long compat_sys_msgctl(int first, int second, void __user *uptr);
324long compat_sys_shmctl(int first, int second, void __user *uptr); 244long compat_sys_shmctl(int first, int second, void __user *uptr);
325long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, 245long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
326 unsigned nsems, const struct compat_timespec __user *timeout); 246 unsigned nsems, const struct compat_timespec __user *timeout);
@@ -339,8 +259,8 @@ asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
339 const struct compat_iovec __user *vec, 259 const struct compat_iovec __user *vec,
340 unsigned long vlen, u32 pos_low, u32 pos_high); 260 unsigned long vlen, u32 pos_low, u32 pos_high);
341 261
342asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 262int compat_do_execve(char *filename, compat_uptr_t __user *argv,
343 const compat_uptr_t __user *envp); 263 compat_uptr_t __user *envp, struct pt_regs *regs);
344 264
345asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 265asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
346 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 266 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
@@ -502,9 +422,9 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
502asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, 422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
503 unsigned int nr_segs, unsigned int flags); 423 unsigned int nr_segs, unsigned int flags);
504asmlinkage long compat_sys_open(const char __user *filename, int flags, 424asmlinkage long compat_sys_open(const char __user *filename, int flags,
505 umode_t mode); 425 int mode);
506asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
507 int flags, umode_t mode); 427 int flags, int mode);
508asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
509 struct file_handle __user *handle, 429 struct file_handle __user *handle,
510 int flags); 430 int flags);
@@ -631,31 +551,5 @@ extern ssize_t compat_rw_copy_check_uvector(int type,
631 551
632extern void __user *compat_alloc_user_space(unsigned long len); 552extern void __user *compat_alloc_user_space(unsigned long len);
633 553
634asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
635 const struct compat_iovec __user *lvec,
636 unsigned long liovcnt, const struct compat_iovec __user *rvec,
637 unsigned long riovcnt, unsigned long flags);
638asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
639 const struct compat_iovec __user *lvec,
640 unsigned long liovcnt, const struct compat_iovec __user *rvec,
641 unsigned long riovcnt, unsigned long flags);
642
643asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
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
652
653asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
654 struct compat_timespec __user *interval);
655
656#else
657
658#define is_compat_task() (0)
659
660#endif /* CONFIG_COMPAT */ 554#endif /* CONFIG_COMPAT */
661#endif /* _LINUX_COMPAT_H */ 555#endif /* _LINUX_COMPAT_H */