Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | |
| 8 | #ifdef CONFIG_COMPAT |
| 9 | |
| 10 | #include <linux/stat.h> |
| 11 | #include <linux/param.h> /* for HZ */ |
| 12 | #include <linux/sem.h> |
Arnd Bergmann | 2dceba1 | 2009-11-06 08:09:03 +0000 | [diff] [blame] | 13 | #include <linux/socket.h> |
| 14 | #include <linux/if.h> |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 15 | #include <linux/fs.h> |
Stephen Rothwell | 45e9683 | 2011-05-24 13:28:54 +1000 | [diff] [blame] | 16 | #include <linux/aio_abi.h> /* for aio_context_t */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
| 18 | #include <asm/compat.h> |
| 19 | #include <asm/siginfo.h> |
David Howells | 3f2e05e | 2006-10-02 14:12:31 +0100 | [diff] [blame] | 20 | #include <asm/signal.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
H. J. Lu | 45e8778 | 2012-02-10 14:04:27 -0800 | [diff] [blame] | 22 | #ifndef COMPAT_USE_64BIT_TIME |
| 23 | #define COMPAT_USE_64BIT_TIME 0 |
| 24 | #endif |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #define compat_jiffies_to_clock_t(x) \ |
| 27 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) |
| 28 | |
Stephen Rothwell | 202e597 | 2005-09-06 15:16:40 -0700 | [diff] [blame] | 29 | typedef __compat_uid32_t compat_uid_t; |
| 30 | typedef __compat_gid32_t compat_gid_t; |
| 31 | |
Christoph Hellwig | 5d0e528 | 2010-03-10 15:21:13 -0800 | [diff] [blame] | 32 | struct compat_sel_arg_struct; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | struct rusage; |
| 34 | |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 35 | struct compat_itimerspec { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | struct compat_timespec it_interval; |
| 37 | struct compat_timespec it_value; |
| 38 | }; |
| 39 | |
| 40 | struct compat_utimbuf { |
| 41 | compat_time_t actime; |
| 42 | compat_time_t modtime; |
| 43 | }; |
| 44 | |
| 45 | struct compat_itimerval { |
| 46 | struct compat_timeval it_interval; |
| 47 | struct compat_timeval it_value; |
| 48 | }; |
| 49 | |
| 50 | struct 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 Rothwell | 88959ea | 2006-03-26 01:37:27 -0800 | [diff] [blame] | 57 | struct 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 Zippel | 153b5d0 | 2008-05-01 04:34:37 -0700 | [diff] [blame] | 77 | compat_int_t tai; |
Stephen Rothwell | 88959ea | 2006-03-26 01:37:27 -0800 | [diff] [blame] | 78 | |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 79 | 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 Rothwell | 88959ea | 2006-03-26 01:37:27 -0800 | [diff] [blame] | 82 | }; |
| 83 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) |
| 85 | |
| 86 | typedef struct { |
| 87 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; |
| 88 | } compat_sigset_t; |
| 89 | |
H. Peter Anvin | 6684ba2 | 2012-02-19 17:38:00 -0800 | [diff] [blame] | 90 | /* |
| 91 | * These functions operate strictly on struct compat_time* |
| 92 | */ |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 93 | extern int get_compat_timespec(struct timespec *, |
| 94 | const struct compat_timespec __user *); |
| 95 | extern int put_compat_timespec(const struct timespec *, |
| 96 | struct compat_timespec __user *); |
H. Peter Anvin | 6684ba2 | 2012-02-19 17:38:00 -0800 | [diff] [blame] | 97 | extern int get_compat_timeval(struct timeval *, |
| 98 | const struct compat_timeval __user *); |
| 99 | extern 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 | */ |
| 106 | extern int compat_get_timespec(struct timespec *, const void __user *); |
| 107 | extern int compat_put_timespec(const struct timespec *, void __user *); |
| 108 | extern int compat_get_timeval(struct timeval *, const void __user *); |
| 109 | extern int compat_put_timeval(const struct timeval *, void __user *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
| 111 | struct compat_iovec { |
| 112 | compat_uptr_t iov_base; |
| 113 | compat_size_t iov_len; |
| 114 | }; |
| 115 | |
| 116 | struct compat_rlimit { |
| 117 | compat_ulong_t rlim_cur; |
| 118 | compat_ulong_t rlim_max; |
| 119 | }; |
| 120 | |
| 121 | struct 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 Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 140 | extern int put_compat_rusage(const struct rusage *, |
| 141 | struct compat_rusage __user *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | |
| 143 | struct compat_siginfo; |
| 144 | |
| 145 | extern asmlinkage long compat_sys_waitid(int, compat_pid_t, |
| 146 | struct compat_siginfo __user *, int, |
| 147 | struct compat_rusage __user *); |
| 148 | |
| 149 | struct compat_dirent { |
| 150 | u32 d_ino; |
| 151 | compat_off_t d_off; |
| 152 | u16 d_reclen; |
| 153 | char d_name[256]; |
| 154 | }; |
| 155 | |
Christoph Hellwig | 2b1c6bd | 2008-11-28 10:09:09 +0100 | [diff] [blame] | 156 | struct 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | #define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3) |
| 164 | |
| 165 | typedef struct compat_sigevent { |
| 166 | compat_sigval_t sigev_value; |
| 167 | compat_int_t sigev_signo; |
| 168 | compat_int_t sigev_notify; |
| 169 | union { |
| 170 | compat_int_t _pad[COMPAT_SIGEV_PAD_SIZE]; |
| 171 | compat_int_t _tid; |
| 172 | |
| 173 | struct { |
| 174 | compat_uptr_t _function; |
| 175 | compat_uptr_t _attribute; |
| 176 | } _sigev_thread; |
| 177 | } _sigev_un; |
| 178 | } compat_sigevent_t; |
| 179 | |
Arnd Bergmann | 2dceba1 | 2009-11-06 08:09:03 +0000 | [diff] [blame] | 180 | struct compat_ifmap { |
| 181 | compat_ulong_t mem_start; |
| 182 | compat_ulong_t mem_end; |
| 183 | unsigned short base_addr; |
| 184 | unsigned char irq; |
| 185 | unsigned char dma; |
| 186 | unsigned char port; |
| 187 | }; |
| 188 | |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 189 | struct compat_if_settings { |
Arnd Bergmann | 7a50a24 | 2009-11-08 20:57:03 -0800 | [diff] [blame] | 190 | unsigned int type; /* Type of physical device or protocol */ |
| 191 | unsigned int size; /* Size of the data allocated by the caller */ |
| 192 | compat_uptr_t ifs_ifsu; /* union of pointers */ |
| 193 | }; |
| 194 | |
Arnd Bergmann | 2dceba1 | 2009-11-06 08:09:03 +0000 | [diff] [blame] | 195 | struct compat_ifreq { |
Arnd Bergmann | 7a50a24 | 2009-11-08 20:57:03 -0800 | [diff] [blame] | 196 | union { |
| 197 | char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
| 198 | } ifr_ifrn; |
| 199 | union { |
| 200 | struct sockaddr ifru_addr; |
| 201 | struct sockaddr ifru_dstaddr; |
| 202 | struct sockaddr ifru_broadaddr; |
| 203 | struct sockaddr ifru_netmask; |
| 204 | struct sockaddr ifru_hwaddr; |
| 205 | short ifru_flags; |
| 206 | compat_int_t ifru_ivalue; |
| 207 | compat_int_t ifru_mtu; |
| 208 | struct compat_ifmap ifru_map; |
| 209 | char ifru_slave[IFNAMSIZ]; /* Just fits the size */ |
Arnd Bergmann | 2dceba1 | 2009-11-06 08:09:03 +0000 | [diff] [blame] | 210 | char ifru_newname[IFNAMSIZ]; |
Arnd Bergmann | 7a50a24 | 2009-11-08 20:57:03 -0800 | [diff] [blame] | 211 | compat_caddr_t ifru_data; |
| 212 | struct compat_if_settings ifru_settings; |
| 213 | } ifr_ifru; |
Arnd Bergmann | 2dceba1 | 2009-11-06 08:09:03 +0000 | [diff] [blame] | 214 | }; |
| 215 | |
| 216 | struct compat_ifconf { |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 217 | compat_int_t ifc_len; /* size of buffer */ |
| 218 | compat_caddr_t ifcbuf; |
Arnd Bergmann | 2dceba1 | 2009-11-06 08:09:03 +0000 | [diff] [blame] | 219 | }; |
| 220 | |
Ingo Molnar | 34f192c | 2006-03-27 01:16:24 -0800 | [diff] [blame] | 221 | struct compat_robust_list { |
| 222 | compat_uptr_t next; |
| 223 | }; |
| 224 | |
| 225 | struct compat_robust_list_head { |
| 226 | struct compat_robust_list list; |
| 227 | compat_long_t futex_offset; |
| 228 | compat_uptr_t list_op_pending; |
| 229 | }; |
| 230 | |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 231 | struct compat_statfs; |
| 232 | struct compat_statfs64; |
| 233 | struct compat_old_linux_dirent; |
| 234 | struct compat_linux_dirent; |
| 235 | struct linux_dirent64; |
| 236 | struct compat_msghdr; |
| 237 | struct compat_mmsghdr; |
| 238 | struct compat_sysinfo; |
| 239 | struct compat_sysctl_args; |
| 240 | struct compat_kexec_segment; |
| 241 | struct compat_mq_attr; |
Chris Metcalf | 48b25c4 | 2012-03-15 13:13:38 -0400 | [diff] [blame] | 242 | struct compat_msgbuf; |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 243 | |
Ingo Molnar | 34f192c | 2006-03-27 01:16:24 -0800 | [diff] [blame] | 244 | extern void compat_exit_robust_list(struct task_struct *curr); |
| 245 | |
| 246 | asmlinkage long |
| 247 | compat_sys_set_robust_list(struct compat_robust_list_head __user *head, |
| 248 | compat_size_t len); |
| 249 | asmlinkage long |
Al Viro | ba46df9 | 2006-10-10 22:46:07 +0100 | [diff] [blame] | 250 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, |
Ingo Molnar | 34f192c | 2006-03-27 01:16:24 -0800 | [diff] [blame] | 251 | compat_size_t __user *len_ptr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | |
Chris Metcalf | 48b25c4 | 2012-03-15 13:13:38 -0400 | [diff] [blame] | 253 | #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | long compat_sys_semctl(int first, int second, int third, void __user *uptr); |
| 255 | long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); |
| 256 | long compat_sys_msgrcv(int first, int second, int msgtyp, int third, |
| 257 | int version, void __user *uptr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, |
| 259 | void __user *uptr); |
Chris Metcalf | 48b25c4 | 2012-03-15 13:13:38 -0400 | [diff] [blame] | 260 | #else |
| 261 | long compat_sys_semctl(int semid, int semnum, int cmd, int arg); |
| 262 | long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, |
Will Deacon | 05ba3f1 | 2012-07-30 14:42:43 -0700 | [diff] [blame] | 263 | compat_ssize_t msgsz, int msgflg); |
Chris Metcalf | 48b25c4 | 2012-03-15 13:13:38 -0400 | [diff] [blame] | 264 | long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, |
Will Deacon | 05ba3f1 | 2012-07-30 14:42:43 -0700 | [diff] [blame] | 265 | compat_ssize_t msgsz, long msgtyp, int msgflg); |
Chris Metcalf | 48b25c4 | 2012-03-15 13:13:38 -0400 | [diff] [blame] | 266 | long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); |
| 267 | #endif |
| 268 | long compat_sys_msgctl(int first, int second, void __user *uptr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | long compat_sys_shmctl(int first, int second, void __user *uptr); |
| 270 | long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, |
| 271 | unsigned nsems, const struct compat_timespec __user *timeout); |
| 272 | asmlinkage long compat_sys_keyctl(u32 option, |
| 273 | u32 arg2, u32 arg3, u32 arg4, u32 arg5); |
Christoph Hellwig | 2b1c6bd | 2008-11-28 10:09:09 +0100 | [diff] [blame] | 274 | asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | |
| 276 | asmlinkage ssize_t compat_sys_readv(unsigned long fd, |
| 277 | const struct compat_iovec __user *vec, unsigned long vlen); |
| 278 | asmlinkage ssize_t compat_sys_writev(unsigned long fd, |
| 279 | const struct compat_iovec __user *vec, unsigned long vlen); |
Gerd Hoffmann | f3554f4 | 2009-04-02 16:59:23 -0700 | [diff] [blame] | 280 | asmlinkage ssize_t compat_sys_preadv(unsigned long fd, |
| 281 | const struct compat_iovec __user *vec, |
Linus Torvalds | 601cc11 | 2009-04-03 08:03:22 -0700 | [diff] [blame] | 282 | unsigned long vlen, u32 pos_low, u32 pos_high); |
Gerd Hoffmann | f3554f4 | 2009-04-02 16:59:23 -0700 | [diff] [blame] | 283 | asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, |
| 284 | const struct compat_iovec __user *vec, |
Linus Torvalds | 601cc11 | 2009-04-03 08:03:22 -0700 | [diff] [blame] | 285 | unsigned long vlen, u32 pos_low, u32 pos_high); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | |
Al Viro | 38b983b | 2012-09-30 13:38:55 -0400 | [diff] [blame] | 287 | int compat_do_execve(const char *filename, const compat_uptr_t __user *argv, |
| 288 | const compat_uptr_t __user *envp, struct pt_regs *regs); |
| 289 | #ifdef __ARCH_WANT_SYS_EXECVE |
| 290 | asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, |
| 291 | const compat_uptr_t __user *envp); |
| 292 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | |
| 294 | asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, |
| 295 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, |
| 296 | struct compat_timeval __user *tvp); |
| 297 | |
Christoph Hellwig | 5d0e528 | 2010-03-10 15:21:13 -0800 | [diff] [blame] | 298 | asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg); |
| 299 | |
Thomas Gleixner | c202f29 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 300 | asmlinkage long compat_sys_wait4(compat_pid_t pid, |
Al Viro | 7d61c45 | 2008-03-29 03:09:28 +0000 | [diff] [blame] | 301 | compat_uint_t __user *stat_addr, int options, |
| 302 | struct compat_rusage __user *ru); |
Thomas Gleixner | c202f29 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 303 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t)) |
| 305 | |
| 306 | #define BITS_TO_COMPAT_LONGS(bits) \ |
| 307 | (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG) |
| 308 | |
Stephen Rothwell | 5fa3839 | 2006-10-28 10:38:46 -0700 | [diff] [blame] | 309 | long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | unsigned long bitmap_size); |
| 311 | long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, |
| 312 | unsigned long bitmap_size); |
| 313 | int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from); |
| 314 | int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from); |
| 315 | int get_compat_sigevent(struct sigevent *event, |
| 316 | const struct compat_sigevent __user *u_event); |
Thomas Gleixner | 62ab450 | 2009-04-04 21:01:06 +0000 | [diff] [blame] | 317 | long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, |
| 318 | struct compat_siginfo __user *uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | |
Andrew Morton | 643a654 | 2006-02-11 17:55:52 -0800 | [diff] [blame] | 320 | static inline int compat_timeval_compare(struct compat_timeval *lhs, |
| 321 | struct compat_timeval *rhs) |
| 322 | { |
| 323 | if (lhs->tv_sec < rhs->tv_sec) |
| 324 | return -1; |
| 325 | if (lhs->tv_sec > rhs->tv_sec) |
| 326 | return 1; |
| 327 | return lhs->tv_usec - rhs->tv_usec; |
| 328 | } |
| 329 | |
| 330 | static inline int compat_timespec_compare(struct compat_timespec *lhs, |
| 331 | struct compat_timespec *rhs) |
| 332 | { |
| 333 | if (lhs->tv_sec < rhs->tv_sec) |
| 334 | return -1; |
| 335 | if (lhs->tv_sec > rhs->tv_sec) |
| 336 | return 1; |
| 337 | return lhs->tv_nsec - rhs->tv_nsec; |
| 338 | } |
| 339 | |
Davide Libenzi | 83f5d12 | 2007-05-10 22:23:18 -0700 | [diff] [blame] | 340 | extern int get_compat_itimerspec(struct itimerspec *dst, |
| 341 | const struct compat_itimerspec __user *src); |
| 342 | extern int put_compat_itimerspec(struct compat_itimerspec __user *dst, |
| 343 | const struct itimerspec *src); |
| 344 | |
Christoph Hellwig | b418da1 | 2008-10-15 22:02:06 -0700 | [diff] [blame] | 345 | asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, |
| 346 | struct timezone __user *tz); |
| 347 | asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, |
| 348 | struct timezone __user *tz); |
| 349 | |
Stephen Rothwell | 3158e94 | 2006-03-26 01:37:29 -0800 | [diff] [blame] | 350 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); |
| 351 | |
Andi Kleen | bebfa10 | 2006-06-26 13:56:52 +0200 | [diff] [blame] | 352 | extern int compat_printk(const char *fmt, ...); |
Linus Torvalds | 0235497 | 2006-10-02 14:05:20 -0700 | [diff] [blame] | 353 | extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); |
Andi Kleen | bebfa10 | 2006-06-26 13:56:52 +0200 | [diff] [blame] | 354 | |
Stephen Rothwell | 3fd5939 | 2006-11-02 22:07:24 -0800 | [diff] [blame] | 355 | asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, |
| 356 | compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, |
| 357 | const compat_ulong_t __user *new_nodes); |
| 358 | |
Roland McGrath | 032d82d | 2008-01-30 13:31:47 +0100 | [diff] [blame] | 359 | extern int compat_ptrace_request(struct task_struct *child, |
| 360 | compat_long_t request, |
| 361 | compat_ulong_t addr, compat_ulong_t data); |
| 362 | |
Roland McGrath | c269f19 | 2008-01-30 13:31:48 +0100 | [diff] [blame] | 363 | extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
| 364 | compat_ulong_t addr, compat_ulong_t data); |
| 365 | asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, |
| 366 | compat_long_t addr, compat_long_t data); |
Roland McGrath | c269f19 | 2008-01-30 13:31:48 +0100 | [diff] [blame] | 367 | |
Davide Libenzi | f6dfb4f | 2007-03-07 20:41:21 -0800 | [diff] [blame] | 368 | /* |
| 369 | * epoll (fs/eventpoll.c) compat bits follow ... |
| 370 | */ |
Davide Libenzi | f6dfb4f | 2007-03-07 20:41:21 -0800 | [diff] [blame] | 371 | struct epoll_event; |
| 372 | #define compat_epoll_event epoll_event |
Davide Libenzi | f6dfb4f | 2007-03-07 20:41:21 -0800 | [diff] [blame] | 373 | asmlinkage long compat_sys_epoll_pwait(int epfd, |
| 374 | struct compat_epoll_event __user *events, |
| 375 | int maxevents, int timeout, |
| 376 | const compat_sigset_t __user *sigmask, |
| 377 | compat_size_t sigsetsize); |
| 378 | |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 379 | asmlinkage long compat_sys_utime(const char __user *filename, |
| 380 | struct compat_utimbuf __user *t); |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 381 | asmlinkage long compat_sys_utimensat(unsigned int dfd, |
| 382 | const char __user *filename, |
| 383 | struct compat_timespec __user *t, |
| 384 | int flags); |
Stephen Rothwell | 97416ce | 2007-05-09 02:32:35 -0700 | [diff] [blame] | 385 | |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 386 | asmlinkage long compat_sys_time(compat_time_t __user *tloc); |
| 387 | asmlinkage long compat_sys_stime(compat_time_t __user *tptr); |
Stephen Rothwell | 140ff8b | 2007-05-14 13:47:47 +1000 | [diff] [blame] | 388 | asmlinkage long compat_sys_signalfd(int ufd, |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 389 | const compat_sigset_t __user *sigmask, |
| 390 | compat_size_t sigsetsize); |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 391 | asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, |
| 392 | const struct compat_itimerspec __user *utmr, |
| 393 | struct compat_itimerspec __user *otmr); |
| 394 | asmlinkage long compat_sys_timerfd_gettime(int ufd, |
| 395 | struct compat_itimerspec __user *otmr); |
Stephen Rothwell | 140ff8b | 2007-05-14 13:47:47 +1000 | [diff] [blame] | 396 | |
Heiko Carstens | 4c696ba | 2009-01-14 14:13:53 +0100 | [diff] [blame] | 397 | asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page, |
| 398 | __u32 __user *pages, |
| 399 | const int __user *nodes, |
| 400 | int __user *status, |
| 401 | int flags); |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 402 | asmlinkage long compat_sys_futimesat(unsigned int dfd, |
| 403 | const char __user *filename, |
Heiko Carstens | 4c696ba | 2009-01-14 14:13:53 +0100 | [diff] [blame] | 404 | struct compat_timeval __user *t); |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 405 | asmlinkage long compat_sys_utimes(const char __user *filename, |
| 406 | struct compat_timeval __user *t); |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 407 | asmlinkage long compat_sys_newstat(const char __user *filename, |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 408 | struct compat_stat __user *statbuf); |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 409 | asmlinkage long compat_sys_newlstat(const char __user *filename, |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 410 | struct compat_stat __user *statbuf); |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 411 | asmlinkage long compat_sys_newfstatat(unsigned int dfd, |
| 412 | const char __user *filename, |
Heiko Carstens | 4c696ba | 2009-01-14 14:13:53 +0100 | [diff] [blame] | 413 | struct compat_stat __user *statbuf, |
| 414 | int flag); |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 415 | asmlinkage long compat_sys_newfstat(unsigned int fd, |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 416 | struct compat_stat __user *statbuf); |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 417 | asmlinkage long compat_sys_statfs(const char __user *pathname, |
| 418 | struct compat_statfs __user *buf); |
| 419 | asmlinkage long compat_sys_fstatfs(unsigned int fd, |
| 420 | struct compat_statfs __user *buf); |
| 421 | asmlinkage long compat_sys_statfs64(const char __user *pathname, |
| 422 | compat_size_t sz, |
| 423 | struct compat_statfs64 __user *buf); |
| 424 | asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, |
| 425 | struct compat_statfs64 __user *buf); |
| 426 | asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd, |
| 427 | unsigned long arg); |
| 428 | asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd, |
| 429 | unsigned long arg); |
| 430 | asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); |
| 431 | asmlinkage long compat_sys_io_getevents(aio_context_t ctx_id, |
| 432 | unsigned long min_nr, |
| 433 | unsigned long nr, |
| 434 | struct io_event __user *events, |
| 435 | struct compat_timespec __user *timeout); |
| 436 | asmlinkage long compat_sys_io_submit(aio_context_t ctx_id, int nr, |
| 437 | u32 __user *iocb); |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 438 | asmlinkage long compat_sys_mount(const char __user *dev_name, |
| 439 | const char __user *dir_name, |
| 440 | const char __user *type, unsigned long flags, |
| 441 | const void __user *data); |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 442 | asmlinkage long compat_sys_old_readdir(unsigned int fd, |
| 443 | struct compat_old_linux_dirent __user *, |
| 444 | unsigned int count); |
| 445 | asmlinkage long compat_sys_getdents(unsigned int fd, |
| 446 | struct compat_linux_dirent __user *dirent, |
| 447 | unsigned int count); |
| 448 | asmlinkage long compat_sys_getdents64(unsigned int fd, |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 449 | struct linux_dirent64 __user *dirent, |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 450 | unsigned int count); |
| 451 | asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, |
| 452 | unsigned int nr_segs, unsigned int flags); |
| 453 | asmlinkage long compat_sys_open(const char __user *filename, int flags, |
Al Viro | a218d0f | 2011-11-21 14:59:34 -0500 | [diff] [blame] | 454 | umode_t mode); |
Heiko Carstens | 4c696ba | 2009-01-14 14:13:53 +0100 | [diff] [blame] | 455 | asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, |
Al Viro | a218d0f | 2011-11-21 14:59:34 -0500 | [diff] [blame] | 456 | int flags, umode_t mode); |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 457 | asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, |
| 458 | struct file_handle __user *handle, |
| 459 | int flags); |
| 460 | asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, |
| 461 | compat_ulong_t __user *outp, |
| 462 | compat_ulong_t __user *exp, |
| 463 | struct compat_timespec __user *tsp, |
| 464 | void __user *sig); |
| 465 | asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, |
| 466 | unsigned int nfds, |
| 467 | struct compat_timespec __user *tsp, |
| 468 | const compat_sigset_t __user *sigmask, |
| 469 | compat_size_t sigsetsize); |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 470 | asmlinkage long compat_sys_signalfd4(int ufd, |
| 471 | const compat_sigset_t __user *sigmask, |
| 472 | compat_size_t sigsetsize, int flags); |
| 473 | asmlinkage long compat_sys_get_mempolicy(int __user *policy, |
| 474 | compat_ulong_t __user *nmask, |
| 475 | compat_ulong_t maxnode, |
| 476 | compat_ulong_t addr, |
| 477 | compat_ulong_t flags); |
| 478 | asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask, |
| 479 | compat_ulong_t maxnode); |
| 480 | asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, |
| 481 | compat_ulong_t mode, |
| 482 | compat_ulong_t __user *nmask, |
| 483 | compat_ulong_t maxnode, compat_ulong_t flags); |
| 484 | |
| 485 | asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, |
| 486 | char __user *optval, unsigned int optlen); |
| 487 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, |
| 488 | unsigned flags); |
Chris Metcalf | 507c5f1 | 2011-06-27 16:18:07 -0700 | [diff] [blame] | 489 | asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg, |
| 490 | unsigned vlen, unsigned int flags); |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 491 | asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, |
| 492 | unsigned int flags); |
| 493 | asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len, |
| 494 | unsigned flags); |
| 495 | asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len, |
| 496 | unsigned flags, struct sockaddr __user *addr, |
| 497 | int __user *addrlen); |
| 498 | asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, |
| 499 | unsigned vlen, unsigned int flags, |
| 500 | struct compat_timespec __user *timeout); |
| 501 | asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, |
| 502 | struct compat_timespec __user *rmtp); |
| 503 | asmlinkage long compat_sys_getitimer(int which, |
| 504 | struct compat_itimerval __user *it); |
| 505 | asmlinkage long compat_sys_setitimer(int which, |
| 506 | struct compat_itimerval __user *in, |
| 507 | struct compat_itimerval __user *out); |
| 508 | asmlinkage long compat_sys_times(struct compat_tms __user *tbuf); |
| 509 | asmlinkage long compat_sys_setrlimit(unsigned int resource, |
| 510 | struct compat_rlimit __user *rlim); |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 511 | asmlinkage long compat_sys_getrlimit(unsigned int resource, |
| 512 | struct compat_rlimit __user *rlim); |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 513 | asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru); |
| 514 | asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, |
| 515 | unsigned int len, |
| 516 | compat_ulong_t __user *user_mask_ptr); |
| 517 | asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, |
| 518 | unsigned int len, |
| 519 | compat_ulong_t __user *user_mask_ptr); |
| 520 | asmlinkage long compat_sys_timer_create(clockid_t which_clock, |
| 521 | struct compat_sigevent __user *timer_event_spec, |
| 522 | timer_t __user *created_timer_id); |
| 523 | asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags, |
| 524 | struct compat_itimerspec __user *new, |
| 525 | struct compat_itimerspec __user *old); |
| 526 | asmlinkage long compat_sys_timer_gettime(timer_t timer_id, |
| 527 | struct compat_itimerspec __user *setting); |
| 528 | asmlinkage long compat_sys_clock_settime(clockid_t which_clock, |
| 529 | struct compat_timespec __user *tp); |
| 530 | asmlinkage long compat_sys_clock_gettime(clockid_t which_clock, |
| 531 | struct compat_timespec __user *tp); |
| 532 | asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock, |
| 533 | struct compat_timex __user *tp); |
| 534 | asmlinkage long compat_sys_clock_getres(clockid_t which_clock, |
| 535 | struct compat_timespec __user *tp); |
| 536 | asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, |
| 537 | struct compat_timespec __user *rqtp, |
| 538 | struct compat_timespec __user *rmtp); |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 539 | asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese, |
Chris Metcalf | be84cb4 | 2011-05-09 13:12:30 -0400 | [diff] [blame] | 540 | struct compat_siginfo __user *uinfo, |
| 541 | struct compat_timespec __user *uts, compat_size_t sigsetsize); |
| 542 | asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, |
| 543 | compat_size_t sigsetsize); |
| 544 | asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); |
| 545 | asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, |
| 546 | unsigned long arg); |
| 547 | asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, |
| 548 | struct compat_timespec __user *utime, u32 __user *uaddr2, |
| 549 | u32 val3); |
| 550 | asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, |
| 551 | char __user *optval, int __user *optlen); |
| 552 | asmlinkage long compat_sys_kexec_load(unsigned long entry, |
| 553 | unsigned long nr_segments, |
| 554 | struct compat_kexec_segment __user *, |
| 555 | unsigned long flags); |
| 556 | asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, |
| 557 | const struct compat_mq_attr __user *u_mqstat, |
| 558 | struct compat_mq_attr __user *u_omqstat); |
| 559 | asmlinkage long compat_sys_mq_notify(mqd_t mqdes, |
| 560 | const struct compat_sigevent __user *u_notification); |
| 561 | asmlinkage long compat_sys_mq_open(const char __user *u_name, |
| 562 | int oflag, compat_mode_t mode, |
| 563 | struct compat_mq_attr __user *u_attr); |
| 564 | asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes, |
| 565 | const char __user *u_msg_ptr, |
| 566 | size_t msg_len, unsigned int msg_prio, |
| 567 | const struct compat_timespec __user *u_abs_timeout); |
| 568 | asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, |
| 569 | char __user *u_msg_ptr, |
| 570 | size_t msg_len, unsigned int __user *u_msg_prio, |
| 571 | const struct compat_timespec __user *u_abs_timeout); |
| 572 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args); |
| 573 | asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args); |
Heiko Carstens | 4c696ba | 2009-01-14 14:13:53 +0100 | [diff] [blame] | 574 | |
Jeff Moyer | b837336 | 2010-05-26 14:44:25 -0700 | [diff] [blame] | 575 | extern ssize_t compat_rw_copy_check_uvector(int type, |
Chris Metcalf | 4800a5b | 2011-05-17 14:41:06 -0400 | [diff] [blame] | 576 | const struct compat_iovec __user *uvector, |
| 577 | unsigned long nr_segs, |
Jeff Moyer | b837336 | 2010-05-26 14:44:25 -0700 | [diff] [blame] | 578 | unsigned long fast_segs, struct iovec *fast_pointer, |
Christopher Yeoh | ac34ebb | 2012-05-31 16:26:42 -0700 | [diff] [blame] | 579 | struct iovec **ret_pointer); |
H. Peter Anvin | c41d68a | 2010-09-07 16:16:18 -0700 | [diff] [blame] | 580 | |
| 581 | extern void __user *compat_alloc_user_space(unsigned long len); |
| 582 | |
Chris Metcalf | a67ba43 | 2011-12-01 12:54:31 -0500 | [diff] [blame] | 583 | asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid, |
| 584 | const struct compat_iovec __user *lvec, |
| 585 | unsigned long liovcnt, const struct compat_iovec __user *rvec, |
| 586 | unsigned long riovcnt, unsigned long flags); |
| 587 | asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid, |
| 588 | const struct compat_iovec __user *lvec, |
| 589 | unsigned long liovcnt, const struct compat_iovec __user *rvec, |
| 590 | unsigned long riovcnt, unsigned long flags); |
| 591 | |
Catalin Marinas | 8f9c011 | 2012-09-19 12:01:52 +0100 | [diff] [blame] | 592 | asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, |
| 593 | compat_off_t __user *offset, compat_size_t count); |
| 594 | |
Linus Torvalds | 3c761ea | 2012-02-26 09:44:55 -0800 | [diff] [blame] | 595 | #else |
| 596 | |
| 597 | #define is_compat_task() (0) |
| 598 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | #endif /* CONFIG_COMPAT */ |
| 600 | #endif /* _LINUX_COMPAT_H */ |