diff options
author | Christoph Hellwig <hch@lst.de> | 2008-10-16 01:02:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:33 -0400 |
commit | b418da16dd44810e5d5a22bba377cca80512a524 (patch) | |
tree | 20ac32ea027bb8d978a22fbfaf6580fd34518aa5 /arch/sparc64 | |
parent | f7a5000f7a8924e9c5fad1801616601d6dc65a17 (diff) |
compat: generic compat get/settimeofday
Nothing arch specific in get/settimeofday. The details of the timeval
conversion varied a little from arch to arch, but all with the same
results.
Also add an extern declaration for sys_tz to linux/time.h because externs
in .c files are fowned upon. I'll kill the externs in various other files
in a sparate patch.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: David S. Miller <davem@davemloft.net> [ sparc bits ]
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/sys_sparc32.c | 62 | ||||
-rw-r--r-- | arch/sparc64/kernel/systbls.S | 4 |
2 files changed, 2 insertions, 64 deletions
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index 73a33dc3bcca..e800503879e4 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c | |||
@@ -58,15 +58,6 @@ | |||
58 | #include <asm/mmu_context.h> | 58 | #include <asm/mmu_context.h> |
59 | #include <asm/compat_signal.h> | 59 | #include <asm/compat_signal.h> |
60 | 60 | ||
61 | /* 32-bit timeval and related flotsam. */ | ||
62 | |||
63 | static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i) | ||
64 | { | ||
65 | return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || | ||
66 | (__put_user(i->tv_sec, &o->tv_sec) | | ||
67 | __put_user(i->tv_usec, &o->tv_usec))); | ||
68 | } | ||
69 | |||
70 | #ifdef CONFIG_SYSVIPC | 61 | #ifdef CONFIG_SYSVIPC |
71 | asmlinkage long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, u32 fifth) | 62 | asmlinkage long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, u32 fifth) |
72 | { | 63 | { |
@@ -487,59 +478,6 @@ asmlinkage long sys32_delete_module(const char __user *name_user) | |||
487 | 478 | ||
488 | #endif /* CONFIG_MODULES */ | 479 | #endif /* CONFIG_MODULES */ |
489 | 480 | ||
490 | /* Translations due to time_t size differences. Which affects all | ||
491 | sorts of things, like timeval and itimerval. */ | ||
492 | |||
493 | extern struct timezone sys_tz; | ||
494 | |||
495 | asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, | ||
496 | struct timezone __user *tz) | ||
497 | { | ||
498 | if (tv) { | ||
499 | struct timeval ktv; | ||
500 | do_gettimeofday(&ktv); | ||
501 | if (put_tv32(tv, &ktv)) | ||
502 | return -EFAULT; | ||
503 | } | ||
504 | if (tz) { | ||
505 | if (copy_to_user(tz, &sys_tz, sizeof(sys_tz))) | ||
506 | return -EFAULT; | ||
507 | } | ||
508 | return 0; | ||
509 | } | ||
510 | |||
511 | static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i) | ||
512 | { | ||
513 | long usec; | ||
514 | |||
515 | if (!access_ok(VERIFY_READ, i, sizeof(*i))) | ||
516 | return -EFAULT; | ||
517 | if (__get_user(o->tv_sec, &i->tv_sec)) | ||
518 | return -EFAULT; | ||
519 | if (__get_user(usec, &i->tv_usec)) | ||
520 | return -EFAULT; | ||
521 | o->tv_nsec = usec * 1000; | ||
522 | return 0; | ||
523 | } | ||
524 | |||
525 | asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, | ||
526 | struct timezone __user *tz) | ||
527 | { | ||
528 | struct timespec kts; | ||
529 | struct timezone ktz; | ||
530 | |||
531 | if (tv) { | ||
532 | if (get_ts32(&kts, tv)) | ||
533 | return -EFAULT; | ||
534 | } | ||
535 | if (tz) { | ||
536 | if (copy_from_user(&ktz, tz, sizeof(ktz))) | ||
537 | return -EFAULT; | ||
538 | } | ||
539 | |||
540 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); | ||
541 | } | ||
542 | |||
543 | asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, | 481 | asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, |
544 | char __user *ubuf, | 482 | char __user *ubuf, |
545 | compat_size_t count, | 483 | compat_size_t count, |
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index 5daee4b04dd5..b2fa4c163638 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S | |||
@@ -41,8 +41,8 @@ sys_call_table32: | |||
41 | /*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending | 41 | /*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending |
42 | .word compat_sys_rt_sigtimedwait, sys32_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid | 42 | .word compat_sys_rt_sigtimedwait, sys32_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid |
43 | /*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall | 43 | /*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall |
44 | .word sys32_getgroups, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd | 44 | .word sys32_getgroups, compat_sys_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd |
45 | /*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys_fchown16, sys_fchmod | 45 | /*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod |
46 | .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, sys_truncate | 46 | .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, sys_truncate |
47 | /*130*/ .word sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall | 47 | /*130*/ .word sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall |
48 | .word sys_nis_syscall, sys32_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64 | 48 | .word sys_nis_syscall, sys32_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64 |