aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-03 12:49:06 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-03-03 22:59:36 -0500
commit8d2d5c4a251924e4f70657e96a2a3f87647544f0 (patch)
treeada470f9738d49bfc2d55cb01f8c62188ce8ae12 /kernel
parent35280bd4a3fa841897e2638437607fdec6c34f31 (diff)
switch getrusage() to COMPAT_SYSCALL_DEFINE
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/compat.c19
-rw-r--r--kernel/sys.c14
2 files changed, 14 insertions, 19 deletions
diff --git a/kernel/compat.c b/kernel/compat.c
index 19971d8c7299..c5620d6435e0 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -516,25 +516,6 @@ int put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru)
516 return 0; 516 return 0;
517} 517}
518 518
519asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
520{
521 struct rusage r;
522 int ret;
523 mm_segment_t old_fs = get_fs();
524
525 set_fs(KERNEL_DS);
526 ret = sys_getrusage(who, (struct rusage __user *) &r);
527 set_fs(old_fs);
528
529 if (ret)
530 return ret;
531
532 if (put_compat_rusage(&r, ru))
533 return -EFAULT;
534
535 return 0;
536}
537
538COMPAT_SYSCALL_DEFINE4(wait4, 519COMPAT_SYSCALL_DEFINE4(wait4,
539 compat_pid_t, pid, 520 compat_pid_t, pid,
540 compat_uint_t __user *, stat_addr, 521 compat_uint_t __user *, stat_addr,
diff --git a/kernel/sys.c b/kernel/sys.c
index 81f56445fba9..fd2b5259ad7a 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1784,6 +1784,20 @@ SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
1784 return getrusage(current, who, ru); 1784 return getrusage(current, who, ru);
1785} 1785}
1786 1786
1787#ifdef CONFIG_COMPAT
1788COMPAT_SYSCALL_DEFINE2(getrusage, int, who, struct compat_rusage __user *, ru)
1789{
1790 struct rusage r;
1791
1792 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
1793 who != RUSAGE_THREAD)
1794 return -EINVAL;
1795
1796 k_getrusage(current, who, &r);
1797 return put_compat_rusage(&r, ru);
1798}
1799#endif
1800
1787SYSCALL_DEFINE1(umask, int, mask) 1801SYSCALL_DEFINE1(umask, int, mask)
1788{ 1802{
1789 mask = xchg(&current->fs->umask, mask & S_IRWXUGO); 1803 mask = xchg(&current->fs->umask, mask & S_IRWXUGO);