aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compat.h
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2011-05-09 13:12:30 -0400
committerChris Metcalf <cmetcalf@tilera.com>2011-05-12 15:51:36 -0400
commitbe84cb43833ee40a42e08f5425d20310f16229c7 (patch)
tree0d5ddbaac88aa99ab5dbd0925ec525d399405fd5 /include/linux/compat.h
parentd2e48c1d4184a0baa4bf09920b63661e0b860b8c (diff)
compat: fixes to allow working with tile arch
The existing <asm-generic/unistd.h> mechanism doesn't really provide enough to create the 64-bit "compat" ABI properly in a generic way, since the compat ABI is a mix of things were you can re-use the 64-bit versions of syscalls and things where you need a compat wrapper. To provide this in the most direct way possible, I added two new macros to go along with the existing __SYSCALL and __SC_3264 macros: __SC_COMP and SC_COMP_3264. These macros take an additional argument, typically a "compat_sys_xxx" function, which is passed to __SYSCALL if you define __SYSCALL_COMPAT when including the header, resulting in a pointer to the compat function being placed in the generated syscall table. The change also adds some missing definitions to <linux/compat.h> so that it actually has declarations for all the compat syscalls, since the "[nr] = ##call" approach requires proper C declarations for all the functions included in the syscall table. Finally, compat.c defines compat_sys_sigpending() and compat_sys_sigprocmask() even if the underlying architecture doesn't request it, which tries to pull in undefined compat_old_sigset_t defines. We need to guard those compat syscall definitions with appropriate __ARCH_WANT_SYS_xxx ifdefs. Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'include/linux/compat.h')
-rw-r--r--include/linux/compat.h187
1 files changed, 187 insertions, 0 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 5778b559d59c..e94184834b71 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -12,6 +12,7 @@
12#include <linux/sem.h> 12#include <linux/sem.h>
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/if.h> 14#include <linux/if.h>
15#include <linux/fs.h>
15 16
16#include <asm/compat.h> 17#include <asm/compat.h>
17#include <asm/siginfo.h> 18#include <asm/siginfo.h>
@@ -209,6 +210,18 @@ struct compat_robust_list_head {
209 compat_uptr_t list_op_pending; 210 compat_uptr_t list_op_pending;
210}; 211};
211 212
213struct compat_statfs;
214struct compat_statfs64;
215struct compat_old_linux_dirent;
216struct compat_linux_dirent;
217struct linux_dirent64;
218struct compat_msghdr;
219struct compat_mmsghdr;
220struct compat_sysinfo;
221struct compat_sysctl_args;
222struct compat_kexec_segment;
223struct compat_mq_attr;
224
212extern void compat_exit_robust_list(struct task_struct *curr); 225extern void compat_exit_robust_list(struct task_struct *curr);
213 226
214asmlinkage long 227asmlinkage long
@@ -331,9 +344,13 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
331 const compat_sigset_t __user *sigmask, 344 const compat_sigset_t __user *sigmask,
332 compat_size_t sigsetsize); 345 compat_size_t sigsetsize);
333 346
347asmlinkage long compat_sys_utime(const char __user *filename,
348 struct compat_utimbuf __user *t);
334asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, 349asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename,
335 struct compat_timespec __user *t, int flags); 350 struct compat_timespec __user *t, int flags);
336 351
352asmlinkage long compat_sys_time(compat_time_t __user *tloc);
353asmlinkage long compat_sys_stime(compat_time_t __user *tptr);
337asmlinkage long compat_sys_signalfd(int ufd, 354asmlinkage long compat_sys_signalfd(int ufd,
338 const compat_sigset_t __user *sigmask, 355 const compat_sigset_t __user *sigmask,
339 compat_size_t sigsetsize); 356 compat_size_t sigsetsize);
@@ -350,11 +367,181 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
350 int flags); 367 int flags);
351asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, 368asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename,
352 struct compat_timeval __user *t); 369 struct compat_timeval __user *t);
370asmlinkage long compat_sys_utimes(const char __user *filename,
371 struct compat_timeval __user *t);
372asmlinkage long compat_sys_newstat(const char __user * filename,
373 struct compat_stat __user *statbuf);
374asmlinkage long compat_sys_newlstat(const char __user * filename,
375 struct compat_stat __user *statbuf);
353asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename, 376asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename,
354 struct compat_stat __user *statbuf, 377 struct compat_stat __user *statbuf,
355 int flag); 378 int flag);
379asmlinkage long compat_sys_newfstat(unsigned int fd,
380 struct compat_stat __user * statbuf);
381asmlinkage long compat_sys_statfs(const char __user *pathname,
382 struct compat_statfs __user *buf);
383asmlinkage long compat_sys_fstatfs(unsigned int fd,
384 struct compat_statfs __user *buf);
385asmlinkage long compat_sys_statfs64(const char __user *pathname,
386 compat_size_t sz,
387 struct compat_statfs64 __user *buf);
388asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
389 struct compat_statfs64 __user *buf);
390asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
391 unsigned long arg);
392asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd,
393 unsigned long arg);
394asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p);
395asmlinkage long compat_sys_io_getevents(aio_context_t ctx_id,
396 unsigned long min_nr,
397 unsigned long nr,
398 struct io_event __user *events,
399 struct compat_timespec __user *timeout);
400asmlinkage long compat_sys_io_submit(aio_context_t ctx_id, int nr,
401 u32 __user *iocb);
402asmlinkage long compat_sys_mount(const char __user * dev_name,
403 const char __user * dir_name,
404 const char __user * type, unsigned long flags,
405 const void __user * data);
406asmlinkage long compat_sys_old_readdir(unsigned int fd,
407 struct compat_old_linux_dirent __user *,
408 unsigned int count);
409asmlinkage long compat_sys_getdents(unsigned int fd,
410 struct compat_linux_dirent __user *dirent,
411 unsigned int count);
412asmlinkage long compat_sys_getdents64(unsigned int fd,
413 struct linux_dirent64 __user * dirent,
414 unsigned int count);
415asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
416 unsigned int nr_segs, unsigned int flags);
417asmlinkage long compat_sys_open(const char __user *filename, int flags,
418 int mode);
356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 419asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
357 int flags, int mode); 420 int flags, int mode);
421asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
422 struct file_handle __user *handle,
423 int flags);
424asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
425 compat_ulong_t __user *outp,
426 compat_ulong_t __user *exp,
427 struct compat_timespec __user *tsp,
428 void __user *sig);
429asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
430 unsigned int nfds,
431 struct compat_timespec __user *tsp,
432 const compat_sigset_t __user *sigmask,
433 compat_size_t sigsetsize);
434#if (defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)) && !defined(CONFIG_NFSD_DEPRECATED)
435union compat_nfsctl_res;
436struct compat_nfsctl_arg;
437asmlinkage long compat_sys_nfsservctl(int cmd,
438 struct compat_nfsctl_arg __user *arg,
439 union compat_nfsctl_res __user *res);
440#else
441long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2);
442#endif
443asmlinkage long compat_sys_signalfd4(int ufd,
444 const compat_sigset_t __user *sigmask,
445 compat_size_t sigsetsize, int flags);
446asmlinkage 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);
451asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
452 compat_ulong_t maxnode);
453asmlinkage 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
458asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
459 char __user *optval, unsigned int optlen);
460asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg,
461 unsigned flags);
462asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg,
463 unsigned int flags);
464asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len,
465 unsigned flags);
466asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len,
467 unsigned flags, struct sockaddr __user *addr,
468 int __user *addrlen);
469asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
470 unsigned vlen, unsigned int flags,
471 struct compat_timespec __user *timeout);
472asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
473 struct compat_timespec __user *rmtp);
474asmlinkage long compat_sys_getitimer(int which,
475 struct compat_itimerval __user *it);
476asmlinkage long compat_sys_setitimer(int which,
477 struct compat_itimerval __user *in,
478 struct compat_itimerval __user *out);
479asmlinkage long compat_sys_times(struct compat_tms __user *tbuf);
480asmlinkage long compat_sys_setrlimit(unsigned int resource,
481 struct compat_rlimit __user *rlim);
482asmlinkage long compat_sys_getrlimit (unsigned int resource,
483 struct compat_rlimit __user *rlim);
484asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru);
485asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
486 unsigned int len,
487 compat_ulong_t __user *user_mask_ptr);
488asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid,
489 unsigned int len,
490 compat_ulong_t __user *user_mask_ptr);
491asmlinkage long compat_sys_timer_create(clockid_t which_clock,
492 struct compat_sigevent __user *timer_event_spec,
493 timer_t __user *created_timer_id);
494asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags,
495 struct compat_itimerspec __user *new,
496 struct compat_itimerspec __user *old);
497asmlinkage long compat_sys_timer_gettime(timer_t timer_id,
498 struct compat_itimerspec __user *setting);
499asmlinkage long compat_sys_clock_settime(clockid_t which_clock,
500 struct compat_timespec __user *tp);
501asmlinkage long compat_sys_clock_gettime(clockid_t which_clock,
502 struct compat_timespec __user *tp);
503asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock,
504 struct compat_timex __user *tp);
505asmlinkage long compat_sys_clock_getres(clockid_t which_clock,
506 struct compat_timespec __user *tp);
507asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
508 struct compat_timespec __user *rqtp,
509 struct compat_timespec __user *rmtp);
510asmlinkage long compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
511 struct compat_siginfo __user *uinfo,
512 struct compat_timespec __user *uts, compat_size_t sigsetsize);
513asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset,
514 compat_size_t sigsetsize);
515asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
516asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
517 unsigned long arg);
518asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
519 struct compat_timespec __user *utime, u32 __user *uaddr2,
520 u32 val3);
521asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
522 char __user *optval, int __user *optlen);
523asmlinkage long compat_sys_kexec_load(unsigned long entry,
524 unsigned long nr_segments,
525 struct compat_kexec_segment __user *,
526 unsigned long flags);
527asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
528 const struct compat_mq_attr __user *u_mqstat,
529 struct compat_mq_attr __user *u_omqstat);
530asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
531 const struct compat_sigevent __user *u_notification);
532asmlinkage long compat_sys_mq_open(const char __user *u_name,
533 int oflag, compat_mode_t mode,
534 struct compat_mq_attr __user *u_attr);
535asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes,
536 const char __user *u_msg_ptr,
537 size_t msg_len, unsigned int msg_prio,
538 const struct compat_timespec __user *u_abs_timeout);
539asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
540 char __user *u_msg_ptr,
541 size_t msg_len, unsigned int __user *u_msg_prio,
542 const struct compat_timespec __user *u_abs_timeout);
543asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
544asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args);
358 545
359extern ssize_t compat_rw_copy_check_uvector(int type, 546extern ssize_t compat_rw_copy_check_uvector(int type,
360 const struct compat_iovec __user *uvector, unsigned long nr_segs, 547 const struct compat_iovec __user *uvector, unsigned long nr_segs,