home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / linux / atari / source / source.lzh / atari-linux-0.01pl3 / kernel / info.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  1.1 KB  |  48 lines

  1. /*
  2.  * linux/kernel/info.c
  3.  *
  4.  * Copyright (C) 1992 Darren Senn
  5.  *
  6.  * This file is subject to the terms and conditions of the GNU General Public
  7.  * License.  See the file README.legal in the main directory of this archive
  8.  * for more details.
  9.  */
  10.  
  11. /* This implements the sysinfo() system call */
  12.  
  13. #include <asm/segment.h>
  14.  
  15. #include <linux/types.h>
  16. #include <linux/sched.h>
  17. #include <linux/kernel.h>
  18. #include <linux/string.h>
  19. #include <linux/unistd.h>
  20. #include <linux/mm.h>
  21.  
  22. asmlinkage int sys_sysinfo(struct sysinfo *info)
  23. {
  24.     int error;
  25.     struct sysinfo val;
  26.     struct task_struct **p;
  27.  
  28.     error = verify_area(VERIFY_WRITE, info, sizeof(struct sysinfo));
  29.     if (error)
  30.         return error;
  31.     memset((char *)&val, 0, sizeof(struct sysinfo));
  32.  
  33.     val.uptime = jiffies / HZ;
  34.  
  35.     val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
  36.     val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
  37.     val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
  38.  
  39.     for (p = &LAST_TASK; p > &FIRST_TASK; p--)
  40.         if (*p) val.procs++;
  41.  
  42.     si_meminfo(&val);
  43.     si_swapinfo(&val);
  44.  
  45.     memcpy_tofs(info, &val, sizeof(struct sysinfo));
  46.     return 0;
  47. }
  48.