[tor-bugs] #14802 [Tor]: Return 0 when we fail to get the amount of system memory on some obscure OS
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Feb 9 01:42:26 UTC 2015
#14802: Return 0 when we fail to get the amount of system memory on some obscure OS
------------------------+--------------------------------
Reporter: sysrqb | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: Tor | Version: Tor: 0.2.5.4-alpha
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
------------------------+--------------------------------
Comment (by sysrqb):
{{{
diff --git a/src/common/compat.c b/src/common/compat.c
index 5575316..fde65d9 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -3161,7 +3161,7 @@ get_total_system_memory_impl(void)
size_t len = sizeof(memsize);
int mib[2] = {CTL_HW, HW_USERMEM};
if (sysctl(mib,2,&memsize,&len,NULL,0))
- return -1;
+ return 0;
return memsize;
}}}
Should do it.
Interestingly, I stumbled upon
[http://nadeausoftware.com/articles/2012/09/c_c_tip_how_get_physical_memory_size_system
[0]], which seems to be fairly comprehensive.
Something to think about.
[0]
http://nadeausoftware.com/articles/2012/09/c_c_tip_how_get_physical_memory_size_system
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/14802#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list