kernel/info.c
24127 /*
24128 * linux/kernel/info.c
24129 *
24130 * Copyright (C) 1992 Darren Senn
24131 */
24132
24133 /* This implements the sysinfo() system call */
24134
24135 #include <linux/mm.h>
24136 #include <linux/unistd.h>
24137 #include <linux/swap.h>
24138 #include <linux/smp_lock.h>
24139
24140 #include <asm/uaccess.h>
24141
24142 asmlinkage int sys_sysinfo(struct sysinfo *info)
24143 {
24144 struct sysinfo val;
24145
24146 memset((char *)&val, 0, sizeof(struct sysinfo));
24147
24148 cli();
24149 val.uptime = jiffies / HZ;
24150
24151 val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
24152 val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
24153 val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
24154
24155 val.procs = nr_tasks-1;
24156 sti();
24157
24158 si_meminfo(&val);
24159 si_swapinfo(&val);
24160
24161 if (copy_to_user(info, &val, sizeof(struct sysinfo)))
24162 return -EFAULT;
24163 return 0;
24164 }
Сайт управляется системой
uCoz