Import 2.1.122
[davej-history.git] / kernel / info.c
blobffaec7140e78e85f3333701727b851cb382906e4
1 /*
2 * linux/kernel/info.c
4 * Copyright (C) 1992 Darren Senn
5 */
7 /* This implements the sysinfo() system call */
9 #include <linux/sched.h>
10 #include <linux/string.h>
11 #include <linux/unistd.h>
12 #include <linux/types.h>
13 #include <linux/mm.h>
14 #include <linux/swap.h>
15 #include <linux/smp.h>
16 #include <linux/smp_lock.h>
18 #include <asm/uaccess.h>
20 asmlinkage int sys_sysinfo(struct sysinfo *info)
22 struct sysinfo val;
24 memset((char *)&val, 0, sizeof(struct sysinfo));
26 cli();
27 val.uptime = jiffies / HZ;
29 val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
30 val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
31 val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
33 val.procs = nr_tasks-1;
34 sti();
36 si_meminfo(&val);
37 si_swapinfo(&val);
39 if (copy_to_user(info, &val, sizeof(struct sysinfo)))
40 return -EFAULT;
41 return 0;