diff options
author | sobomax <sobomax@FreeBSD.org> | 2003-11-16 15:07:10 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2003-11-16 15:07:10 +0000 |
commit | a621621dc908dd3a638c875c5bd8b949bf04326e (patch) | |
tree | c21807928bf314bd714743294f74013149b906a8 /sys/compat/linux/linux_misc.c | |
parent | b1926e392ed0eee6eba473c1a39c291a5f097794 (diff) | |
download | FreeBSD-src-a621621dc908dd3a638c875c5bd8b949bf04326e.zip FreeBSD-src-a621621dc908dd3a638c875c5bd8b949bf04326e.tar.gz |
Pull latest changes from OpenBSD:
- improve sysinfo(2) syscall;
- add dummy fadvise64(2) syscall;
- add dummy *xattr(2) family of syscalls;
- add protos for the syscalls 222-225, 238-249 and 253-267;
- add exit_group(2) syscall, which is currently just wired to exit(2).
Obtained from: OpenBSD
MFC after: 2 weeks
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 56b20f3..9e61226 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -97,6 +97,7 @@ static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = { struct l_sysinfo { l_long uptime; /* Seconds since boot */ l_ulong loads[3]; /* 1, 5, and 15 minute load averages */ +#define LINUX_SYSINFO_LOADS_SCALE 65536 l_ulong totalram; /* Total usable main memory size */ l_ulong freeram; /* Available memory size */ l_ulong sharedram; /* Amount of shared memory */ @@ -104,7 +105,10 @@ struct l_sysinfo { l_ulong totalswap; /* Total swap space size */ l_ulong freeswap; /* swap space still available */ l_ushort procs; /* Number of current processes */ - char _f[22]; /* Pads structure to 64 bytes */ + l_ulong totalbig; + l_ulong freebig; + l_uint mem_unit; + char _f[6]; /* Pads structure to 64 bytes */ }; #ifndef __alpha__ int @@ -134,7 +138,8 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) /* Use the information from the mib to get our load averages */ for (i = 0; i < 3; i++) - sysinfo.loads[i] = averunnable.ldavg[i]; + sysinfo.loads[i] = averunnable.ldavg[i] * + LINUX_SYSINFO_LOADS_SCALE / averunnable.fscale; sysinfo.totalram = physmem * PAGE_SIZE; sysinfo.freeram = sysinfo.totalram - cnt.v_wire_count * PAGE_SIZE; @@ -152,7 +157,12 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) sysinfo.totalswap= i * PAGE_SIZE; sysinfo.freeswap = (i - j) * PAGE_SIZE; - sysinfo.procs = 20; /* Hack */ + sysinfo.procs = nprocs; + + /* The following are only present in newer Linux kernels. */ + sysinfo.totalbig = 0; + sysinfo.freebig = 0; + sysinfo.mem_unit = 1; return copyout(&sysinfo, args->info, sizeof(sysinfo)); } |