mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-15 23:17:14 +00:00
Libc: use caller integer width for return value of sysctl PHYSMEM
Return a value in the same width as provided by the caller of sysctl for PHYSMEM and USERMEM. This is to ensure that if a caller provides a 64-bit integer, a 64-bit value will be returned for 32-bit machines. issue #3060
This commit is contained in:
parent
98518e39cd
commit
2d17af9f28
@ -129,8 +129,16 @@ extern "C" int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
||||
|
||||
case HW_PHYSMEM:
|
||||
case HW_USERMEM:
|
||||
*(unsigned long*)oldp = _global_env->ram().ram_quota().value;
|
||||
*oldlenp = sizeof(unsigned long);
|
||||
switch (*oldlenp) {
|
||||
case 4:
|
||||
*(Genode::int32_t*)oldp = _global_env->ram().ram_quota().value;
|
||||
break;
|
||||
case 8:
|
||||
*(Genode::int64_t*)oldp = _global_env->ram().ram_quota().value;
|
||||
break;
|
||||
default:
|
||||
return Libc::Errno(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case HW_PAGESIZE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user