compat.h 23 KB

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