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