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:
Justine Tunney 2023-02-23 06:00:18 -08:00
parent 71d955be1d
commit dfabcd84c1
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2 changed files with 16 additions and 19 deletions

View file

@ -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);