From: John Coyle Date: Wed, 14 Oct 2015 00:20:33 +0000 (-0400) Subject: common/MemoryModel: Alpine is a linux variant but does not implement mallinfo().... X-Git-Tag: v10.0.0~67^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e138e78574e9d4e8159847ac4d94175ea9c3aec0;p=ceph.git common/MemoryModel: Alpine is a linux variant but does not implement mallinfo(). Added explicit feature check. Signed-off-by: John Coyle --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 35a5104abac0..3a76aa205efd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ CHECK_FUNCTION_EXISTS(posix_fadvise HAVE_POSIX_FADVISE) CHECK_FUNCTION_EXISTS(posix_fallocate HAVE_POSIX_FALLOCATE) CHECK_FUNCTION_EXISTS(syncfs HAVE_SYS_SYNCFS) CHECK_FUNCTION_EXISTS(sync_file_range HAVE_SYNC_FILE_RANGE) +CHECK_FUNCTION_EXISTS(mallinfo HAVE_MALLINFO) CHECK_INCLUDE_FILES("arpa/inet.h" HAVE_ARPA_INET_H) CHECK_INCLUDE_FILES("boost/random/discrete_distribution.hpp" HAVE_BOOST_RANDOM_DISCRETE_DISTRIBUTION) CHECK_INCLUDE_FILES("dirent.h" HAVE_DIRENT_H) diff --git a/configure.ac b/configure.ac index 9bef7677be28..9273413182aa 100644 --- a/configure.ac +++ b/configure.ac @@ -964,6 +964,10 @@ AC_CHECK_FUNC([fallocate], [AC_DEFINE([CEPH_HAVE_FALLOCATE], [], [fallocate(2) is supported])], []) +# mallinfo +AC_CHECK_FUNC([mallinfo], + [AC_DEFINE(HAVE_MALLINFO, 1, [Define if you have mallinfo])]) + # getgrouplist AC_CHECK_FUNCS([getgrouplist]) diff --git a/src/common/MemoryModel.cc b/src/common/MemoryModel.cc index f737a7b88d6d..ddc7fa949771 100644 --- a/src/common/MemoryModel.cc +++ b/src/common/MemoryModel.cc @@ -1,4 +1,5 @@ +#include "acconfig.h" #include "include/types.h" #include "MemoryModel.h" #include "common/config.h" @@ -92,7 +93,7 @@ void MemoryModel::_sample(snap *psnap) psnap->heap = heap >> 10; // ... -#if defined(__linux__) +#if defined(HAVE_MALLINFO) struct mallinfo mi = mallinfo(); psnap->malloc = mi.uordblks >> 10; diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake index 8486d4cd3cd9..0198792a2fe4 100644 --- a/src/include/config-h.in.cmake +++ b/src/include/config-h.in.cmake @@ -6,6 +6,9 @@ /* fallocate(2) is supported */ #cmakedefine CEPH_HAVE_FALLOCATE +/* mallinfo(3) is supported */ +#cmakedefine HAVE_MALLINFO + /* posix_fadvise is supported */ #cmakedefine HAVE_POSIX_FADVISE