diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2017-08-23 16:18:49 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-08-24 00:18:50 +0200 |
| commit | 9eed278b163d2175ee714869085a54f2c3726cca (patch) | |
| tree | 057333fac7216df3a989f1b9cc589ee40d6b1762 /lib/memory.h | |
| parent | 9d1c2659293a757a672bf0aa0d2f5ca20a2b28e5 (diff) | |
lib: centralized memstats-at-exit
adds a new all-daemon "debug memstats-at-exit" command. Also saves
memstats to a file in /tmp, useful if a long-running daemon is having
weird issues (e.g. in a user install).
Fixes: #437
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/memory.h')
| -rw-r--r-- | lib/memory.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/memory.h b/lib/memory.h index d5facad583..132d4abd30 100644 --- a/lib/memory.h +++ b/lib/memory.h @@ -18,6 +18,7 @@ #define _QUAGGA_MEMORY_H #include <stdlib.h> +#include <stdio.h> #include <frratomic.h> #define array_size(ar) (sizeof(ar) / sizeof(ar[0])) @@ -194,7 +195,8 @@ static inline size_t mtype_stats_alloc(struct memtype *mt) * last value from qmem_walk_fn. */ typedef int qmem_walk_fn(void *arg, struct memgroup *mg, struct memtype *mt); extern int qmem_walk(qmem_walk_fn *func, void *arg); -extern void log_memstats_stderr(const char *); +extern int log_memstats(FILE *fp, const char *); +#define log_memstats_stderr(prefix) log_memstats(stderr, prefix) extern void memory_oom(size_t size, const char *name); |
