compat.h 25 KB

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