aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-10-16 01:02:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:33 -0400
commitb418da16dd44810e5d5a22bba377cca80512a524 (patch)
tree20ac32ea027bb8d978a22fbfaf6580fd34518aa5 /arch/s390/kernel
parentf7a5000f7a8924e9c5fad1801616601d6dc65a17 (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/s390/kernel')
-rw-r--r--arch/s390/kernel/compat_linux.c67
-rw-r--r--arch/s390/kernel/compat_linux.h4
-rw-r--r--arch/s390/kernel/compat_wrapper.S12
-rw-r--r--arch/s390/kernel/syscalls.S4
4 files changed, 8 insertions, 79 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 9b471d785ec1..4646382af34f 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -279,22 +279,6 @@ asmlinkage long sys32_getegid16(void)
279 return high2lowgid(current->egid); 279 return high2lowgid(current->egid);
280} 280}
281 281
282/* 32-bit timeval and related flotsam. */
283
284static inline long get_tv32(struct timeval *o, struct compat_timeval __user *i)
285{
286 return (!access_ok(VERIFY_READ, o, sizeof(*o)) ||
287 (__get_user(o->tv_sec, &i->tv_sec) ||
288 __get_user(o->tv_usec, &i->tv_usec)));
289}
290
291static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
292{
293 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
294 (__put_user(i->tv_sec, &o->tv_sec) ||
295 __put_user(i->tv_usec, &o->tv_usec)));
296}
297
298/* 282/*
299 * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation. 283 * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation.
300 * 284 *
@@ -522,57 +506,6 @@ sys32_delete_module(const char __user *name_user, unsigned int flags)
522 506
523#endif /* CONFIG_MODULES */ 507#endif /* CONFIG_MODULES */
524 508
525/* Translations due to time_t size differences. Which affects all
526 sorts of things, like timeval and itimerval. */
527
528extern struct timezone sys_tz;
529
530asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
531{
532 if (tv) {
533 struct timeval ktv;
534 do_gettimeofday(&ktv);
535 if (put_tv32(tv, &ktv))
536 return -EFAULT;
537 }
538 if (tz) {
539 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
540 return -EFAULT;
541 }
542 return 0;
543}
544
545static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
546{
547 long usec;
548
549 if (!access_ok(VERIFY_READ, i, sizeof(*i)))
550 return -EFAULT;
551 if (__get_user(o->tv_sec, &i->tv_sec))
552 return -EFAULT;
553 if (__get_user(usec, &i->tv_usec))
554 return -EFAULT;
555 o->tv_nsec = usec * 1000;
556 return 0;
557}
558
559asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
560{
561 struct timespec kts;
562 struct timezone ktz;
563
564 if (tv) {
565 if (get_ts32(&kts, tv))
566 return -EFAULT;
567 }
568 if (tz) {
569 if (copy_from_user(&ktz, tz, sizeof(ktz)))
570 return -EFAULT;
571 }
572
573 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
574}
575
576asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 509asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
577 size_t count, u32 poshi, u32 poslo) 510 size_t count, u32 poshi, u32 poslo)
578{ 511{
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 05f8516366ab..836a28842900 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -202,10 +202,6 @@ long sys32_execve(void);
202long sys32_init_module(void __user *umod, unsigned long len, 202long sys32_init_module(void __user *umod, unsigned long len,
203 const char __user *uargs); 203 const char __user *uargs);
204long sys32_delete_module(const char __user *name_user, unsigned int flags); 204long sys32_delete_module(const char __user *name_user, unsigned int flags);
205long sys32_gettimeofday(struct compat_timeval __user *tv,
206 struct timezone __user *tz);
207long sys32_settimeofday(struct compat_timeval __user *tv,
208 struct timezone __user *tz);
209long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count, 205long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count,
210 u32 poshi, u32 poslo); 206 u32 poshi, u32 poslo);
211long sys32_pwrite64(unsigned int fd, const char __user *ubuf, 207long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index ee51ca9e23b5..fc2c97197a53 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -332,17 +332,17 @@ compat_sys_getrusage_wrapper:
332 llgtr %r3,%r3 # struct rusage_emu31 * 332 llgtr %r3,%r3 # struct rusage_emu31 *
333 jg compat_sys_getrusage # branch to system call 333 jg compat_sys_getrusage # branch to system call
334 334
335 .globl sys32_gettimeofday_wrapper 335 .globl compat_sys_gettimeofday_wrapper
336sys32_gettimeofday_wrapper: 336compat_sys_gettimeofday_wrapper:
337 llgtr %r2,%r2 # struct timeval_emu31 * 337 llgtr %r2,%r2 # struct timeval_emu31 *
338 llgtr %r3,%r3 # struct timezone * 338 llgtr %r3,%r3 # struct timezone *
339 jg sys32_gettimeofday # branch to system call 339 jg compat_sys_gettimeofday # branch to system call
340 340
341 .globl sys32_settimeofday_wrapper 341 .globl compat_sys_settimeofday_wrapper
342sys32_settimeofday_wrapper: 342compat_sys_settimeofday_wrapper:
343 llgtr %r2,%r2 # struct timeval_emu31 * 343 llgtr %r2,%r2 # struct timeval_emu31 *
344 llgtr %r3,%r3 # struct timezone * 344 llgtr %r3,%r3 # struct timezone *
345 jg sys32_settimeofday # branch to system call 345 jg compat_sys_settimeofday # branch to system call
346 346
347 .globl sys32_getgroups16_wrapper 347 .globl sys32_getgroups16_wrapper
348sys32_getgroups16_wrapper: 348sys32_getgroups16_wrapper:
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 3ae303914b42..2d61787949d5 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -86,8 +86,8 @@ SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper)
86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */ 86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */
87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper) 87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper)
88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage_wrapper) 88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage_wrapper)
89SYSCALL(sys_gettimeofday,sys_gettimeofday,sys32_gettimeofday_wrapper) 89SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday_wrapper)
90SYSCALL(sys_settimeofday,sys_settimeofday,sys32_settimeofday_wrapper) 90SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday_wrapper)
91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */ 91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */
92SYSCALL(sys_setgroups16,sys_ni_syscall,sys32_setgroups16_wrapper) /* old setgroups16 syscall */ 92SYSCALL(sys_setgroups16,sys_ni_syscall,sys32_setgroups16_wrapper) /* old setgroups16 syscall */
93NI_SYSCALL /* old select syscall */ 93NI_SYSCALL /* old select syscall */