diff options
author | Kyle McMartin <kyle@parisc-linux.org> | 2007-02-10 01:46:00 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 10:51:32 -0800 |
commit | d4d23add3abcd18d8021b99f230df608ccb2f007 (patch) | |
tree | 756c5a7d21a9f5a25f10bfcec40c01aecc596c2f /arch/ia64/ia32 | |
parent | 72fd4a35a824331d7a0f4168d7576502d95d34b3 (diff) | |
download | blackbird-obmc-linux-d4d23add3abcd18d8021b99f230df608ccb2f007.tar.gz blackbird-obmc-linux-d4d23add3abcd18d8021b99f230df608ccb2f007.zip |
[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/ia64/ia32')
-rw-r--r-- | arch/ia64/ia32/ia32_entry.S | 2 | ||||
-rw-r--r-- | arch/ia64/ia32/sys_ia32.c | 68 |
2 files changed, 1 insertions, 69 deletions
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S index a32cd59b81ed..687e5fdc9683 100644 --- a/arch/ia64/ia32/ia32_entry.S +++ b/arch/ia64/ia32/ia32_entry.S @@ -326,7 +326,7 @@ ia32_syscall_table: data8 sys_ni_syscall data8 compat_sys_wait4 data8 sys_swapoff /* 115 */ - data8 sys32_sysinfo + data8 compat_sys_sysinfo data8 sys32_ipc data8 sys_fsync data8 sys32_sigreturn diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 957681c39ad9..d430d36ae49d 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c @@ -2209,74 +2209,6 @@ sys32_fstat64 (unsigned int fd, struct stat64 __user *statbuf) return ret; } -struct sysinfo32 { - s32 uptime; - u32 loads[3]; - u32 totalram; - u32 freeram; - u32 sharedram; - u32 bufferram; - u32 totalswap; - u32 freeswap; - u16 procs; - u16 pad; - u32 totalhigh; - u32 freehigh; - u32 mem_unit; - char _f[8]; -}; - -asmlinkage long -sys32_sysinfo (struct sysinfo32 __user *info) -{ - struct sysinfo s; - long ret, err; - int bitcount = 0; - mm_segment_t old_fs = get_fs(); - - set_fs(KERNEL_DS); - ret = sys_sysinfo((struct sysinfo __user *) &s); - set_fs(old_fs); - /* Check to see if any memory value is too large for 32-bit and - * scale down if needed. - */ - if ((s.totalram >> 32) || (s.totalswap >> 32)) { - while (s.mem_unit < PAGE_SIZE) { - s.mem_unit <<= 1; - bitcount++; - } - s.totalram >>= bitcount; - s.freeram >>= bitcount; - s.sharedram >>= bitcount; - s.bufferram >>= bitcount; - s.totalswap >>= bitcount; - s.freeswap >>= bitcount; - s.totalhigh >>= bitcount; - s.freehigh >>= bitcount; - } - - if (!access_ok(VERIFY_WRITE, info, sizeof(*info))) - return -EFAULT; - - err = __put_user(s.uptime, &info->uptime); - err |= __put_user(s.loads[0], &info->loads[0]); - err |= __put_user(s.loads[1], &info->loads[1]); - err |= __put_user(s.loads[2], &info->loads[2]); - err |= __put_user(s.totalram, &info->totalram); - err |= __put_user(s.freeram, &info->freeram); - err |= __put_user(s.sharedram, &info->sharedram); - err |= __put_user(s.bufferram, &info->bufferram); - err |= __put_user(s.totalswap, &info->totalswap); - err |= __put_user(s.freeswap, &info->freeswap); - err |= __put_user(s.procs, &info->procs); - err |= __put_user (s.totalhigh, &info->totalhigh); - err |= __put_user (s.freehigh, &info->freehigh); - err |= __put_user (s.mem_unit, &info->mem_unit); - if (err) - return -EFAULT; - return ret; -} - asmlinkage long sys32_sched_rr_get_interval (pid_t pid, struct compat_timespec __user *interval) { |