switch getrusage() to COMPAT_SYSCALL_DEFINE
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 3 Mar 2013 17:49:06 +0000 (12:49 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 4 Mar 2013 03:59:36 +0000 (22:59 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/syscalls.S
arch/sparc/kernel/sys32.S
arch/sparc/kernel/systbls_64.S
kernel/compat.c
kernel/sys.c

index 52bea71d93e63153937cdf52e00f42507a14165f..cee31d7910c0162e634e58acf98aab82c901a075 100644 (file)
@@ -258,11 +258,6 @@ ENTRY(sys32_mmap2_wrapper)
        llgtr   %r2,%r2                 # struct mmap_arg_struct_emu31 *
        jg      sys32_mmap2                     # branch to system call
 
-ENTRY(compat_sys_getrusage_wrapper)
-       lgfr    %r2,%r2                 # int
-       llgtr   %r3,%r3                 # struct rusage_emu31 *
-       jg      compat_sys_getrusage    # branch to system call
-
 ENTRY(compat_sys_gettimeofday_wrapper)
        llgtr   %r2,%r2                 # struct timeval_emu31 *
        llgtr   %r3,%r3                 # struct timezone *
index 63d6b43431936350af22f1cb0a5f9d5cd303c5b8..e9c8a88c748e25354b2d013e9843d478b8d93927 100644 (file)
@@ -85,7 +85,7 @@ SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper)
 SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper)
 SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper)      /* 75 */
 SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper)
-SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage_wrapper)
+SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage)
 SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday_wrapper)
 SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday_wrapper)
 SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper)      /* 80 old getgroups16 syscall */
index 6c65d69c6635eaf85674eadb0d356338c45732ff..0b4030aff2f841f6c36367997951270d2c51c48c 100644 (file)
@@ -36,7 +36,6 @@ STUB: sra     REG1, 0, REG1; \
        jmpl    %g1 + %lo(SYSCALL), %g0; \
        sra     REG3, 0, REG3
 
-SIGN1(sys32_getrusage, compat_sys_getrusage, %o0)
 SIGN1(sys32_readahead, compat_sys_readahead, %o0)
 SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4)
 SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5)
index a1444d0d08eec7e69e50778e627e2d990e0572e9..423a4e2a77f7a81db6fa894b813e68d376281575 100644 (file)
@@ -41,7 +41,7 @@ sys_call_table32:
 /*100*/ .word sys_getpriority, sys32_rt_sigreturn, compat_sys_rt_sigaction, compat_sys_rt_sigprocmask, compat_sys_rt_sigpending
        .word compat_sys_rt_sigtimedwait, compat_sys_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid
 /*110*/        .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall
-       .word sys_getgroups, compat_sys_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd
+       .word sys_getgroups, compat_sys_gettimeofday, compat_sys_getrusage, sys_nis_syscall, sys_getcwd
 /*120*/        .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod
        .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, compat_sys_truncate
 /*130*/        .word compat_sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall
index 19971d8c72993af7f322767df7f21bdc33fd36bb..c5620d6435e07d5b7b4b9b1024241f22c6b05650 100644 (file)
@@ -516,25 +516,6 @@ int put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru)
        return 0;
 }
 
-asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
-{
-       struct rusage r;
-       int ret;
-       mm_segment_t old_fs = get_fs();
-
-       set_fs(KERNEL_DS);
-       ret = sys_getrusage(who, (struct rusage __user *) &r);
-       set_fs(old_fs);
-
-       if (ret)
-               return ret;
-
-       if (put_compat_rusage(&r, ru))
-               return -EFAULT;
-
-       return 0;
-}
-
 COMPAT_SYSCALL_DEFINE4(wait4,
        compat_pid_t, pid,
        compat_uint_t __user *, stat_addr,
index 81f56445fba949790b34b7bf3f97383555134672..fd2b5259ad7a75b517dec1628df412ea4cf8e798 100644 (file)
@@ -1784,6 +1784,20 @@ SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
        return getrusage(current, who, ru);
 }
 
+#ifdef CONFIG_COMPAT
+COMPAT_SYSCALL_DEFINE2(getrusage, int, who, struct compat_rusage __user *, ru)
+{
+       struct rusage r;
+
+       if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
+           who != RUSAGE_THREAD)
+               return -EINVAL;
+
+       k_getrusage(current, who, &r);
+       return put_compat_rusage(&r, ru);
+}
+#endif
+
 SYSCALL_DEFINE1(umask, int, mask)
 {
        mask = xchg(&current->fs->umask, mask & S_IRWXUGO);