diff options
author | Kyle McMartin <kyle@parisc-linux.org> | 2007-02-10 04:46:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:32 -0500 |
commit | d4d23add3abcd18d8021b99f230df608ccb2f007 (patch) | |
tree | 756c5a7d21a9f5a25f10bfcec40c01aecc596c2f /arch/parisc | |
parent | 72fd4a35a824331d7a0f4168d7576502d95d34b3 (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/parisc')
-rw-r--r-- | arch/parisc/kernel/sys_parisc32.c | 64 | ||||
-rw-r--r-- | arch/parisc/kernel/syscall_table.S | 2 |
2 files changed, 1 insertions, 65 deletions
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index 29be4377aca6..ce3245f87fdd 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c | |||
@@ -579,70 +579,6 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *off | |||
579 | } | 579 | } |
580 | 580 | ||
581 | 581 | ||
582 | struct sysinfo32 { | ||
583 | s32 uptime; | ||
584 | u32 loads[3]; | ||
585 | u32 totalram; | ||
586 | u32 freeram; | ||
587 | u32 sharedram; | ||
588 | u32 bufferram; | ||
589 | u32 totalswap; | ||
590 | u32 freeswap; | ||
591 | unsigned short procs; | ||
592 | u32 totalhigh; | ||
593 | u32 freehigh; | ||
594 | u32 mem_unit; | ||
595 | char _f[12]; | ||
596 | }; | ||
597 | |||
598 | /* We used to call sys_sysinfo and translate the result. But sys_sysinfo | ||
599 | * undoes the good work done elsewhere, and rather than undoing the | ||
600 | * damage, I decided to just duplicate the code from sys_sysinfo here. | ||
601 | */ | ||
602 | |||
603 | asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info) | ||
604 | { | ||
605 | struct sysinfo val; | ||
606 | int err; | ||
607 | unsigned long seq; | ||
608 | |||
609 | /* We don't need a memset here because we copy the | ||
610 | * struct to userspace once element at a time. | ||
611 | */ | ||
612 | |||
613 | do { | ||
614 | seq = read_seqbegin(&xtime_lock); | ||
615 | val.uptime = jiffies / HZ; | ||
616 | |||
617 | val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT); | ||
618 | val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT); | ||
619 | val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT); | ||
620 | |||
621 | val.procs = nr_threads; | ||
622 | } while (read_seqretry(&xtime_lock, seq)); | ||
623 | |||
624 | |||
625 | si_meminfo(&val); | ||
626 | si_swapinfo(&val); | ||
627 | |||
628 | err = put_user (val.uptime, &info->uptime); | ||
629 | err |= __put_user (val.loads[0], &info->loads[0]); | ||
630 | err |= __put_user (val.loads[1], &info->loads[1]); | ||
631 | err |= __put_user (val.loads[2], &info->loads[2]); | ||
632 | err |= __put_user (val.totalram, &info->totalram); | ||
633 | err |= __put_user (val.freeram, &info->freeram); | ||
634 | err |= __put_user (val.sharedram, &info->sharedram); | ||
635 | err |= __put_user (val.bufferram, &info->bufferram); | ||
636 | err |= __put_user (val.totalswap, &info->totalswap); | ||
637 | err |= __put_user (val.freeswap, &info->freeswap); | ||
638 | err |= __put_user (val.procs, &info->procs); | ||
639 | err |= __put_user (val.totalhigh, &info->totalhigh); | ||
640 | err |= __put_user (val.freehigh, &info->freehigh); | ||
641 | err |= __put_user (val.mem_unit, &info->mem_unit); | ||
642 | return err ? -EFAULT : 0; | ||
643 | } | ||
644 | |||
645 | |||
646 | /* lseek() needs a wrapper because 'offset' can be negative, but the top | 582 | /* lseek() needs a wrapper because 'offset' can be negative, but the top |
647 | * half of the argument has been zeroed by syscall.S. | 583 | * half of the argument has been zeroed by syscall.S. |
648 | */ | 584 | */ |
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 701d66a596e8..be8eb9a0d24a 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -197,7 +197,7 @@ | |||
197 | /* struct rusage contains longs... */ | 197 | /* struct rusage contains longs... */ |
198 | ENTRY_COMP(wait4) | 198 | ENTRY_COMP(wait4) |
199 | ENTRY_SAME(swapoff) /* 115 */ | 199 | ENTRY_SAME(swapoff) /* 115 */ |
200 | ENTRY_DIFF(sysinfo) | 200 | ENTRY_COMP(sysinfo) |
201 | ENTRY_SAME(shutdown) | 201 | ENTRY_SAME(shutdown) |
202 | ENTRY_SAME(fsync) | 202 | ENTRY_SAME(fsync) |
203 | ENTRY_SAME(madvise) | 203 | ENTRY_SAME(madvise) |