]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
times(2): move compat to native
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 31 May 2017 08:22:44 +0000 (04:22 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 10 Jun 2017 03:51:28 +0000 (23:51 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
include/linux/time.h
kernel/compat.c
kernel/sys.c

index c0543f5f25de471594330d84d605c6f20ef4c565..f769ea88250da95b69661d8fb0a8d64e14ad7dbc 100644 (file)
@@ -171,9 +171,6 @@ extern int do_getitimer(int which, struct itimerval *value);
 
 extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
 
-struct tms;
-extern void do_sys_times(struct tms *);
-
 /*
  * Similar to the struct tm in userspace <time.h>, but it needs to be here so
  * that the kernel source is self contained.
index 9c2a8f3788d5e13e1de588c57040b4348419f05d..99408252762e2f8c3de2b22bb1ac51432096e27a 100644 (file)
@@ -350,30 +350,6 @@ COMPAT_SYSCALL_DEFINE3(setitimer, int, which,
        return 0;
 }
 
-static compat_clock_t clock_t_to_compat_clock_t(clock_t x)
-{
-       return compat_jiffies_to_clock_t(clock_t_to_jiffies(x));
-}
-
-COMPAT_SYSCALL_DEFINE1(times, struct compat_tms __user *, tbuf)
-{
-       if (tbuf) {
-               struct tms tms;
-               struct compat_tms tmp;
-
-               do_sys_times(&tms);
-               /* Convert our struct tms to the compat version. */
-               tmp.tms_utime = clock_t_to_compat_clock_t(tms.tms_utime);
-               tmp.tms_stime = clock_t_to_compat_clock_t(tms.tms_stime);
-               tmp.tms_cutime = clock_t_to_compat_clock_t(tms.tms_cutime);
-               tmp.tms_cstime = clock_t_to_compat_clock_t(tms.tms_cstime);
-               if (copy_to_user(tbuf, &tmp, sizeof(tmp)))
-                       return -EFAULT;
-       }
-       force_successful_syscall_return();
-       return compat_jiffies_to_clock_t(jiffies);
-}
-
 #ifdef __ARCH_WANT_SYS_SIGPENDING
 
 /*
index 3778a8a417b6067bfb5e9f8a0d9a359b20549691..161b5eae9c77f4297770614091ff80270ba6a630 100644 (file)
@@ -886,7 +886,7 @@ SYSCALL_DEFINE0(getegid)
        return from_kgid_munged(current_user_ns(), current_egid());
 }
 
-void do_sys_times(struct tms *tms)
+static void do_sys_times(struct tms *tms)
 {
        u64 tgutime, tgstime, cutime, cstime;
 
@@ -912,6 +912,32 @@ SYSCALL_DEFINE1(times, struct tms __user *, tbuf)
        return (long) jiffies_64_to_clock_t(get_jiffies_64());
 }
 
+#ifdef CONFIG_COMPAT
+static compat_clock_t clock_t_to_compat_clock_t(clock_t x)
+{
+       return compat_jiffies_to_clock_t(clock_t_to_jiffies(x));
+}
+
+COMPAT_SYSCALL_DEFINE1(times, struct compat_tms __user *, tbuf)
+{
+       if (tbuf) {
+               struct tms tms;
+               struct compat_tms tmp;
+
+               do_sys_times(&tms);
+               /* Convert our struct tms to the compat version. */
+               tmp.tms_utime = clock_t_to_compat_clock_t(tms.tms_utime);
+               tmp.tms_stime = clock_t_to_compat_clock_t(tms.tms_stime);
+               tmp.tms_cutime = clock_t_to_compat_clock_t(tms.tms_cutime);
+               tmp.tms_cstime = clock_t_to_compat_clock_t(tms.tms_cstime);
+               if (copy_to_user(tbuf, &tmp, sizeof(tmp)))
+                       return -EFAULT;
+       }
+       force_successful_syscall_return();
+       return compat_jiffies_to_clock_t(jiffies);
+}
+#endif
+
 /*
  * This needs some heavy checking ...
  * I just haven't the stomach for it. I also don't fully