diff options
Diffstat (limited to 'lib/scudo/standalone/wrappers_c.inc')
-rw-r--r-- | lib/scudo/standalone/wrappers_c.inc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/scudo/standalone/wrappers_c.inc b/lib/scudo/standalone/wrappers_c.inc index 2beddc724800..a9adbc83588b 100644 --- a/lib/scudo/standalone/wrappers_c.inc +++ b/lib/scudo/standalone/wrappers_c.inc @@ -38,8 +38,17 @@ INTERFACE WEAK struct SCUDO_MALLINFO SCUDO_PREFIX(mallinfo)(void) { struct SCUDO_MALLINFO Info = {}; scudo::StatCounters Stats; SCUDO_ALLOCATOR.getStats(Stats); + // Space allocated in mmapped regions (bytes) + Info.hblkhd = static_cast<__scudo_mallinfo_data_t>(Stats[scudo::StatMapped]); + // Maximum total allocated space (bytes) + Info.usmblks = Info.hblkhd; + // Space in freed fastbin blocks (bytes) + Info.fsmblks = static_cast<__scudo_mallinfo_data_t>(Stats[scudo::StatFree]); + // Total allocated space (bytes) Info.uordblks = static_cast<__scudo_mallinfo_data_t>(Stats[scudo::StatAllocated]); + // Total free space (bytes) + Info.fordblks = Info.fsmblks; return Info; } @@ -170,7 +179,8 @@ INTERFACE WEAK void *SCUDO_PREFIX(aligned_alloc)(size_t alignment, SCUDO_ALLOCATOR.allocate(size, scudo::Chunk::Origin::Malloc, alignment)); } -INTERFACE WEAK int SCUDO_PREFIX(malloc_info)(int, FILE *) { - errno = ENOTSUP; - return -1; +INTERFACE WEAK int SCUDO_PREFIX(malloc_info)(UNUSED int options, FILE *stream) { + fputs("<malloc version=\"scudo-1\">", stream); + fputs("</malloc>", stream); + return 0; } |