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