diff options
author | Kris Katterjohn <katterjohn@gmail.com> | 2019-01-03 17:19:46 -0600 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-01-16 14:40:15 -0500 |
commit | 0f3d88a159d32d477893b05a5a6051e9ccc9e716 (patch) | |
tree | f07871fbfc38f6bc41ffb9afb54fdc1a6b6e5a64 /src/lib/meminfo | |
parent | efe55b88987c2539c218fdf1f46f16f9bdc3a8eb (diff) | |
download | tor-0f3d88a159d32d477893b05a5a6051e9ccc9e716.tar.gz tor-0f3d88a159d32d477893b05a5a6051e9ccc9e716.zip |
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>
Diffstat (limited to 'src/lib/meminfo')
-rw-r--r-- | src/lib/meminfo/meminfo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/meminfo/meminfo.c b/src/lib/meminfo/meminfo.c index 790d698910..0f536323fa 100644 --- a/src/lib/meminfo/meminfo.c +++ b/src/lib/meminfo/meminfo.c @@ -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; |