Import 2.3.30pre6
[davej-history.git] / kernel / info.c
blob3ee34744494987df21a108bc41c50bba4497bb80
1 /*
2 * linux/kernel/info.c
4 * Copyright (C) 1992 Darren Senn
5 */
7 /* This implements the sysinfo() system call */
9 #include <linux/mm.h>
10 #include <linux/unistd.h>
11 #include <linux/swap.h>
12 #include <linux/smp_lock.h>
14 #include <asm/uaccess.h>
16 asmlinkage long sys_sysinfo(struct sysinfo *info)
18 struct sysinfo val;
20 memset((char *)&val, 0, sizeof(struct sysinfo));
22 cli();
23 val.uptime = jiffies / HZ;
25 val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
26 val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
27 val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
29 val.procs = nr_threads-1;
30 sti();
32 si_meminfo(&val);
33 si_swapinfo(&val);
35 if (copy_to_user(info, &val, sizeof(struct sysinfo)))
36 return -EFAULT;
37 return 0;