aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorKyle McMartin <kyle@parisc-linux.org>2007-02-10 04:46:00 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:32 -0500
commitd4d23add3abcd18d8021b99f230df608ccb2f007 (patch)
tree756c5a7d21a9f5a25f10bfcec40c01aecc596c2f /arch/s390
parent72fd4a35a824331d7a0f4168d7576502d95d34b3 (diff)
[PATCH] Common compat_sys_sysinfo
I noticed that almost all architectures implemented exactly the same sys32_sysinfo... except parisc, where a bug was to be found in handling of the uptime. So let's remove a whole whack of code for fun and profit. Cribbed compat_sys_sysinfo from x86_64's implementation, since I figured it would be the best tested. This patch incorporates Arnd's suggestion of not using set_fs/get_fs, but instead extracting out the common code from sys_sysinfo. Cc: Christoph Hellwig <hch@infradead.org> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/compat_linux.c45
-rw-r--r--arch/s390/kernel/compat_wrapper.S6
-rw-r--r--arch/s390/kernel/syscalls.S2
3 files changed, 4 insertions, 49 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 666bb6daa148..664c669b1856 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -398,51 +398,6 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
398 return err; 398 return err;
399} 399}
400 400
401struct sysinfo32 {
402 s32 uptime;
403 u32 loads[3];
404 u32 totalram;
405 u32 freeram;
406 u32 sharedram;
407 u32 bufferram;
408 u32 totalswap;
409 u32 freeswap;
410 unsigned short procs;
411 unsigned short pads;
412 u32 totalhigh;
413 u32 freehigh;
414 unsigned int mem_unit;
415 char _f[8];
416};
417
418asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
419{
420 struct sysinfo s;
421 int ret, err;
422 mm_segment_t old_fs = get_fs ();
423
424 set_fs (KERNEL_DS);
425 ret = sys_sysinfo((struct sysinfo __force __user *) &s);
426 set_fs (old_fs);
427 err = put_user (s.uptime, &info->uptime);
428 err |= __put_user (s.loads[0], &info->loads[0]);
429 err |= __put_user (s.loads[1], &info->loads[1]);
430 err |= __put_user (s.loads[2], &info->loads[2]);
431 err |= __put_user (s.totalram, &info->totalram);
432 err |= __put_user (s.freeram, &info->freeram);
433 err |= __put_user (s.sharedram, &info->sharedram);
434 err |= __put_user (s.bufferram, &info->bufferram);
435 err |= __put_user (s.totalswap, &info->totalswap);
436 err |= __put_user (s.freeswap, &info->freeswap);
437 err |= __put_user (s.procs, &info->procs);
438 err |= __put_user (s.totalhigh, &info->totalhigh);
439 err |= __put_user (s.freehigh, &info->freehigh);
440 err |= __put_user (s.mem_unit, &info->mem_unit);
441 if (err)
442 return -EFAULT;
443 return ret;
444}
445
446asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid, 401asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid,
447 struct compat_timespec __user *interval) 402 struct compat_timespec __user *interval)
448{ 403{
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 71e54ef0931e..97901296894e 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -517,10 +517,10 @@ sys32_swapoff_wrapper:
517 llgtr %r2,%r2 # const char * 517 llgtr %r2,%r2 # const char *
518 jg sys_swapoff # branch to system call 518 jg sys_swapoff # branch to system call
519 519
520 .globl sys32_sysinfo_wrapper 520 .globl compat_sys_sysinfo_wrapper
521sys32_sysinfo_wrapper: 521compat_sys_sysinfo_wrapper:
522 llgtr %r2,%r2 # struct sysinfo_emu31 * 522 llgtr %r2,%r2 # struct sysinfo_emu31 *
523 jg sys32_sysinfo # branch to system call 523 jg compat_sys_sysinfo # branch to system call
524 524
525 .globl sys32_ipc_wrapper 525 .globl sys32_ipc_wrapper
526sys32_ipc_wrapper: 526sys32_ipc_wrapper:
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index a4ceae3dbcf1..a52c44455bf0 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -124,7 +124,7 @@ NI_SYSCALL /* old "idle" system call */
124NI_SYSCALL /* vm86old for i386 */ 124NI_SYSCALL /* vm86old for i386 */
125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper) 125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper)
126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ 126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */
127SYSCALL(sys_sysinfo,sys_sysinfo,sys32_sysinfo_wrapper) 127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
128SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper) 128SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper)
129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) 129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn_glue,sys_sigreturn_glue,sys32_sigreturn_glue) 130SYSCALL(sys_sigreturn_glue,sys_sigreturn_glue,sys32_sigreturn_glue)