Commit a5448a7d authored by bellard's avatar bellard
Browse files

sysinfo syscall (Francois Guimond)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@930 c046a42c-6fe2-441c-8c8c-71466251a162
parent 9231944d
......@@ -43,6 +43,7 @@
#include <sys/times.h>
#include <sys/shm.h>
#include <utime.h>
#include <sys/sysinfo.h>
//#include <sys/user.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
......@@ -2348,7 +2349,29 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
ret = get_errno(swapoff((const char *)arg1));
break;
case TARGET_NR_sysinfo:
goto unimplemented;
{
struct target_sysinfo *target_value = (void *)arg1;
struct sysinfo value;
ret = get_errno(sysinfo(&value));
if (!is_error(ret) && target_value)
{
__put_user(value.uptime, &target_value->uptime);
__put_user(value.loads[0], &target_value->loads[0]);
__put_user(value.loads[1], &target_value->loads[1]);
__put_user(value.loads[2], &target_value->loads[2]);
__put_user(value.totalram, &target_value->totalram);
__put_user(value.freeram, &target_value->freeram);
__put_user(value.sharedram, &target_value->sharedram);
__put_user(value.bufferram, &target_value->bufferram);
__put_user(value.totalswap, &target_value->totalswap);
__put_user(value.freeswap, &target_value->freeswap);
__put_user(value.procs, &target_value->procs);
__put_user(value.totalhigh, &target_value->totalhigh);
__put_user(value.freehigh, &target_value->freehigh);
__put_user(value.mem_unit, &target_value->mem_unit);
}
}
break;
case TARGET_NR_ipc:
ret = do_ipc(arg1, arg2, arg3, arg4, arg5, arg6);
break;
......
......@@ -1133,3 +1133,20 @@ struct target_flock64 {
/* vfat ioctls */
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
struct target_sysinfo {
target_long uptime; /* Seconds since boot */
target_ulong loads[3]; /* 1, 5, and 15 minute load averages */
target_ulong totalram; /* Total usable main memory size */
target_ulong freeram; /* Available memory size */
target_ulong sharedram; /* Amount of shared memory */
target_ulong bufferram; /* Memory used by buffers */
target_ulong totalswap; /* Total swap space size */
target_ulong freeswap; /* swap space still available */
unsigned short procs; /* Number of current processes */
unsigned short pad; /* explicit padding for m68k */
target_ulong totalhigh; /* Total high memory size */
target_ulong freehigh; /* Available high memory size */
unsigned int mem_unit; /* Memory unit size in bytes */
char _f[20-2*sizeof(target_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment