blob: f2b8fe20cc8ead2e998799218b91536c72c373b4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_COMPAT_H
2#define _LINUX_COMPAT_H
3/*
4 * These are the type definitions for the architecture specific
5 * syscall compatibility layer.
6 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
8#ifdef CONFIG_COMPAT
9
10#include <linux/stat.h>
11#include <linux/param.h> /* for HZ */
12#include <linux/sem.h>
Arnd Bergmann2dceba12009-11-06 08:09:03 +000013#include <linux/socket.h>
14#include <linux/if.h>
Chris Metcalfbe84cb42011-05-09 13:12:30 -040015#include <linux/fs.h>
Stephen Rothwell45e96832011-05-24 13:28:54 +100016#include <linux/aio_abi.h> /* for aio_context_t */
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18#include <asm/compat.h>
19#include <asm/siginfo.h>
David Howells3f2e05e2006-10-02 14:12:31 +010020#include <asm/signal.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
H. J. Lu45e87782012-02-10 14:04:27 -080022#ifndef COMPAT_USE_64BIT_TIME
23#define COMPAT_USE_64BIT_TIME 0
24#endif
25
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#define compat_jiffies_to_clock_t(x) \
27 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
28
Stephen Rothwell202e5972005-09-06 15:16:40 -070029typedef __compat_uid32_t compat_uid_t;
30typedef __compat_gid32_t compat_gid_t;
31
Christoph Hellwig5d0e5282010-03-10 15:21:13 -080032struct compat_sel_arg_struct;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033struct rusage;
34
Chris Metcalf4800a5b2011-05-17 14:41:06 -040035struct compat_itimerspec {
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 struct compat_timespec it_interval;
37 struct compat_timespec it_value;
38};
39
40struct compat_utimbuf {
41 compat_time_t actime;
42 compat_time_t modtime;
43};
44
45struct compat_itimerval {
46 struct compat_timeval it_interval;
47 struct compat_timeval it_value;
48};
49
50struct compat_tms {
51 compat_clock_t tms_utime;
52 compat_clock_t tms_stime;
53 compat_clock_t tms_cutime;
54 compat_clock_t tms_cstime;
55};
56
Stephen Rothwell88959ea2006-03-26 01:37:27 -080057struct compat_timex {
58 compat_uint_t modes;
59 compat_long_t offset;
60 compat_long_t freq;
61 compat_long_t maxerror;
62 compat_long_t esterror;
63 compat_int_t status;
64 compat_long_t constant;
65 compat_long_t precision;
66 compat_long_t tolerance;
67 struct compat_timeval time;
68 compat_long_t tick;
69 compat_long_t ppsfreq;
70 compat_long_t jitter;
71 compat_int_t shift;
72 compat_long_t stabil;
73 compat_long_t jitcnt;
74 compat_long_t calcnt;
75 compat_long_t errcnt;
76 compat_long_t stbcnt;
Roman Zippel153b5d02008-05-01 04:34:37 -070077 compat_int_t tai;
Stephen Rothwell88959ea2006-03-26 01:37:27 -080078
Chris Metcalf4800a5b2011-05-17 14:41:06 -040079 compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32;
80 compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32;
81 compat_int_t:32; compat_int_t:32; compat_int_t:32;
Stephen Rothwell88959ea2006-03-26 01:37:27 -080082};
83
Linus Torvalds1da177e2005-04-16 15:20:36 -070084#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
85
86typedef struct {
87 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
88} compat_sigset_t;
89
H. Peter Anvin6684ba22012-02-19 17:38:00 -080090/*
91 * These functions operate strictly on struct compat_time*
92 */
Chris Metcalf4800a5b2011-05-17 14:41:06 -040093extern int get_compat_timespec(struct timespec *,
94 const struct compat_timespec __user *);
95extern int put_compat_timespec(const struct timespec *,
96 struct compat_timespec __user *);
H. Peter Anvin6684ba22012-02-19 17:38:00 -080097extern int get_compat_timeval(struct timeval *,
98 const struct compat_timeval __user *);
99extern int put_compat_timeval(const struct timeval *,
100 struct compat_timeval __user *);
101/*
102 * These functions operate on 32- or 64-bit specs depending on
103 * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the
104 * naming as compat_get/put_ rather than get/put_compat_.
105 */
106extern int compat_get_timespec(struct timespec *, const void __user *);
107extern int compat_put_timespec(const struct timespec *, void __user *);
108extern int compat_get_timeval(struct timeval *, const void __user *);
109extern int compat_put_timeval(const struct timeval *, void __user *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110
111struct compat_iovec {
112 compat_uptr_t iov_base;
113 compat_size_t iov_len;
114};
115
116struct compat_rlimit {
117 compat_ulong_t rlim_cur;
118 compat_ulong_t rlim_max;
119};
120
121struct compat_rusage {
122 struct compat_timeval ru_utime;
123 struct compat_timeval ru_stime;
124 compat_long_t ru_maxrss;
125 compat_long_t ru_ixrss;
126 compat_long_t ru_idrss;
127 compat_long_t ru_isrss;
128 compat_long_t ru_minflt;
129 compat_long_t ru_majflt;
130 compat_long_t ru_nswap;
131 compat_long_t ru_inblock;
132 compat_long_t ru_oublock;
133 compat_long_t ru_msgsnd;
134 compat_long_t ru_msgrcv;
135 compat_long_t ru_nsignals;
136 compat_long_t ru_nvcsw;
137 compat_long_t ru_nivcsw;
138};
139
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400140extern int put_compat_rusage(const struct rusage *,
141 struct compat_rusage __user *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142
143struct compat_siginfo;
144
145extern asmlinkage long compat_sys_waitid(int, compat_pid_t,
146 struct compat_siginfo __user *, int,
147 struct compat_rusage __user *);
148
149struct compat_dirent {
150 u32 d_ino;
151 compat_off_t d_off;
152 u16 d_reclen;
153 char d_name[256];
154};
155
Christoph Hellwig2b1c6bd2008-11-28 10:09:09 +0100156struct compat_ustat {
157 compat_daddr_t f_tfree;
158 compat_ino_t f_tinode;
159 char f_fname[6];
160 char f_fpack[6];
161};
162
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163typedef union compat_sigval {
164 compat_int_t sival_int;
165 compat_uptr_t sival_ptr;
166} compat_sigval_t;
167
168#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
169
170typedef struct compat_sigevent {
171 compat_sigval_t sigev_value;
172 compat_int_t sigev_signo;
173 compat_int_t sigev_notify;
174 union {
175 compat_int_t _pad[COMPAT_SIGEV_PAD_SIZE];
176 compat_int_t _tid;
177
178 struct {
179 compat_uptr_t _function;
180 compat_uptr_t _attribute;
181 } _sigev_thread;
182 } _sigev_un;
183} compat_sigevent_t;
184
Arnd Bergmann2dceba12009-11-06 08:09:03 +0000185struct compat_ifmap {
186 compat_ulong_t mem_start;
187 compat_ulong_t mem_end;
188 unsigned short base_addr;
189 unsigned char irq;
190 unsigned char dma;
191 unsigned char port;
192};
193
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400194struct compat_if_settings {
Arnd Bergmann7a50a242009-11-08 20:57:03 -0800195 unsigned int type; /* Type of physical device or protocol */
196 unsigned int size; /* Size of the data allocated by the caller */
197 compat_uptr_t ifs_ifsu; /* union of pointers */
198};
199
Arnd Bergmann2dceba12009-11-06 08:09:03 +0000200struct compat_ifreq {
Arnd Bergmann7a50a242009-11-08 20:57:03 -0800201 union {
202 char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
203 } ifr_ifrn;
204 union {
205 struct sockaddr ifru_addr;
206 struct sockaddr ifru_dstaddr;
207 struct sockaddr ifru_broadaddr;
208 struct sockaddr ifru_netmask;
209 struct sockaddr ifru_hwaddr;
210 short ifru_flags;
211 compat_int_t ifru_ivalue;
212 compat_int_t ifru_mtu;
213 struct compat_ifmap ifru_map;
214 char ifru_slave[IFNAMSIZ]; /* Just fits the size */
Arnd Bergmann2dceba12009-11-06 08:09:03 +0000215 char ifru_newname[IFNAMSIZ];
Arnd Bergmann7a50a242009-11-08 20:57:03 -0800216 compat_caddr_t ifru_data;
217 struct compat_if_settings ifru_settings;
218 } ifr_ifru;
Arnd Bergmann2dceba12009-11-06 08:09:03 +0000219};
220
221struct compat_ifconf {
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400222 compat_int_t ifc_len; /* size of buffer */
223 compat_caddr_t ifcbuf;
Arnd Bergmann2dceba12009-11-06 08:09:03 +0000224};
225
Ingo Molnar34f192c2006-03-27 01:16:24 -0800226struct compat_robust_list {
227 compat_uptr_t next;
228};
229
230struct compat_robust_list_head {
231 struct compat_robust_list list;
232 compat_long_t futex_offset;
233 compat_uptr_t list_op_pending;
234};
235
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400236struct compat_statfs;
237struct compat_statfs64;
238struct compat_old_linux_dirent;
239struct compat_linux_dirent;
240struct linux_dirent64;
241struct compat_msghdr;
242struct compat_mmsghdr;
243struct compat_sysinfo;
244struct compat_sysctl_args;
245struct compat_kexec_segment;
246struct compat_mq_attr;
Chris Metcalf48b25c42012-03-15 13:13:38 -0400247struct compat_msgbuf;
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400248
Ingo Molnar34f192c2006-03-27 01:16:24 -0800249extern void compat_exit_robust_list(struct task_struct *curr);
250
251asmlinkage long
252compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
253 compat_size_t len);
254asmlinkage long
Al Viroba46df92006-10-10 22:46:07 +0100255compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
Ingo Molnar34f192c2006-03-27 01:16:24 -0800256 compat_size_t __user *len_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257
Chris Metcalf48b25c42012-03-15 13:13:38 -0400258#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
Will Deaconb610c042012-07-30 14:42:40 -0700259#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260long compat_sys_semctl(int first, int second, int third, void __user *uptr);
261long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
262long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
263 int version, void __user *uptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
265 void __user *uptr);
Chris Metcalf48b25c42012-03-15 13:13:38 -0400266#else
267long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
268long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
Will Deacon05ba3f12012-07-30 14:42:43 -0700269 compat_ssize_t msgsz, int msgflg);
Chris Metcalf48b25c42012-03-15 13:13:38 -0400270long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp,
Will Deacon05ba3f12012-07-30 14:42:43 -0700271 compat_ssize_t msgsz, long msgtyp, int msgflg);
Chris Metcalf48b25c42012-03-15 13:13:38 -0400272long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
273#endif
274long compat_sys_msgctl(int first, int second, void __user *uptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275long compat_sys_shmctl(int first, int second, void __user *uptr);
276long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
277 unsigned nsems, const struct compat_timespec __user *timeout);
278asmlinkage long compat_sys_keyctl(u32 option,
279 u32 arg2, u32 arg3, u32 arg4, u32 arg5);
Christoph Hellwig2b1c6bd2008-11-28 10:09:09 +0100280asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281
282asmlinkage ssize_t compat_sys_readv(unsigned long fd,
283 const struct compat_iovec __user *vec, unsigned long vlen);
284asmlinkage ssize_t compat_sys_writev(unsigned long fd,
285 const struct compat_iovec __user *vec, unsigned long vlen);
Gerd Hoffmannf3554f42009-04-02 16:59:23 -0700286asmlinkage ssize_t compat_sys_preadv(unsigned long fd,
287 const struct compat_iovec __user *vec,
Linus Torvalds601cc112009-04-03 08:03:22 -0700288 unsigned long vlen, u32 pos_low, u32 pos_high);
Gerd Hoffmannf3554f42009-04-02 16:59:23 -0700289asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
290 const struct compat_iovec __user *vec,
Linus Torvalds601cc112009-04-03 08:03:22 -0700291 unsigned long vlen, u32 pos_low, u32 pos_high);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400293int compat_do_execve(char *filename, compat_uptr_t __user *argv,
294 compat_uptr_t __user *envp, struct pt_regs *regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295
296asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
297 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
298 struct compat_timeval __user *tvp);
299
Christoph Hellwig5d0e5282010-03-10 15:21:13 -0800300asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg);
301
Thomas Gleixnerc202f292008-01-30 13:30:08 +0100302asmlinkage long compat_sys_wait4(compat_pid_t pid,
Al Viro7d61c452008-03-29 03:09:28 +0000303 compat_uint_t __user *stat_addr, int options,
304 struct compat_rusage __user *ru);
Thomas Gleixnerc202f292008-01-30 13:30:08 +0100305
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
307
308#define BITS_TO_COMPAT_LONGS(bits) \
309 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
310
Stephen Rothwell5fa38392006-10-28 10:38:46 -0700311long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 unsigned long bitmap_size);
313long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
314 unsigned long bitmap_size);
315int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
316int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
317int get_compat_sigevent(struct sigevent *event,
318 const struct compat_sigevent __user *u_event);
Thomas Gleixner62ab4502009-04-04 21:01:06 +0000319long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
320 struct compat_siginfo __user *uinfo);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321
Andrew Morton643a6542006-02-11 17:55:52 -0800322static inline int compat_timeval_compare(struct compat_timeval *lhs,
323 struct compat_timeval *rhs)
324{
325 if (lhs->tv_sec < rhs->tv_sec)
326 return -1;
327 if (lhs->tv_sec > rhs->tv_sec)
328 return 1;
329 return lhs->tv_usec - rhs->tv_usec;
330}
331
332static inline int compat_timespec_compare(struct compat_timespec *lhs,
333 struct compat_timespec *rhs)
334{
335 if (lhs->tv_sec < rhs->tv_sec)
336 return -1;
337 if (lhs->tv_sec > rhs->tv_sec)
338 return 1;
339 return lhs->tv_nsec - rhs->tv_nsec;
340}
341
Davide Libenzi83f5d122007-05-10 22:23:18 -0700342extern int get_compat_itimerspec(struct itimerspec *dst,
343 const struct compat_itimerspec __user *src);
344extern int put_compat_itimerspec(struct compat_itimerspec __user *dst,
345 const struct itimerspec *src);
346
Christoph Hellwigb418da12008-10-15 22:02:06 -0700347asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
348 struct timezone __user *tz);
349asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
350 struct timezone __user *tz);
351
Stephen Rothwell3158e942006-03-26 01:37:29 -0800352asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
353
Andi Kleenbebfa102006-06-26 13:56:52 +0200354extern int compat_printk(const char *fmt, ...);
Linus Torvalds02354972006-10-02 14:05:20 -0700355extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
Andi Kleenbebfa102006-06-26 13:56:52 +0200356
Stephen Rothwell3fd59392006-11-02 22:07:24 -0800357asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
358 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
359 const compat_ulong_t __user *new_nodes);
360
Roland McGrath032d82d2008-01-30 13:31:47 +0100361extern int compat_ptrace_request(struct task_struct *child,
362 compat_long_t request,
363 compat_ulong_t addr, compat_ulong_t data);
364
Roland McGrathc269f192008-01-30 13:31:48 +0100365extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
366 compat_ulong_t addr, compat_ulong_t data);
367asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
368 compat_long_t addr, compat_long_t data);
Roland McGrathc269f192008-01-30 13:31:48 +0100369
Davide Libenzif6dfb4f2007-03-07 20:41:21 -0800370/*
371 * epoll (fs/eventpoll.c) compat bits follow ...
372 */
Davide Libenzif6dfb4f2007-03-07 20:41:21 -0800373struct epoll_event;
374#define compat_epoll_event epoll_event
Davide Libenzif6dfb4f2007-03-07 20:41:21 -0800375asmlinkage long compat_sys_epoll_pwait(int epfd,
376 struct compat_epoll_event __user *events,
377 int maxevents, int timeout,
378 const compat_sigset_t __user *sigmask,
379 compat_size_t sigsetsize);
380
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400381asmlinkage long compat_sys_utime(const char __user *filename,
382 struct compat_utimbuf __user *t);
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400383asmlinkage long compat_sys_utimensat(unsigned int dfd,
384 const char __user *filename,
385 struct compat_timespec __user *t,
386 int flags);
Stephen Rothwell97416ce2007-05-09 02:32:35 -0700387
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400388asmlinkage long compat_sys_time(compat_time_t __user *tloc);
389asmlinkage long compat_sys_stime(compat_time_t __user *tptr);
Stephen Rothwell140ff8b2007-05-14 13:47:47 +1000390asmlinkage long compat_sys_signalfd(int ufd,
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400391 const compat_sigset_t __user *sigmask,
392 compat_size_t sigsetsize);
Davide Libenzi4d672e72008-02-04 22:27:26 -0800393asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
394 const struct compat_itimerspec __user *utmr,
395 struct compat_itimerspec __user *otmr);
396asmlinkage long compat_sys_timerfd_gettime(int ufd,
397 struct compat_itimerspec __user *otmr);
Stephen Rothwell140ff8b2007-05-14 13:47:47 +1000398
Heiko Carstens4c696ba2009-01-14 14:13:53 +0100399asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
400 __u32 __user *pages,
401 const int __user *nodes,
402 int __user *status,
403 int flags);
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400404asmlinkage long compat_sys_futimesat(unsigned int dfd,
405 const char __user *filename,
Heiko Carstens4c696ba2009-01-14 14:13:53 +0100406 struct compat_timeval __user *t);
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400407asmlinkage long compat_sys_utimes(const char __user *filename,
408 struct compat_timeval __user *t);
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400409asmlinkage long compat_sys_newstat(const char __user *filename,
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400410 struct compat_stat __user *statbuf);
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400411asmlinkage long compat_sys_newlstat(const char __user *filename,
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400412 struct compat_stat __user *statbuf);
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400413asmlinkage long compat_sys_newfstatat(unsigned int dfd,
414 const char __user *filename,
Heiko Carstens4c696ba2009-01-14 14:13:53 +0100415 struct compat_stat __user *statbuf,
416 int flag);
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400417asmlinkage long compat_sys_newfstat(unsigned int fd,
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400418 struct compat_stat __user *statbuf);
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400419asmlinkage long compat_sys_statfs(const char __user *pathname,
420 struct compat_statfs __user *buf);
421asmlinkage long compat_sys_fstatfs(unsigned int fd,
422 struct compat_statfs __user *buf);
423asmlinkage long compat_sys_statfs64(const char __user *pathname,
424 compat_size_t sz,
425 struct compat_statfs64 __user *buf);
426asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
427 struct compat_statfs64 __user *buf);
428asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
429 unsigned long arg);
430asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd,
431 unsigned long arg);
432asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p);
433asmlinkage long compat_sys_io_getevents(aio_context_t ctx_id,
434 unsigned long min_nr,
435 unsigned long nr,
436 struct io_event __user *events,
437 struct compat_timespec __user *timeout);
438asmlinkage long compat_sys_io_submit(aio_context_t ctx_id, int nr,
439 u32 __user *iocb);
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400440asmlinkage long compat_sys_mount(const char __user *dev_name,
441 const char __user *dir_name,
442 const char __user *type, unsigned long flags,
443 const void __user *data);
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400444asmlinkage long compat_sys_old_readdir(unsigned int fd,
445 struct compat_old_linux_dirent __user *,
446 unsigned int count);
447asmlinkage long compat_sys_getdents(unsigned int fd,
448 struct compat_linux_dirent __user *dirent,
449 unsigned int count);
450asmlinkage long compat_sys_getdents64(unsigned int fd,
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400451 struct linux_dirent64 __user *dirent,
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400452 unsigned int count);
453asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
454 unsigned int nr_segs, unsigned int flags);
455asmlinkage long compat_sys_open(const char __user *filename, int flags,
Al Viroa218d0f2011-11-21 14:59:34 -0500456 umode_t mode);
Heiko Carstens4c696ba2009-01-14 14:13:53 +0100457asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
Al Viroa218d0f2011-11-21 14:59:34 -0500458 int flags, umode_t mode);
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400459asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
460 struct file_handle __user *handle,
461 int flags);
462asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
463 compat_ulong_t __user *outp,
464 compat_ulong_t __user *exp,
465 struct compat_timespec __user *tsp,
466 void __user *sig);
467asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
468 unsigned int nfds,
469 struct compat_timespec __user *tsp,
470 const compat_sigset_t __user *sigmask,
471 compat_size_t sigsetsize);
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400472asmlinkage long compat_sys_signalfd4(int ufd,
473 const compat_sigset_t __user *sigmask,
474 compat_size_t sigsetsize, int flags);
475asmlinkage long compat_sys_get_mempolicy(int __user *policy,
476 compat_ulong_t __user *nmask,
477 compat_ulong_t maxnode,
478 compat_ulong_t addr,
479 compat_ulong_t flags);
480asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
481 compat_ulong_t maxnode);
482asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len,
483 compat_ulong_t mode,
484 compat_ulong_t __user *nmask,
485 compat_ulong_t maxnode, compat_ulong_t flags);
486
487asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
488 char __user *optval, unsigned int optlen);
489asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg,
490 unsigned flags);
Chris Metcalf507c5f12011-06-27 16:18:07 -0700491asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
492 unsigned vlen, unsigned int flags);
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400493asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg,
494 unsigned int flags);
495asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len,
496 unsigned flags);
497asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len,
498 unsigned flags, struct sockaddr __user *addr,
499 int __user *addrlen);
500asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
501 unsigned vlen, unsigned int flags,
502 struct compat_timespec __user *timeout);
503asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
504 struct compat_timespec __user *rmtp);
505asmlinkage long compat_sys_getitimer(int which,
506 struct compat_itimerval __user *it);
507asmlinkage long compat_sys_setitimer(int which,
508 struct compat_itimerval __user *in,
509 struct compat_itimerval __user *out);
510asmlinkage long compat_sys_times(struct compat_tms __user *tbuf);
511asmlinkage long compat_sys_setrlimit(unsigned int resource,
512 struct compat_rlimit __user *rlim);
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400513asmlinkage long compat_sys_getrlimit(unsigned int resource,
514 struct compat_rlimit __user *rlim);
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400515asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru);
516asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
517 unsigned int len,
518 compat_ulong_t __user *user_mask_ptr);
519asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid,
520 unsigned int len,
521 compat_ulong_t __user *user_mask_ptr);
522asmlinkage long compat_sys_timer_create(clockid_t which_clock,
523 struct compat_sigevent __user *timer_event_spec,
524 timer_t __user *created_timer_id);
525asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags,
526 struct compat_itimerspec __user *new,
527 struct compat_itimerspec __user *old);
528asmlinkage long compat_sys_timer_gettime(timer_t timer_id,
529 struct compat_itimerspec __user *setting);
530asmlinkage long compat_sys_clock_settime(clockid_t which_clock,
531 struct compat_timespec __user *tp);
532asmlinkage long compat_sys_clock_gettime(clockid_t which_clock,
533 struct compat_timespec __user *tp);
534asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock,
535 struct compat_timex __user *tp);
536asmlinkage long compat_sys_clock_getres(clockid_t which_clock,
537 struct compat_timespec __user *tp);
538asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
539 struct compat_timespec __user *rqtp,
540 struct compat_timespec __user *rmtp);
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400541asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
Chris Metcalfbe84cb42011-05-09 13:12:30 -0400542 struct compat_siginfo __user *uinfo,
543 struct compat_timespec __user *uts, compat_size_t sigsetsize);
544asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset,
545 compat_size_t sigsetsize);
546asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
547asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
548 unsigned long arg);
549asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
550 struct compat_timespec __user *utime, u32 __user *uaddr2,
551 u32 val3);
552asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
553 char __user *optval, int __user *optlen);
554asmlinkage long compat_sys_kexec_load(unsigned long entry,
555 unsigned long nr_segments,
556 struct compat_kexec_segment __user *,
557 unsigned long flags);
558asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
559 const struct compat_mq_attr __user *u_mqstat,
560 struct compat_mq_attr __user *u_omqstat);
561asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
562 const struct compat_sigevent __user *u_notification);
563asmlinkage long compat_sys_mq_open(const char __user *u_name,
564 int oflag, compat_mode_t mode,
565 struct compat_mq_attr __user *u_attr);
566asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes,
567 const char __user *u_msg_ptr,
568 size_t msg_len, unsigned int msg_prio,
569 const struct compat_timespec __user *u_abs_timeout);
570asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
571 char __user *u_msg_ptr,
572 size_t msg_len, unsigned int __user *u_msg_prio,
573 const struct compat_timespec __user *u_abs_timeout);
574asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
575asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args);
Heiko Carstens4c696ba2009-01-14 14:13:53 +0100576
Jeff Moyerb8373362010-05-26 14:44:25 -0700577extern ssize_t compat_rw_copy_check_uvector(int type,
Chris Metcalf4800a5b2011-05-17 14:41:06 -0400578 const struct compat_iovec __user *uvector,
579 unsigned long nr_segs,
Jeff Moyerb8373362010-05-26 14:44:25 -0700580 unsigned long fast_segs, struct iovec *fast_pointer,
Christopher Yeohac34ebb2012-05-31 16:26:42 -0700581 struct iovec **ret_pointer);
H. Peter Anvinc41d68a2010-09-07 16:16:18 -0700582
583extern void __user *compat_alloc_user_space(unsigned long len);
584
Chris Metcalfa67ba432011-12-01 12:54:31 -0500585asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
586 const struct compat_iovec __user *lvec,
587 unsigned long liovcnt, const struct compat_iovec __user *rvec,
588 unsigned long riovcnt, unsigned long flags);
589asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
590 const struct compat_iovec __user *lvec,
591 unsigned long liovcnt, const struct compat_iovec __user *rvec,
592 unsigned long riovcnt, unsigned long flags);
593
Linus Torvalds3c761ea2012-02-26 09:44:55 -0800594#else
595
596#define is_compat_task() (0)
597
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598#endif /* CONFIG_COMPAT */
599#endif /* _LINUX_COMPAT_H */