URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 199 |
Rev 1765 |
/*
|
/*
|
* linux/kernel/info.c
|
* linux/kernel/info.c
|
*
|
*
|
* Copyright (C) 1992 Darren Senn
|
* Copyright (C) 1992 Darren Senn
|
*/
|
*/
|
|
|
/* This implements the sysinfo() system call */
|
/* This implements the sysinfo() system call */
|
|
|
#include <asm/segment.h>
|
#include <asm/segment.h>
|
|
|
#include <linux/sched.h>
|
#include <linux/sched.h>
|
#include <linux/string.h>
|
#include <linux/string.h>
|
#include <linux/unistd.h>
|
#include <linux/unistd.h>
|
#include <linux/types.h>
|
#include <linux/types.h>
|
#include <linux/mm.h>
|
#include <linux/mm.h>
|
#include <linux/swap.h>
|
#include <linux/swap.h>
|
|
|
asmlinkage int sys_sysinfo(struct sysinfo *info)
|
asmlinkage int sys_sysinfo(struct sysinfo *info)
|
{
|
{
|
int error;
|
int error;
|
struct sysinfo val;
|
struct sysinfo val;
|
|
|
error = verify_area(VERIFY_WRITE, info, sizeof(struct sysinfo));
|
error = verify_area(VERIFY_WRITE, info, sizeof(struct sysinfo));
|
if (error)
|
if (error)
|
return error;
|
return error;
|
memset((char *)&val, 0, sizeof(struct sysinfo));
|
memset((char *)&val, 0, sizeof(struct sysinfo));
|
|
|
val.uptime = jiffies / HZ;
|
val.uptime = jiffies / HZ;
|
|
|
val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
|
val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
|
val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
|
val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
|
val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
|
val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
|
|
|
val.procs = nr_tasks-1;
|
val.procs = nr_tasks-1;
|
|
|
si_meminfo(&val);
|
si_meminfo(&val);
|
si_swapinfo(&val);
|
si_swapinfo(&val);
|
|
|
memcpy_tofs(info, &val, sizeof(struct sysinfo));
|
memcpy_tofs(info, &val, sizeof(struct sysinfo));
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.