]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Add generic sys_old_select()
authorChristoph Hellwig <hch@lst.de>
Wed, 10 Mar 2010 23:21:13 +0000 (15:21 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 12 Mar 2010 23:52:32 +0000 (15:52 -0800)
Add a generic implementation of the old select() syscall, which expects
its argument in a memory block and switch all architectures over to use
it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: James Morris <jmorris@namei.org>
Acked-by: Andreas Schwab <schwab@linux-m68k.org>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: David Howells <dhowells@redhat.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27 files changed:
arch/arm/include/asm/unistd.h
arch/arm/kernel/calls.S
arch/arm/kernel/sys_arm.c
arch/h8300/include/asm/unistd.h
arch/h8300/kernel/sys_h8300.c
arch/h8300/kernel/syscalls.S
arch/m68k/include/asm/unistd.h
arch/m68k/kernel/entry.S
arch/m68k/kernel/sys_m68k.c
arch/m68knommu/kernel/sys_m68k.c
arch/m68knommu/kernel/syscalltable.S
arch/mn10300/include/asm/unistd.h
arch/mn10300/kernel/entry.S
arch/mn10300/kernel/sys_mn10300.c
arch/s390/kernel/entry.h
arch/um/sys-i386/syscalls.c
arch/x86/ia32/ia32entry.S
arch/x86/ia32/sys_ia32.c
arch/x86/include/asm/sys_ia32.h
arch/x86/include/asm/syscalls.h
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/sys_i386_32.c
arch/x86/kernel/syscall_table_32.S
fs/compat.c
fs/select.c
include/linux/compat.h
include/linux/syscalls.h

index cf9cdaa2d4d440c08b83e3e25acdb3b3bb32e412..e18500d305ba104ab764bcd1060c975396f9a93c 100644 (file)
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_RT_SIGACTION
 #define __ARCH_WANT_SYS_RT_SIGSUSPEND
+#define __ARCH_WANT_SYS_OLD_SELECT
 
 #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
 #define __ARCH_WANT_SYS_TIME
index 9314a2d681f15a299e614842c37eb97f694dbd23..7671e9a7544996d9bb1c6d159d9ffb5d85decc74 100644 (file)
@@ -91,7 +91,7 @@
                CALL(sys_settimeofday)
 /* 80 */       CALL(sys_getgroups16)
                CALL(sys_setgroups16)
-               CALL(OBSOLETE(old_select))      /* used by libc4 */
+               CALL(OBSOLETE(sys_old_select))  /* used by libc4 */
                CALL(sys_symlink)
                CALL(sys_ni_syscall)            /* was sys_lstat */
 /* 85 */       CALL(sys_readlink)
index ae4027bd01bd3f921d54d558a640d0ef9bbe8c23..e59cddedcbbaa5e80886ee39cf8a465020412bff 100644 (file)
@@ -54,27 +54,6 @@ out:
        return error;
 }
 
-/*
- * Perform the select(nd, in, out, ex, tv) and mmap() system
- * calls.
- */
-
-struct sel_arg_struct {
-       unsigned long n;
-       fd_set __user *inp, *outp, *exp;
-       struct timeval __user *tvp;
-};
-
-asmlinkage int old_select(struct sel_arg_struct __user *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
-       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-}
-
 #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
index 99f3c3561ecba1f0004ba7180a3585a9c80641a3..3bea0b3eb24f08763f4ae2a090639ec26c8e4630 100644 (file)
 #define __ARCH_WANT_SYS_LLSEEK
 #define __ARCH_WANT_SYS_NICE
 #define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLD_SELECT
 #define __ARCH_WANT_SYS_OLDUMOUNT
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
index b5969db0ca10fbe401dd5977b86482b59ba21b0e..e9a3ecf90c9c83247a28ec6988c3009f5ac80b17 100644 (file)
@@ -60,22 +60,6 @@ out:
        return error;
 }
 
-struct sel_arg_struct {
-       unsigned long n;
-       fd_set *inp, *outp, *exp;
-       struct timeval *tvp;
-};
-
-asmlinkage int old_select(struct sel_arg_struct *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
-       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-}
-
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
  *
index 2d69881eda6ade4e9666500aeb110f7776d209a1..fe5ae20e60c547fca682d8ab95d554379d16f3a7 100644 (file)
@@ -96,7 +96,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
        .long SYMBOL_NAME(sys_settimeofday)
        .long SYMBOL_NAME(sys_getgroups16)      /* 80 */
        .long SYMBOL_NAME(sys_setgroups16)
-       .long SYMBOL_NAME(old_select)
+       .long SYMBOL_NAME(sys_old_select)
        .long SYMBOL_NAME(sys_symlink)
        .long SYMBOL_NAME(sys_lstat)
        .long SYMBOL_NAME(sys_readlink)         /* 85 */
index d72a71dabecb128e91f1e5bd0fa489504b274750..1582c2db1c86c7f69663151f61e6d5dfe387cce4 100644 (file)
 #define __ARCH_WANT_SYS_LLSEEK
 #define __ARCH_WANT_SYS_NICE
 #define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLD_SELECT
 #define __ARCH_WANT_SYS_OLDUMOUNT
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
index e136b8cbe9b9ad1782f03ebd1809f02c0df37d36..09b1f09be3a6abb32aaa161859d98d6f0f71f469 100644 (file)
@@ -510,7 +510,7 @@ sys_call_table:
        .long sys_settimeofday
        .long sys_getgroups16   /* 80 */
        .long sys_setgroups16
-       .long old_select
+       .long sys_old_select
        .long sys_symlink
        .long sys_lstat
        .long sys_readlink      /* 85 */
index e3ad2d6719736fb123f062bea7ffeb4a946b5725..03b58dd86c7afdf365373aac259680c416d48551 100644 (file)
@@ -80,22 +80,6 @@ out:
        return error;
 }
 
-struct sel_arg_struct {
-       unsigned long n;
-       fd_set __user *inp, *outp, *exp;
-       struct timeval __user *tvp;
-};
-
-asmlinkage int old_select(struct sel_arg_struct __user *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
-       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-}
-
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
  *
index 923dd4aab8758378489d78c91cb11d37151335c8..e0d3f13e77a89dbfb90d23cfff1745fbae0cff41 100644 (file)
@@ -61,22 +61,6 @@ out:
        return error;
 }
 
-struct sel_arg_struct {
-       unsigned long n;
-       fd_set *inp, *outp, *exp;
-       struct timeval *tvp;
-};
-
-asmlinkage int old_select(struct sel_arg_struct *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
-       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-}
-
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
  *
index 56dd01ded148c09a1ee3751873db9e407ea4d336..405738351700ade7754f1193d0e0bfaee25a0caa 100644 (file)
@@ -100,7 +100,7 @@ ENTRY(sys_call_table)
        .long sys_settimeofday
        .long sys_getgroups16   /* 80 */
        .long sys_setgroups16
-       .long old_select
+       .long sys_old_select
        .long sys_symlink
        .long sys_lstat
        .long sys_readlink      /* 85 */
index c05acb95c2a9385b392502c300d4338f208ba88f..d13a56e99bad8832818d11bf6c62f3a66e76f393 100644 (file)
 #define __ARCH_WANT_SYS_LLSEEK
 #define __ARCH_WANT_SYS_NICE
 #define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLD_SELECT
 #define __ARCH_WANT_SYS_OLDUMOUNT
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
index 88e3e1c3cc217eb44176aa315266c04c818fda5f..d9ed5a15c547f8800f16080e6699c1ad131d5d2c 100644 (file)
@@ -468,7 +468,7 @@ ENTRY(sys_call_table)
        .long sys_settimeofday
        .long sys_getgroups16   /* 80 */
        .long sys_setgroups16
-       .long old_select
+       .long sys_old_select
        .long sys_symlink
        .long sys_lstat
        .long sys_readlink      /* 85 */
index 17cc6ce04e840f136cd18e2a569e957697c10cd2..bef69d6daf1519ffe6fca340d070089d0aaf52e1 100644 (file)
@@ -32,24 +32,6 @@ asmlinkage long old_mmap(unsigned long addr, unsigned long len,
        return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
 }
 
-struct sel_arg_struct {
-       unsigned long n;
-       fd_set *inp;
-       fd_set *outp;
-       fd_set *exp;
-       struct timeval *tvp;
-};
-
-asmlinkage int old_select(struct sel_arg_struct __user *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
-       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-}
-
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
  *
index e1e5e767ab56d1499e46aed54f420f218d7fa3aa..9905a0cacf93b97f462004629d6b2a1d6f11faae 100644 (file)
@@ -28,7 +28,6 @@ struct new_utsname;
 struct mmap_arg_struct;
 struct fadvise64_64_args;
 struct old_sigaction;
-struct sel_arg_struct;
 
 long sys_mmap2(struct mmap_arg_struct __user  *arg);
 long sys_s390_old_mmap(struct mmap_arg_struct __user *arg);
index 857ca0b3bdef136a78b7eb59a00b2de4a14b6aed..0e49d2a20c17db7d29715a02adc8229670df460a 100644 (file)
@@ -44,24 +44,6 @@ long old_mmap_i386(struct mmap_arg_struct __user *arg)
        return err;
 }
 
-struct sel_arg_struct {
-       unsigned long n;
-       fd_set __user *inp;
-       fd_set __user *outp;
-       fd_set __user *exp;
-       struct timeval __user *tvp;
-};
-
-long old_select(struct sel_arg_struct __user *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
-       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-}
-
 /*
  * The prototype on i386 is:
  *
index 53147ad85b967018e2f164de0cca11c00e04dbf9..34f821802c23aca3fc6ea03951df045675359fbc 100644 (file)
@@ -586,7 +586,7 @@ ia32_sys_call_table:
        .quad compat_sys_settimeofday
        .quad sys_getgroups16   /* 80 */
        .quad sys_setgroups16
-       .quad sys32_old_select
+       .quad compat_sys_old_select
        .quad sys_symlink
        .quad sys_lstat
        .quad sys_readlink              /* 85 */
index 422572c7792389d0174fbc2933aba31d34111d88..cb80816e7a16f3b8602d6d1f7d67c67fef14e508 100644 (file)
@@ -332,24 +332,6 @@ asmlinkage long sys32_alarm(unsigned int seconds)
        return alarm_setitimer(seconds);
 }
 
-struct sel_arg_struct {
-       unsigned int n;
-       unsigned int inp;
-       unsigned int outp;
-       unsigned int exp;
-       unsigned int tvp;
-};
-
-asmlinkage long sys32_old_select(struct sel_arg_struct __user *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       return compat_sys_select(a.n, compat_ptr(a.inp), compat_ptr(a.outp),
-                                compat_ptr(a.exp), compat_ptr(a.tvp));
-}
-
 asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr,
                              int options)
 {
index d5f69045c100947290cb19f3d74afd8410464f2b..b26fc750e416bd1232d284a13fd76c345c6c97dc 100644 (file)
@@ -40,8 +40,6 @@ asmlinkage long sys32_rt_sigprocmask(int, compat_sigset_t __user *,
                                     compat_sigset_t __user *, unsigned int);
 asmlinkage long sys32_alarm(unsigned int);
 
-struct sel_arg_struct;
-asmlinkage long sys32_old_select(struct sel_arg_struct __user *);
 asmlinkage long sys32_waitpid(compat_pid_t, unsigned int *, int);
 asmlinkage long sys32_sysfs(int, u32, u32);
 
index 8868b9420b0ea5ca67e2174812d4dceb86e5c5f7..8406d06c118d15795dfd2b674bf368683d5aab5d 100644 (file)
@@ -52,12 +52,10 @@ unsigned long sys_sigreturn(struct pt_regs *);
 
 /* kernel/sys_i386_32.c */
 struct mmap_arg_struct;
-struct sel_arg_struct;
 struct oldold_utsname;
 struct old_utsname;
 
 asmlinkage int old_mmap(struct mmap_arg_struct __user *);
-asmlinkage int old_select(struct sel_arg_struct __user *);
 asmlinkage int sys_ipc(uint, int, int, int, void __user *, long);
 asmlinkage int sys_uname(struct old_utsname __user *);
 asmlinkage int sys_olduname(struct oldold_utsname __user *);
index 3baf379fa8402a0df08a1ea6ab7f388e3fdac081..4eb2667b54aef5276139c9cebb5a2c725e6ba54b 100644 (file)
 #define __ARCH_WANT_SYS_LLSEEK
 #define __ARCH_WANT_SYS_NICE
 #define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLD_SELECT
 #define __ARCH_WANT_SYS_OLDUMOUNT
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
index dee1ff7cba581829b6540b436dbbff4b5958ff4f..345dbd19a2b31c2118d53d70b393fed1511aa807 100644 (file)
@@ -58,23 +58,6 @@ out:
        return err;
 }
 
-
-struct sel_arg_struct {
-       unsigned long n;
-       fd_set __user *inp, *outp, *exp;
-       struct timeval __user *tvp;
-};
-
-asmlinkage int old_select(struct sel_arg_struct __user *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
-       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-}
-
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
  *
index 15228b5d3eb7bf6c75954095f1c73677bc096ca7..4d10abacecdbc8b165130466c46c6e54eaca1514 100644 (file)
@@ -81,7 +81,7 @@ ENTRY(sys_call_table)
        .long sys_settimeofday
        .long sys_getgroups16   /* 80 */
        .long sys_setgroups16
-       .long old_select
+       .long sys_old_select
        .long sys_symlink
        .long sys_lstat
        .long sys_readlink      /* 85 */
index 00d90c2e66f0cf531eced73b49c0c5e10a02829e..030602d453b76a0a371880a63990a08cd17fd5b0 100644 (file)
@@ -1795,6 +1795,24 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
        return ret;
 }
 
+struct compat_sel_arg_struct {
+       compat_ulong_t n;
+       compat_uptr_t inp;
+       compat_uptr_t outp;
+       compat_uptr_t exp;
+       compat_uptr_t tvp;
+};
+
+asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg)
+{
+       struct compat_sel_arg_struct a;
+
+       if (copy_from_user(&a, arg, sizeof(a)))
+               return -EFAULT;
+       return compat_sys_select(a.n, compat_ptr(a.inp), compat_ptr(a.outp),
+                                compat_ptr(a.exp), compat_ptr(a.tvp));
+}
+
 #ifdef HAVE_SET_RESTORE_SIGMASK
 static long do_compat_pselect(int n, compat_ulong_t __user *inp,
        compat_ulong_t __user *outp, compat_ulong_t __user *exp,
index 73715e90030f0c78059c98c6a4e0abf6b8a04ffa..500a669f779016eb33a4e570805285d6d44e7af2 100644 (file)
@@ -691,6 +691,23 @@ SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
 }
 #endif /* HAVE_SET_RESTORE_SIGMASK */
 
+#ifdef __ARCH_WANT_SYS_OLD_SELECT
+struct sel_arg_struct {
+       unsigned long n;
+       fd_set __user *inp, *outp, *exp;
+       struct timeval __user *tvp;
+};
+
+SYSCALL_DEFINE1(old_select, struct sel_arg_struct __user *, arg)
+{
+       struct sel_arg_struct a;
+
+       if (copy_from_user(&a, arg, sizeof(a)))
+               return -EFAULT;
+       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
+}
+#endif
+
 struct poll_list {
        struct poll_list *next;
        int len;
index ef68119a4fd2ffd28444dba7ca97d551ab563222..717c691ecd8e3acd03c51d9d8f42efc2ec489af9 100644 (file)
@@ -23,6 +23,7 @@
 typedef __compat_uid32_t       compat_uid_t;
 typedef __compat_gid32_t       compat_gid_t;
 
+struct compat_sel_arg_struct;
 struct rusage;
 
 struct compat_itimerspec { 
@@ -249,6 +250,8 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
                compat_ulong_t __user *outp, compat_ulong_t __user *exp,
                struct compat_timeval __user *tvp);
 
+asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg);
+
 asmlinkage long compat_sys_wait4(compat_pid_t pid,
                                 compat_uint_t __user *stat_addr, int options,
                                 struct compat_rusage __user *ru);
index 8126f239edf08410cedc96c0638a5d4f1c3168b5..85a9f21fe11a6626d8be998baf15e2d60ad98485 100644 (file)
@@ -34,6 +34,7 @@ struct pollfd;
 struct rlimit;
 struct rusage;
 struct sched_param;
+struct sel_arg_struct;
 struct semaphore;
 struct sembuf;
 struct shmid_ds;
@@ -638,6 +639,7 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
                                long timeout);
 asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
                        fd_set __user *exp, struct timeval __user *tvp);
+asmlinkage long sys_old_select(struct sel_arg_struct __user *arg);
 asmlinkage long sys_epoll_create(int size);
 asmlinkage long sys_epoll_create1(int flags);
 asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,