summaryrefslogtreecommitdiff
path: root/lib/libfrr.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-07-26 16:44:59 -0700
committerDavid Lamparter <equinox@opensourcerouting.org>2024-10-17 13:58:57 +0200
commitb3e400719750b4b40851be6044315b48f07722cb (patch)
tree1162e88f4e98ed4692301331406a41dc28296ef7 /lib/libfrr.c
parentf177663631c25d59643b4a75036586d90c6c25de (diff)
lib: refactor memstats logging, fix ACTIVEATEXIT
Move the various destinations handling into lib/memory.c, include "normal" logging as target, and make `ACTIVEATEXIT` properly non-error as it was intended to be. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/libfrr.c')
-rw-r--r--lib/libfrr.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c
index 00ee57d8aa..b9b70f60f7 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -1245,10 +1245,6 @@ void frr_early_fini(void)
void frr_fini(void)
{
- FILE *fp;
- char filename[128];
- int have_leftovers = 0;
-
hook_call(frr_fini);
vty_terminate();
@@ -1289,26 +1285,7 @@ void frr_fini(void)
frrmod_terminate();
- /* also log memstats to stderr when stderr goes to a file*/
- if (debug_memstats_at_exit || !isatty(STDERR_FILENO))
- have_leftovers = log_memstats(stderr, di->name);
-
- /* in case we decide at runtime that we want exit-memstats for
- * a daemon
- * (only do this if we actually have something to print though)
- */
- if (!debug_memstats_at_exit || !have_leftovers)
- return;
-
- snprintf(filename, sizeof(filename), "/tmp/frr-memstats-%s-%llu-%llu",
- di->name, (unsigned long long)getpid(),
- (unsigned long long)time(NULL));
-
- fp = fopen(filename, "w");
- if (fp) {
- log_memstats(fp, di->name);
- fclose(fp);
- }
+ log_memstats(di->name, debug_memstats_at_exit);
}
struct json_object *frr_daemon_state_load(void)