root/kernel/info.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sys_sysinfo

   1 /*
   2  * linux/kernel/info.c
   3  *
   4  * Copyright (C) 1992 Darren Senn
   5  */
   6 
   7 /* This implements the sysinfo() system call */
   8 
   9 #include <asm/segment.h>
  10 
  11 #include <linux/sched.h>
  12 #include <linux/string.h>
  13 #include <linux/unistd.h>
  14 #include <linux/types.h>
  15 #include <linux/mm.h>
  16 
  17 asmlinkage int sys_sysinfo(struct sysinfo *info)
     /* [previous][next][first][last][top][bottom][index][help] */
  18 {
  19         int error;
  20         struct sysinfo val;
  21 
  22         error = verify_area(VERIFY_WRITE, info, sizeof(struct sysinfo));
  23         if (error)
  24                 return error;
  25         memset((char *)&val, 0, sizeof(struct sysinfo));
  26 
  27         val.uptime = jiffies / HZ;
  28 
  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);
  32 
  33         val.procs = nr_tasks-1;
  34 
  35         si_meminfo(&val);
  36         si_swapinfo(&val);
  37 
  38         memcpy_tofs(info, &val, sizeof(struct sysinfo));
  39         return 0;
  40 }

/* [previous][next][first][last][top][bottom][index][help] */