mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 18:28:30 +00:00
Fix sysinfo()
The system call wrapper was wrongfully reinterpreting kernel data. The examples/sysinfo.c program is now updated to show how to correctly use what's returned.
This commit is contained in:
parent
71d955be1d
commit
dfabcd84c1
2 changed files with 16 additions and 19 deletions
|
@ -81,9 +81,6 @@ int sysinfo(struct sysinfo *info) {
|
|||
rc = sys_sysinfo_nt(&x);
|
||||
}
|
||||
if (rc != -1) {
|
||||
x.procs = MAX(1, x.procs);
|
||||
x.mem_unit = MAX(1, x.mem_unit);
|
||||
x.totalram = MAX((8 * 1024 * 1024) / x.mem_unit, x.totalram);
|
||||
memcpy(info, &x, sizeof(x));
|
||||
}
|
||||
STRACE("sysinfo(%p) → %d% m", info, rc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue