From b58aa9ad6ff0972f8fe3297fe9efcedaacb1b506 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 8 Mar 2017 00:32:21 +0100 Subject: [PATCH] Fix malloc_stats() call for newer uClibc-ng versions --- src/eitd/sectionsd.cpp | 28 +++++++++++++--------------- src/neutrino.cpp | 4 ++++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 4b79b389b..b271f6338 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -55,6 +55,16 @@ #include "xmlutil.h" #include "debug.h" +#ifdef __UCLIBC__ +#if (__UCLIBC_MAJOR__ >= 1) && (__UCLIBC_MINOR__ >= 0) && (__UCLIBC_SUBLEVEL__ >= 10) +#define MALLOC_STATS(a) malloc_stats() +#else +#define MALLOC_STATS(a) malloc_stats(a) +#endif +#else +#define MALLOC_STATS(a) malloc_stats() +#endif + //#define ENABLE_SDT //FIXME //#define DEBUG_SDT_THREAD @@ -1067,11 +1077,7 @@ static void commandDumpStatusInformation(int /*connfd*/, char* /*data*/, const u // resourceUsage.ru_maxrss, resourceUsage.ru_ixrss, resourceUsage.ru_idrss, resourceUsage.ru_isrss, ); printf("%s\n", stati); -#ifdef __UCLIBC__ - malloc_stats(NULL); -#else - malloc_stats(); -#endif + MALLOC_STATS(NULL); return ; } @@ -1200,11 +1206,7 @@ static void FreeMemory() unlockEvents(); -#ifdef __UCLIBC__ - malloc_stats(NULL); -#else - malloc_stats(); -#endif + MALLOC_STATS(NULL); xprintf("[sectionsd] free memory done\n"); //wakeupAll(); //FIXME should we re-start eit here ? } @@ -2054,11 +2056,7 @@ static void print_meminfo(void) if (!sections_debug) return; -#ifdef __UCLIBC__ - malloc_stats(NULL); -#else - malloc_stats(); -#endif + MALLOC_STATS(NULL); } //--------------------------------------------------------------------- diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0b9848d3a..93f104ce6 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -4707,7 +4707,11 @@ void CNeutrinoApp::Cleanup() printf("cleanup 6\n");fflush(stdout); delete CVFD::getInstance(); #ifdef __UCLIBC__ +#if (__UCLIBC_MAJOR__ >= 1) && (__UCLIBC_MINOR__ >= 0) && (__UCLIBC_SUBLEVEL__ >= 10) + malloc_stats(); +#else malloc_stats(NULL); +#endif #else malloc_stats(); #endif