compat.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  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. */
  7. #ifdef CONFIG_COMPAT
  8. #include <linux/stat.h>
  9. #include <linux/param.h> /* for HZ */
  10. #include <linux/sem.h>
  11. #include <linux/socket.h>
  12. #include <linux/if.h>
  13. #include <linux/fs.h>
  14. #include <linux/aio_abi.h> /* for aio_context_t */
  15. #include <asm/compat.h>
  16. #include <asm/siginfo.h>
  17. #include <asm/signal.h>
  18. #ifndef COMPAT_USE_64BIT_TIME
  19. #define COMPAT_USE_64BIT_TIME 0
  20. #endif
  21. #ifndef __SC_DELOUSE
  22. #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
  23. #endif
  24. #define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1)
  25. #define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__)
  26. #define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__)
  27. #define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__)
  28. #define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__)
  29. #define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__)
  30. #define COMPAT_SYSCALL_DEFINE1(name, ...) \
  31. COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
  32. #define COMPAT_SYSCALL_DEFINE2(name, ...) \
  33. COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
  34. #define COMPAT_SYSCALL_DEFINE3(name, ...) \
  35. COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
  36. #define COMPAT_SYSCALL_DEFINE4(name, ...) \
  37. COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
  38. #define COMPAT_SYSCALL_DEFINE5(name, ...) \
  39. COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
  40. #define COMPAT_SYSCALL_DEFINE6(name, ...) \
  41. COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
  42. #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
  43. #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
  44. asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \
  45. static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \
  46. asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \
  47. { \
  48. return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \
  49. } \
  50. SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
  51. static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__))
  52. #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
  53. #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
  54. asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__))
  55. #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
  56. #ifndef compat_user_stack_pointer
  57. #define compat_user_stack_pointer() current_user_stack_pointer()
  58. #endif
  59. #ifdef CONFIG_GENERIC_SIGALTSTACK
  60. #ifndef compat_sigaltstack /* we'll need that for MIPS */
  61. typedef struct compat_sigaltstack {
  62. compat_uptr_t ss_sp;
  63. int ss_flags;
  64. compat_size_t ss_size;
  65. } compat_stack_t;
  66. #endif
  67. #endif
  68. #define compat_jiffies_to_clock_t(x) \
  69. (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
  70. typedef __compat_uid32_t compat_uid_t;
  71. typedef __compat_gid32_t compat_gid_t;
  72. struct compat_sel_arg_struct;
  73. struct rusage;
  74. struct compat_itimerspec {
  75. struct compat_timespec it_interval;
  76. struct compat_timespec it_value;
  77. };
  78. struct compat_utimbuf {
  79. compat_time_t actime;
  80. compat_time_t modtime;
  81. };
  82. struct compat_itimerval {
  83. struct compat_timeval it_interval;
  84. struct compat_timeval it_value;
  85. };
  86. struct compat_tms {
  87. compat_clock_t tms_utime;
  88. compat_clock_t tms_stime;
  89. compat_clock_t tms_cutime;
  90. compat_clock_t tms_cstime;
  91. };
  92. struct compat_timex {
  93. compat_uint_t modes;
  94. compat_long_t offset;
  95. compat_long_t freq;
  96. compat_long_t maxerror;
  97. compat_long_t esterror;
  98. compat_int_t status;
  99. compat_long_t constant;
  100. compat_long_t precision;
  101. compat_long_t tolerance;
  102. struct compat_timeval time;
  103. compat_long_t tick;
  104. compat_long_t ppsfreq;
  105. compat_long_t jitter;
  106. compat_int_t shift;
  107. compat_long_t stabil;
  108. compat_long_t jitcnt;
  109. compat_long_t calcnt;
  110. compat_long_t errcnt;
  111. compat_long_t stbcnt;
  112. compat_int_t tai;
  113. compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32;
  114. compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32;
  115. compat_int_t:32; compat_int_t:32; compat_int_t:32;
  116. };
  117. #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
  118. typedef struct {
  119. compat_sigset_word sig[_COMPAT_NSIG_WORDS];
  120. } compat_sigset_t;
  121. #ifdef CONFIG_GENERIC_COMPAT_RT_SIGACTION
  122. struct compat_sigaction {
  123. #ifndef __ARCH_HAS_ODD_SIGACTION
  124. compat_uptr_t sa_handler;
  125. compat_ulong_t sa_flags;
  126. #else
  127. compat_ulong_t sa_flags;
  128. compat_uptr_t sa_handler;
  129. #endif
  130. #ifdef __ARCH_HAS_SA_RESTORER
  131. compat_uptr_t sa_restorer;
  132. #endif
  133. compat_sigset_t sa_mask __packed;
  134. };
  135. #endif
  136. /*
  137. * These functions operate strictly on struct compat_time*
  138. */
  139. extern int get_compat_timespec(struct timespec *,
  140. const struct compat_timespec __user *);
  141. extern int put_compat_timespec(const struct timespec *,
  142. struct compat_timespec __user *);
  143. extern int get_compat_timeval(struct timeval *,
  144. const struct compat_timeval __user *);
  145. extern int put_compat_timeval(const struct timeval *,
  146. struct compat_timeval __user *);
  147. /*
  148. * These functions operate on 32- or 64-bit specs depending on
  149. * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the
  150. * naming as compat_get/put_ rather than get/put_compat_.
  151. */
  152. extern int compat_get_timespec(struct timespec *, const void __user *);
  153. extern int compat_put_timespec(const struct timespec *, void __user *);
  154. extern int compat_get_timeval(struct timeval *, const void __user *);
  155. extern int compat_put_timeval(const struct timeval *, void __user *);
  156. struct compat_iovec {
  157. compat_uptr_t iov_base;
  158. compat_size_t iov_len;
  159. };
  160. struct compat_rlimit {
  161. compat_ulong_t rlim_cur;
  162. compat_ulong_t rlim_max;
  163. };
  164. struct compat_rusage {
  165. struct compat_timeval ru_utime;
  166. struct compat_timeval ru_stime;
  167. compat_long_t ru_maxrss;
  168. compat_long_t ru_ixrss;
  169. compat_long_t ru_idrss;
  170. compat_long_t ru_isrss;
  171. compat_long_t ru_minflt;
  172. compat_long_t ru_majflt;
  173. compat_long_t ru_nswap;
  174. compat_long_t ru_inblock;
  175. compat_long_t ru_oublock;
  176. compat_long_t ru_msgsnd;
  177. compat_long_t ru_msgrcv;
  178. compat_long_t ru_nsignals;
  179. compat_long_t ru_nvcsw;
  180. compat_long_t ru_nivcsw;
  181. };
  182. extern int put_compat_rusage(const struct rusage *,
  183. struct compat_rusage __user *);
  184. struct compat_siginfo;
  185. extern asmlinkage long compat_sys_waitid(int, compat_pid_t,
  186. struct compat_siginfo __user *, int,
  187. struct compat_rusage __user *);
  188. struct compat_dirent {
  189. u32 d_ino;
  190. compat_off_t d_off;
  191. u16 d_reclen;
  192. char d_name[256];
  193. };
  194. struct compat_ustat {
  195. compat_daddr_t f_tfree;
  196. compat_ino_t f_tinode;
  197. char f_fname[6];
  198. char f_fpack[6];
  199. };
  200. #define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
  201. typedef struct compat_sigevent {
  202. compat_sigval_t sigev_value;
  203. compat_int_t sigev_signo;
  204. compat_int_t sigev_notify;
  205. union {
  206. compat_int_t _pad[COMPAT_SIGEV_PAD_SIZE];
  207. compat_int_t _tid;
  208. struct {
  209. compat_uptr_t _function;
  210. compat_uptr_t _attribute;
  211. } _sigev_thread;
  212. } _sigev_un;
  213. } compat_sigevent_t;
  214. struct compat_ifmap {
  215. compat_ulong_t mem_start;
  216. compat_ulong_t mem_end;
  217. unsigned short base_addr;
  218. unsigned char irq;
  219. unsigned char dma;
  220. unsigned char port;
  221. };
  222. struct compat_if_settings {
  223. unsigned int type; /* Type of physical device or protocol */
  224. unsigned int size; /* Size of the data allocated by the caller */
  225. compat_uptr_t ifs_ifsu; /* union of pointers */
  226. };
  227. struct compat_ifreq {
  228. union {
  229. char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
  230. } ifr_ifrn;
  231. union {
  232. struct sockaddr ifru_addr;
  233. struct sockaddr ifru_dstaddr;
  234. struct sockaddr ifru_broadaddr;
  235. struct sockaddr ifru_netmask;
  236. struct sockaddr ifru_hwaddr;
  237. short ifru_flags;
  238. compat_int_t ifru_ivalue;
  239. compat_int_t ifru_mtu;
  240. struct compat_ifmap ifru_map;
  241. char ifru_slave[IFNAMSIZ]; /* Just fits the size */
  242. char ifru_newname[IFNAMSIZ];
  243. compat_caddr_t ifru_data;
  244. struct compat_if_settings ifru_settings;
  245. } ifr_ifru;
  246. };
  247. struct compat_ifconf {
  248. compat_int_t ifc_len; /* size of buffer */
  249. compat_caddr_t ifcbuf;
  250. };
  251. struct compat_robust_list {
  252. compat_uptr_t next;
  253. };
  254. struct compat_robust_list_head {
  255. struct compat_robust_list list;
  256. compat_long_t futex_offset;
  257. compat_uptr_t list_op_pending;
  258. };
  259. #ifdef CONFIG_COMPAT_OLD_SIGACTION
  260. struct compat_old_sigaction {
  261. compat_uptr_t sa_handler;
  262. compat_old_sigset_t sa_mask;
  263. compat_ulong_t sa_flags;
  264. compat_uptr_t sa_restorer;
  265. };
  266. #endif
  267. struct compat_statfs;
  268. struct compat_statfs64;
  269. struct compat_old_linux_dirent;
  270. struct compat_linux_dirent;
  271. struct linux_dirent64;
  272. struct compat_msghdr;
  273. struct compat_mmsghdr;
  274. struct compat_sysinfo;
  275. struct compat_sysctl_args;
  276. struct compat_kexec_segment;
  277. struct compat_mq_attr;
  278. struct compat_msgbuf;
  279. extern void compat_exit_robust_list(struct task_struct *curr);
  280. asmlinkage long
  281. compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
  282. compat_size_t len);
  283. asmlinkage long
  284. compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
  285. compat_size_t __user *len_ptr);
  286. #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
  287. long compat_sys_semctl(int first, int second, int third, void __user *uptr);
  288. long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
  289. long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
  290. int version, void __user *uptr);
  291. long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
  292. void __user *uptr);
  293. #else
  294. long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
  295. long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
  296. compat_ssize_t msgsz, int msgflg);
  297. long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp,
  298. compat_ssize_t msgsz, long msgtyp, int msgflg);
  299. long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
  300. #endif
  301. long compat_sys_msgctl(int first, int second, void __user *uptr);
  302. long compat_sys_shmctl(int first, int second, void __user *uptr);
  303. long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
  304. unsigned nsems, const struct compat_timespec __user *timeout);
  305. asmlinkage long compat_sys_keyctl(u32 option,
  306. u32 arg2, u32 arg3, u32 arg4, u32 arg5);
  307. asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32);
  308. asmlinkage ssize_t compat_sys_readv(unsigned long fd,
  309. const struct compat_iovec __user *vec, unsigned long vlen);
  310. asmlinkage ssize_t compat_sys_writev(unsigned long fd,
  311. const struct compat_iovec __user *vec, unsigned long vlen);
  312. asmlinkage ssize_t compat_sys_preadv(unsigned long fd,
  313. const struct compat_iovec __user *vec,
  314. unsigned long vlen, u32 pos_low, u32 pos_high);
  315. asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
  316. const struct compat_iovec __user *vec,
  317. unsigned long vlen, u32 pos_low, u32 pos_high);
  318. asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
  319. const compat_uptr_t __user *envp);
  320. asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
  321. compat_ulong_t __user *outp, compat_ulong_t __user *exp,
  322. struct compat_timeval __user *tvp);
  323. asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg);
  324. asmlinkage long compat_sys_wait4(compat_pid_t pid,
  325. compat_uint_t __user *stat_addr, int options,
  326. struct compat_rusage __user *ru);
  327. #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
  328. #define BITS_TO_COMPAT_LONGS(bits) \
  329. (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
  330. long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
  331. unsigned long bitmap_size);
  332. long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
  333. unsigned long bitmap_size);
  334. int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
  335. int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
  336. int get_compat_sigevent(struct sigevent *event,
  337. const struct compat_sigevent __user *u_event);
  338. long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
  339. struct compat_siginfo __user *uinfo);
  340. #ifdef CONFIG_COMPAT_OLD_SIGACTION
  341. asmlinkage long compat_sys_sigaction(int sig,
  342. const struct compat_old_sigaction __user *act,
  343. struct compat_old_sigaction __user *oact);
  344. #endif
  345. static inline int compat_timeval_compare(struct compat_timeval *lhs,
  346. struct compat_timeval *rhs)
  347. {
  348. if (lhs->tv_sec < rhs->tv_sec)
  349. return -1;
  350. if (lhs->tv_sec > rhs->tv_sec)
  351. return 1;
  352. return lhs->tv_usec - rhs->tv_usec;
  353. }
  354. static inline int compat_timespec_compare(struct compat_timespec *lhs,
  355. struct compat_timespec *rhs)
  356. {
  357. if (lhs->tv_sec < rhs->tv_sec)
  358. return -1;
  359. if (lhs->tv_sec > rhs->tv_sec)
  360. return 1;
  361. return lhs->tv_nsec - rhs->tv_nsec;
  362. }
  363. extern int get_compat_itimerspec(struct itimerspec *dst,
  364. const struct compat_itimerspec __user *src);
  365. extern int put_compat_itimerspec(struct compat_itimerspec __user *dst,
  366. const struct itimerspec *src);
  367. asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
  368. struct timezone __user *tz);
  369. asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
  370. struct timezone __user *tz);
  371. asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
  372. extern int compat_printk(const char *fmt, ...);
  373. extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat);
  374. extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set);
  375. asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
  376. compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
  377. const compat_ulong_t __user *new_nodes);
  378. extern int compat_ptrace_request(struct task_struct *child,
  379. compat_long_t request,
  380. compat_ulong_t addr, compat_ulong_t data);
  381. extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
  382. compat_ulong_t addr, compat_ulong_t data);
  383. asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
  384. compat_long_t addr, compat_long_t data);
  385. /*
  386. * epoll (fs/eventpoll.c) compat bits follow ...
  387. */
  388. struct epoll_event;
  389. #define compat_epoll_event epoll_event
  390. asmlinkage long compat_sys_epoll_pwait(int epfd,
  391. struct compat_epoll_event __user *events,
  392. int maxevents, int timeout,
  393. const compat_sigset_t __user *sigmask,
  394. compat_size_t sigsetsize);
  395. asmlinkage long compat_sys_utime(const char __user *filename,
  396. struct compat_utimbuf __user *t);
  397. asmlinkage long compat_sys_utimensat(unsigned int dfd,
  398. const char __user *filename,
  399. struct compat_timespec __user *t,
  400. int flags);
  401. asmlinkage long compat_sys_time(compat_time_t __user *tloc);
  402. asmlinkage long compat_sys_stime(compat_time_t __user *tptr);
  403. asmlinkage long compat_sys_signalfd(int ufd,
  404. const compat_sigset_t __user *sigmask,
  405. compat_size_t sigsetsize);
  406. asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
  407. const struct compat_itimerspec __user *utmr,
  408. struct compat_itimerspec __user *otmr);
  409. asmlinkage long compat_sys_timerfd_gettime(int ufd,
  410. struct compat_itimerspec __user *otmr);
  411. asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
  412. __u32 __user *pages,
  413. const int __user *nodes,
  414. int __user *status,
  415. int flags);
  416. asmlinkage long compat_sys_futimesat(unsigned int dfd,
  417. const char __user *filename,
  418. struct compat_timeval __user *t);
  419. asmlinkage long compat_sys_utimes(const char __user *filename,
  420. struct compat_timeval __user *t);
  421. asmlinkage long compat_sys_newstat(const char __user *filename,
  422. struct compat_stat __user *statbuf);
  423. asmlinkage long compat_sys_newlstat(const char __user *filename,
  424. struct compat_stat __user *statbuf);
  425. asmlinkage long compat_sys_newfstatat(unsigned int dfd,
  426. const char __user *filename,
  427. struct compat_stat __user *statbuf,
  428. int flag);
  429. asmlinkage long compat_sys_newfstat(unsigned int fd,
  430. struct compat_stat __user *statbuf);
  431. asmlinkage long compat_sys_statfs(const char __user *pathname,
  432. struct compat_statfs __user *buf);
  433. asmlinkage long compat_sys_fstatfs(unsigned int fd,
  434. struct compat_statfs __user *buf);
  435. asmlinkage long compat_sys_statfs64(const char __user *pathname,
  436. compat_size_t sz,
  437. struct compat_statfs64 __user *buf);
  438. asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
  439. struct compat_statfs64 __user *buf);
  440. asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
  441. unsigned long arg);
  442. asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd,
  443. unsigned long arg);
  444. asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p);
  445. asmlinkage long compat_sys_io_getevents(aio_context_t ctx_id,
  446. unsigned long min_nr,
  447. unsigned long nr,
  448. struct io_event __user *events,
  449. struct compat_timespec __user *timeout);
  450. asmlinkage long compat_sys_io_submit(aio_context_t ctx_id, int nr,
  451. u32 __user *iocb);
  452. asmlinkage long compat_sys_mount(const char __user *dev_name,
  453. const char __user *dir_name,
  454. const char __user *type, unsigned long flags,
  455. const void __user *data);
  456. asmlinkage long compat_sys_old_readdir(unsigned int fd,
  457. struct compat_old_linux_dirent __user *,
  458. unsigned int count);
  459. asmlinkage long compat_sys_getdents(unsigned int fd,
  460. struct compat_linux_dirent __user *dirent,
  461. unsigned int count);
  462. asmlinkage long compat_sys_getdents64(unsigned int fd,
  463. struct linux_dirent64 __user *dirent,
  464. unsigned int count);
  465. asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
  466. unsigned int nr_segs, unsigned int flags);
  467. asmlinkage long compat_sys_open(const char __user *filename, int flags,
  468. umode_t mode);
  469. asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
  470. int flags, umode_t mode);
  471. asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
  472. struct file_handle __user *handle,
  473. int flags);
  474. asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
  475. compat_ulong_t __user *outp,
  476. compat_ulong_t __user *exp,
  477. struct compat_timespec __user *tsp,
  478. void __user *sig);
  479. asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
  480. unsigned int nfds,
  481. struct compat_timespec __user *tsp,
  482. const compat_sigset_t __user *sigmask,
  483. compat_size_t sigsetsize);
  484. asmlinkage long compat_sys_signalfd4(int ufd,
  485. const compat_sigset_t __user *sigmask,
  486. compat_size_t sigsetsize, int flags);
  487. asmlinkage long compat_sys_get_mempolicy(int __user *policy,
  488. compat_ulong_t __user *nmask,
  489. compat_ulong_t maxnode,
  490. compat_ulong_t addr,
  491. compat_ulong_t flags);
  492. asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
  493. compat_ulong_t maxnode);
  494. asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len,
  495. compat_ulong_t mode,
  496. compat_ulong_t __user *nmask,
  497. compat_ulong_t maxnode, compat_ulong_t flags);
  498. asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
  499. char __user *optval, unsigned int optlen);
  500. asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg,
  501. unsigned flags);
  502. asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
  503. unsigned vlen, unsigned int flags);
  504. asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg,
  505. unsigned int flags);
  506. asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len,
  507. unsigned flags);
  508. asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len,
  509. unsigned flags, struct sockaddr __user *addr,
  510. int __user *addrlen);
  511. asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
  512. unsigned vlen, unsigned int flags,
  513. struct compat_timespec __user *timeout);
  514. asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
  515. struct compat_timespec __user *rmtp);
  516. asmlinkage long compat_sys_getitimer(int which,
  517. struct compat_itimerval __user *it);
  518. asmlinkage long compat_sys_setitimer(int which,
  519. struct compat_itimerval __user *in,
  520. struct compat_itimerval __user *out);
  521. asmlinkage long compat_sys_times(struct compat_tms __user *tbuf);
  522. asmlinkage long compat_sys_setrlimit(unsigned int resource,
  523. struct compat_rlimit __user *rlim);
  524. asmlinkage long compat_sys_getrlimit(unsigned int resource,
  525. struct compat_rlimit __user *rlim);
  526. asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru);
  527. asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
  528. unsigned int len,
  529. compat_ulong_t __user *user_mask_ptr);
  530. asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid,
  531. unsigned int len,
  532. compat_ulong_t __user *user_mask_ptr);
  533. asmlinkage long compat_sys_timer_create(clockid_t which_clock,
  534. struct compat_sigevent __user *timer_event_spec,
  535. timer_t __user *created_timer_id);
  536. asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags,
  537. struct compat_itimerspec __user *new,
  538. struct compat_itimerspec __user *old);
  539. asmlinkage long compat_sys_timer_gettime(timer_t timer_id,
  540. struct compat_itimerspec __user *setting);
  541. asmlinkage long compat_sys_clock_settime(clockid_t which_clock,
  542. struct compat_timespec __user *tp);
  543. asmlinkage long compat_sys_clock_gettime(clockid_t which_clock,
  544. struct compat_timespec __user *tp);
  545. asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock,
  546. struct compat_timex __user *tp);
  547. asmlinkage long compat_sys_clock_getres(clockid_t which_clock,
  548. struct compat_timespec __user *tp);
  549. asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
  550. struct compat_timespec __user *rqtp,
  551. struct compat_timespec __user *rmtp);
  552. asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
  553. struct compat_siginfo __user *uinfo,
  554. struct compat_timespec __user *uts, compat_size_t sigsetsize);
  555. asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset,
  556. compat_size_t sigsetsize);
  557. #ifdef CONFIG_GENERIC_COMPAT_RT_SIGPROCMASK
  558. asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
  559. compat_sigset_t __user *oset,
  560. compat_size_t sigsetsize);
  561. #endif
  562. #ifdef CONFIG_GENERIC_COMPAT_RT_SIGPENDING
  563. asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
  564. compat_size_t sigsetsize);
  565. #endif
  566. #ifndef CONFIG_ODD_RT_SIGACTION
  567. #ifdef CONFIG_GENERIC_COMPAT_RT_SIGACTION
  568. asmlinkage long compat_sys_rt_sigaction(int,
  569. const struct compat_sigaction __user *,
  570. struct compat_sigaction __user *,
  571. compat_size_t);
  572. #endif
  573. #endif
  574. #ifdef CONFIG_GENERIC_COMPAT_RT_SIGQUEUEINFO
  575. asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
  576. struct compat_siginfo __user *uinfo);
  577. #endif
  578. asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
  579. asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
  580. unsigned long arg);
  581. asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
  582. struct compat_timespec __user *utime, u32 __user *uaddr2,
  583. u32 val3);
  584. asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
  585. char __user *optval, int __user *optlen);
  586. asmlinkage long compat_sys_kexec_load(unsigned long entry,
  587. unsigned long nr_segments,
  588. struct compat_kexec_segment __user *,
  589. unsigned long flags);
  590. asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
  591. const struct compat_mq_attr __user *u_mqstat,
  592. struct compat_mq_attr __user *u_omqstat);
  593. asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
  594. const struct compat_sigevent __user *u_notification);
  595. asmlinkage long compat_sys_mq_open(const char __user *u_name,
  596. int oflag, compat_mode_t mode,
  597. struct compat_mq_attr __user *u_attr);
  598. asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes,
  599. const char __user *u_msg_ptr,
  600. size_t msg_len, unsigned int msg_prio,
  601. const struct compat_timespec __user *u_abs_timeout);
  602. asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
  603. char __user *u_msg_ptr,
  604. size_t msg_len, unsigned int __user *u_msg_prio,
  605. const struct compat_timespec __user *u_abs_timeout);
  606. asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
  607. asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args);
  608. extern ssize_t compat_rw_copy_check_uvector(int type,
  609. const struct compat_iovec __user *uvector,
  610. unsigned long nr_segs,
  611. unsigned long fast_segs, struct iovec *fast_pointer,
  612. struct iovec **ret_pointer);
  613. extern void __user *compat_alloc_user_space(unsigned long len);
  614. asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
  615. const struct compat_iovec __user *lvec,
  616. unsigned long liovcnt, const struct compat_iovec __user *rvec,
  617. unsigned long riovcnt, unsigned long flags);
  618. asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
  619. const struct compat_iovec __user *lvec,
  620. unsigned long liovcnt, const struct compat_iovec __user *rvec,
  621. unsigned long riovcnt, unsigned long flags);
  622. asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
  623. compat_off_t __user *offset, compat_size_t count);
  624. #ifdef CONFIG_GENERIC_SIGALTSTACK
  625. asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
  626. compat_stack_t __user *uoss_ptr);
  627. int compat_restore_altstack(const compat_stack_t __user *uss);
  628. int __compat_save_altstack(compat_stack_t __user *, unsigned long);
  629. #endif
  630. asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
  631. struct compat_timespec __user *interval);
  632. #else
  633. #define is_compat_task() (0)
  634. #endif /* CONFIG_COMPAT */
  635. #endif /* _LINUX_COMPAT_H */