mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 05:03:43 +01:00
Use HW_PHYSMEM instead of HW_USERMEM in get_total_system_memory_impl
The code checked for sysctl being available and HW_PHYSMEM being defined, but HW_USERMEM was actually being used with sysctl instead of HW_PHYSMEM. The case for OpenBSD, etc. use HW_PHYSMEM64 (which is obviously a 64-bit variant of HW_PHYSMEM) and the case for OSX uses HW_MEMSIZE (which appears to be a 64-bit variant of HW_PHYSMEM). Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
This commit is contained in:
parent
efe55b8898
commit
0f3d88a159
@ -130,7 +130,7 @@ get_total_system_memory_impl(void)
|
||||
* HW_PHYSMEM. */
|
||||
size_t memsize=0;
|
||||
size_t len = sizeof(memsize);
|
||||
int mib[2] = {CTL_HW, HW_USERMEM};
|
||||
int mib[2] = {CTL_HW, HW_PHYSMEM};
|
||||
if (sysctl(mib,2,&memsize,&len,NULL,0))
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user