From d5c9fe6a415e87b2412d50770ddcbcb82df2ff3c Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sat, 30 Nov 2019 22:36:22 +0800 Subject: [PATCH] musl: base: Remove use of mallinfo --- src/base/process/process_metrics_posix.cc | 4 ++++ src/base/trace_event/malloc_dump_provider.cc | 1 + 2 files changed, 5 insertions(+) diff --git a/src/base/process/process_metrics_posix.cc b/src/base/process/process_metrics_posix.cc index 9a25ea7081..24ca40a3a3 100644 --- a/src/base/process/process_metrics_posix.cc +++ b/src/base/process/process_metrics_posix.cc @@ -110,6 +110,9 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) { namespace { size_t GetMallocUsageMallinfo() { +#if defined(__MUSL__) + return 0; +#else #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if __GLIBC_PREREQ(2, 33) #define MALLINFO2_FOUND_IN_LIBC @@ -121,6 +124,7 @@ size_t GetMallocUsageMallinfo() { #endif #undef MALLINFO2_FOUND_IN_LIBC return checked_cast(minfo.hblkhd + minfo.arena); +#endif } } // namespace diff --git a/src/base/trace_event/malloc_dump_provider.cc b/src/base/trace_event/malloc_dump_provider.cc index b5e0f05479..03f5d4ec77 100644 --- a/src/base/trace_event/malloc_dump_provider.cc +++ b/src/base/trace_event/malloc_dump_provider.cc @@ -368,6 +368,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, &allocated_objects_count); #elif BUILDFLAG(IS_FUCHSIA) // TODO(fuchsia): Port, see https://crbug.com/706592. +#elif defined(__MUSL__) #else ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size, &allocated_objects_size, &allocated_objects_count);