Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] x86_64: Use common sys_time64

Keeping this function does not makes sense because it's a copied (and
buggy) copy of sys_time. The only difference is that now.tv_sec (which is
a time_t, i.e. a 64-bit long) is copied (and truncated) into a int
(32-bit).

The prototype is the same (they both take a long __user *), so let's drop
this and redirect it to sys_time (and make sure it exists by defining
__ARCH_WANT_SYS_TIME).

Only disadvantage is that the sys_stime definition is also compiled (may be
fixed if needed by adding a separate __ARCH_WANT_SYS_STIME macro, and
defining it for all arch's defining __ARCH_WANT_SYS_TIME except x86_64).

Acked-by: Andi Kleen <ak@suse.de>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Paolo 'Blaisorblade' Giarrusso and committed by
Linus Torvalds
efbbdce9 bf0f2e23

+2 -15
-14
arch/x86_64/kernel/sys_x86_64.c
··· 154 154 err |= copy_to_user(&name->machine, "i686", 5); 155 155 return err ? -EFAULT : 0; 156 156 } 157 - 158 - asmlinkage long sys_time64(long __user * tloc) 159 - { 160 - struct timeval now; 161 - int i; 162 - 163 - do_gettimeofday(&now); 164 - i = now.tv_sec; 165 - if (tloc) { 166 - if (put_user(i,tloc)) 167 - i = -EFAULT; 168 - } 169 - return i; 170 - }
+2 -1
include/asm-x86_64/unistd.h
··· 462 462 #define __NR_tkill 200 463 463 __SYSCALL(__NR_tkill, sys_tkill) 464 464 #define __NR_time 201 465 - __SYSCALL(__NR_time, sys_time64) 465 + __SYSCALL(__NR_time, sys_time) 466 466 #define __NR_futex 202 467 467 __SYSCALL(__NR_futex, sys_futex) 468 468 #define __NR_sched_setaffinity 203 ··· 608 608 #define __ARCH_WANT_SYS_SIGPENDING 609 609 #define __ARCH_WANT_SYS_SIGPROCMASK 610 610 #define __ARCH_WANT_SYS_RT_SIGACTION 611 + #define __ARCH_WANT_SYS_TIME 611 612 #define __ARCH_WANT_COMPAT_SYS_TIME 612 613 #endif 613 614