[parisc-linux-cvs] wrapper for sys_sysinfo

Richard Hirst rhirst@linuxcare.com
Thu, 17 May 2001 16:07:15 +0100


Needed by busybox version of init.

Index: arch/parisc/kernel/syscall.S
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/syscall.S,v
retrieving revision 1.66
diff -u -r1.66 syscall.S
--- syscall.S   2001/05/10 23:18:56     1.66
+++ syscall.S   2001/05/17 14:58:57
@@ -463,8 +463,7 @@
        /* struct rusage contains longs... */
        ENTRY_DIFF(wait4)
        ENTRY_SAME(swapoff)             /* 115 */
-       /* struct sysinfo contains longs */
-       ENTRY_SAME(sysinfo)
+       ENTRY_DIFF(sysinfo)
        ENTRY_SAME(shutdown)
        ENTRY_SAME(fsync)
        ENTRY_SAME(madvise)
Index: arch/parisc/kernel/sys_parisc32.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/sys_parisc32.c,v
retrieving revision 1.12
diff -u -r1.12 sys_parisc32.c
--- sys_parisc32.c      2001/05/10 23:18:56     1.12
+++ sys_parisc32.c      2001/05/17 14:59:04
@@ -3131,3 +3131,51 @@
        CP(stbcnt);
        return copy_to_user(txc_p32, &t32, sizeof(struct timex32)) ? -EFAULT : ret;
 }
+
+
+struct sysinfo32 {
+        s32 uptime;
+        u32 loads[3];
+        u32 totalram;
+        u32 freeram;
+        u32 sharedram;
+        u32 bufferram;
+        u32 totalswap;
+        u32 freeswap;
+        unsigned short procs;
+       u32 totalhigh;
+       u32 freehigh;
+       u32 mem_unit;
+        char _f[12];
+};
+
+extern asmlinkage int sys_sysinfo(struct sysinfo *info);
+
+asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
+{
+       struct sysinfo s;
+       int ret, err;
+       mm_segment_t old_fs = get_fs ();
+
+       set_fs (KERNEL_DS);
+       ret = sys_sysinfo(&s);
+       set_fs (old_fs);
+       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;
+}
+