compat.h 26 KB

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