diff options
author | Dave Watson <davejwatson@fb.com> | 2016-11-03 01:22:32 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2016-11-03 03:05:40 (GMT) |
commit | 712fde79fda767ce1eec7cf1c967feeae90b0c21 (patch) | |
tree | 8844046e81c5402c0ca7faa0a055940180bf8d13 /src | |
parent | 83ebf2fda5603fe07fcb3ff25c0dd5ad939204d8 (diff) | |
download | jemalloc-712fde79fda767ce1eec7cf1c967feeae90b0c21.zip jemalloc-712fde79fda767ce1eec7cf1c967feeae90b0c21.tar.gz jemalloc-712fde79fda767ce1eec7cf1c967feeae90b0c21.tar.bz2 |
Check for existance of CPU_COUNT macro before using it.
This resolves #485.
Diffstat (limited to 'src')
-rw-r--r-- | src/jemalloc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c index 3e0605e..8603017 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -753,8 +753,10 @@ malloc_ncpus(void) SYSTEM_INFO si; GetSystemInfo(&si); result = si.dwNumberOfProcessors; -#elif defined(JEMALLOC_GLIBC_MALLOC_HOOK) +#elif defined(JEMALLOC_GLIBC_MALLOC_HOOK) && defined(CPU_COUNT) /* + * glibc >= 2.6 has the CPU_COUNT macro. + * * glibc's sysconf() uses isspace(). glibc allocates for the first time * *before* setting up the isspace tables. Therefore we need a * different method to get the number of CPUs. @@ -1899,6 +1901,7 @@ JEMALLOC_EXPORT void *(*__memalign_hook)(size_t alignment, size_t size) = je_memalign; # endif +#ifdef CPU_COUNT /* * To enable static linking with glibc, the libc specific malloc interface must * be implemented also, so none of glibc's malloc.o functions are added to the @@ -1917,6 +1920,9 @@ int __posix_memalign(void** r, size_t a, size_t s) PREALIAS(je_posix_memalign); #undef PREALIAS #undef ALIAS + +#endif + #endif /* |