mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Merge branch 'maint-0.3.5'
This commit is contained in:
commit
16430fdaf5
5
changes/bug28981
Normal file
5
changes/bug28981
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
o Minor bugfixes (misc):
|
||||||
|
- The amount of total available physical memory is now determined
|
||||||
|
using the sysctl identifier HW_PHYSMEM (rather than HW_USERMEM)
|
||||||
|
when it is defined and a 64-bit variant is not available. Fixes
|
||||||
|
bug 28981; bugfix on 0.2.5.4-alpha. Patch from Kris Katterjohn.
|
@ -60,7 +60,7 @@ tor_log_mallinfo(int severity)
|
|||||||
ENABLE_GCC_WARNING(aggregate-return)
|
ENABLE_GCC_WARNING(aggregate-return)
|
||||||
|
|
||||||
#if defined(HW_PHYSMEM64)
|
#if defined(HW_PHYSMEM64)
|
||||||
/* This appears to be an OpenBSD thing */
|
/* OpenBSD and NetBSD define this */
|
||||||
#define INT64_HW_MEM HW_PHYSMEM64
|
#define INT64_HW_MEM HW_PHYSMEM64
|
||||||
#elif defined(HW_MEMSIZE)
|
#elif defined(HW_MEMSIZE)
|
||||||
/* OSX defines this one */
|
/* OSX defines this one */
|
||||||
@ -115,7 +115,7 @@ get_total_system_memory_impl(void)
|
|||||||
return ms.ullTotalPhys;
|
return ms.ullTotalPhys;
|
||||||
|
|
||||||
#elif defined(HAVE_SYSCTL) && defined(INT64_HW_MEM)
|
#elif defined(HAVE_SYSCTL) && defined(INT64_HW_MEM)
|
||||||
/* On many systems, HW_PYHSMEM is clipped to 32 bits; let's use a better
|
/* On many systems, HW_PHYSMEM is clipped to 32 bits; let's use a better
|
||||||
* variant if we know about it. */
|
* variant if we know about it. */
|
||||||
uint64_t memsize = 0;
|
uint64_t memsize = 0;
|
||||||
size_t len = sizeof(memsize);
|
size_t len = sizeof(memsize);
|
||||||
@ -130,7 +130,7 @@ get_total_system_memory_impl(void)
|
|||||||
* HW_PHYSMEM. */
|
* HW_PHYSMEM. */
|
||||||
size_t memsize=0;
|
size_t memsize=0;
|
||||||
size_t len = sizeof(memsize);
|
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))
|
if (sysctl(mib,2,&memsize,&len,NULL,0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user