Index: linux_dummy.c
===================================================================
RCS file: /cvs/src/sys/compat/linux/linux_dummy.c,v
retrieving revision 1.10
diff -u -r1.10 linux_dummy.c
--- linux_dummy.c	30 Oct 2002 20:10:48 -0000	1.10
+++ linux_dummy.c	21 Jul 2003 04:48:01 -0000
@@ -81,7 +81,6 @@
 DUMMY(idle);			/* #112 */
 DUMMY(vm86old);			/* #113 */
 DUMMY(swapoff);			/* #115 */
-DUMMY(sysinfo);			/* #116 */
 #ifndef __i386__
 DUMMY(modify_ldt);		/* #123 */
 #endif
Index: linux_misc.c
===================================================================
RCS file: /cvs/src/sys/compat/linux/linux_misc.c,v
retrieving revision 1.49
diff -u -r1.49 linux_misc.c
--- linux_misc.c	21 Jun 2003 00:42:58 -0000	1.49
+++ linux_misc.c	21 Jul 2003 04:45:56 -0000
@@ -1437,3 +1437,42 @@
 	*retval = p->p_cred->p_rgid;
 	return (0);
 }
+
+
+/*
+ * sysinfo()
+ */
+/* ARGSUSED */
+int
+linux_sys_sysinfo(p, v, retval)
+	struct proc *p;
+	void *v;
+	register_t *retval;
+{
+	struct linux_sys_sysinfo_args /* {
+		syscallarg(struct linux_sysinfo *) sysinfo;
+	} */ *uap = v;
+	struct linux_sysinfo si;
+	struct loadavg *la;
+	extern int bufpages;
+
+
+	si.uptime = time.tv_sec - boottime.tv_sec;
+	la = &averunnable;
+	si.loads[0] = la->ldavg[0] * LINUX_SYSINFO_LOADS_SCALE / la->fscale;
+	si.loads[1] = la->ldavg[1] * LINUX_SYSINFO_LOADS_SCALE / la->fscale;
+	si.loads[2] = la->ldavg[2] * LINUX_SYSINFO_LOADS_SCALE / la->fscale;
+	si.totalram = ctob(physmem);
+	si.freeram = uvmexp.free * uvmexp.pagesize;
+	si.sharedram = 0;/* XXX */
+	si.bufferram = bufpages * PAGE_SIZE;
+	si.totalswap = uvmexp.swpages * PAGE_SIZE;
+	si.freeswap = (uvmexp.swpages - uvmexp.swpginuse) * PAGE_SIZE;
+	si.procs = nprocs;
+	/* The following are only present in newer Linux kernels. */
+	si.totalbig = 0;
+	si.freebig = 0;
+	si.mem_unit = 1;
+
+	return (copyout(&si, SCARG(uap, sysinfo), sizeof(si)));
+}
Index: linux_misc.h
===================================================================
RCS file: /cvs/src/sys/compat/linux/linux_misc.h,v
retrieving revision 1.2
diff -u -r1.2 linux_misc.h
--- linux_misc.h	14 Mar 2002 01:26:50 -0000	1.2
+++ linux_misc.h	21 Jul 2003 04:00:51 -0000
@@ -40,6 +40,24 @@
 #ifndef _LINUX_MISC_H
 #define _LINUX_MISC_H
 
+/* This looks very unportable to me, but this is how Linux defines it. */
+struct linux_sysinfo {
+	long uptime;
+	unsigned long loads[3];
+#define LINUX_SYSINFO_LOADS_SCALE 65536
+	unsigned long totalram;
+	unsigned long freeram;
+	unsigned long sharedram;
+	unsigned long bufferram;
+	unsigned long totalswap;
+	unsigned long freeswap;
+	unsigned short procs;
+	unsigned long totalbig;
+	unsigned long freebig;
+	unsigned int mem_unit;
+	char _f[20-2*sizeof(long)-sizeof(int)];
+};
+
 /*
  * Options passed to the Linux wait4() system call.
  */
Index: syscalls.master
===================================================================
RCS file: /cvs/src/sys/compat/linux/syscalls.master,v
retrieving revision 1.37
diff -u -r1.37 syscalls.master
--- syscalls.master	10 May 2003 17:53:57 -0000	1.37
+++ syscalls.master	21 Jul 2003 04:11:04 -0000
@@ -40,6 +40,7 @@
 
 #include <compat/linux/linux_types.h>
 #include <compat/linux/linux_signal.h>
+#include <compat/linux/linux_misc.h>
 #include <compat/linux/linux_syscallargs.h>
 
 #include <machine/linux_machdep.h>
@@ -202,7 +203,7 @@
 114	STD		{ int linux_sys_wait4(int pid, int *status, \
 			    int options, struct rusage *rusage); }
 115	STD		{ int linux_sys_swapoff(void); }
-116	STD		{ int linux_sys_sysinfo(void); }
+116	STD		{ int linux_sys_sysinfo(struct linux_sys_sysinfo_args *sysinfo); }
 117	STD		{ int linux_sys_ipc(int what, int a1, int a2, int a3, \
 			    caddr_t ptr); }
 118	NOARGS		{ int sys_fsync(int fd); }
