diff options
-rw-r--r-- | lib/libc/stdlib/malloc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index c67607e8fee..688354f1e01 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.216 2017/03/24 16:15:31 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.217 2017/03/24 16:23:05 otto Exp $ */ /* * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> @@ -211,6 +211,8 @@ static void fill_canary(char *ptr, size_t sz, size_t allocated); #ifdef MALLOC_STATS void malloc_dump(int, int, struct dir_info *); PROTO_NORMAL(malloc_dump); +void malloc_gdump(int); +PROTO_NORMAL(malloc_gdump); static void malloc_exit(void); #define CALLER __builtin_return_address(0) #else @@ -2244,6 +2246,19 @@ malloc_dump(int fd, int poolno, struct dir_info *pool) } DEF_WEAK(malloc_dump); +void +malloc_gdump(int fd) +{ + int i; + int saved_errno = errno; + + for (i = 0; i < _MALLOC_MUTEXES; i++) + malloc_dump(fd, i, mopts.malloc_pool[i]); + + errno = saved_errno; +} +DEF_WEAK(malloc_gdump); + static void malloc_exit(void) { |