process: Remove use of mallinfo for Musl

This commit is contained in:
klzgrad 2019-11-30 22:37:05 +08:00
parent 89aa824a5a
commit 4a5bd1fd32

View File

@ -110,6 +110,9 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) {
namespace { namespace {
size_t GetMallocUsageMallinfo() { size_t GetMallocUsageMallinfo() {
#if defined(__MUSL__)
return 0;
#else
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 33) #if __GLIBC_PREREQ(2, 33)
#define MALLINFO2_FOUND_IN_LIBC #define MALLINFO2_FOUND_IN_LIBC
@ -121,6 +124,7 @@ size_t GetMallocUsageMallinfo() {
#endif #endif
#undef MALLINFO2_FOUND_IN_LIBC #undef MALLINFO2_FOUND_IN_LIBC
return checked_cast<size_t>(minfo.hblkhd + minfo.arena); return checked_cast<size_t>(minfo.hblkhd + minfo.arena);
#endif
} }
} // namespace } // namespace