[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/release-0.3.5] Use HW_PHYSMEM instead of HW_USERMEM in get_total_system_memory_impl



commit 0f3d88a159d32d477893b05a5a6051e9ccc9e716
Author: Kris Katterjohn <katterjohn@xxxxxxxxx>
Date:   Thu Jan 3 17:19:46 2019 -0600

    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@xxxxxxxxx>
---
 src/lib/meminfo/meminfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/meminfo/meminfo.c b/src/lib/meminfo/meminfo.c
index 790d69891..0f536323f 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;
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits