summaryrefslogtreecommitdiffstats
path: root/lib/zlog_targets.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-12-02 16:20:00 +0100
committerDavid Lamparter <equinox@diac24.net>2020-04-01 06:53:26 +0200
commit767439c55858d65bf6f5776b7fcd36cc1132565c (patch)
treed6eb0daa9975f6ff20eca5b69955af23a7db97ad /lib/zlog_targets.c
parentlib: rewrite zlog lock-free & TLS-buffered (diff)
downloadfrr-767439c55858d65bf6f5776b7fcd36cc1132565c.tar.xz
frr-767439c55858d65bf6f5776b7fcd36cc1132565c.zip
lib: mark some allocations as "active at exit"
In some cases we really don't want to clean up things even when exiting (i.e. to keep the logging subsystem going.) This adds a flag on MGROUPs to indicate that. [v2: add "(active at exit)" marker text to debug memstats-at-exit] Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/zlog_targets.c')
-rw-r--r--lib/zlog_targets.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/zlog_targets.c b/lib/zlog_targets.c
index ff9cd1e5f..85991b0dd 100644
--- a/lib/zlog_targets.c
+++ b/lib/zlog_targets.c
@@ -26,10 +26,18 @@
#include "zlog.h"
#include "zlog_targets.h"
-DEFINE_MTYPE_STATIC(LIB, LOG_FD, "log file target")
-DEFINE_MTYPE_STATIC(LIB, LOG_FD_NAME, "log file name")
-DEFINE_MTYPE_STATIC(LIB, LOG_FD_ROTATE, "log file rotate helper")
-DEFINE_MTYPE_STATIC(LIB, LOG_SYSL, "syslog target")
+/* these allocations are intentionally left active even when doing full exit
+ * cleanup, in order to keep the logging subsystem fully functional until the
+ * absolute end.
+ */
+
+DECLARE_MGROUP(LOG)
+DEFINE_MGROUP_ACTIVEATEXIT(LOG, "logging subsystem")
+
+DEFINE_MTYPE_STATIC(LOG, LOG_FD, "log file target")
+DEFINE_MTYPE_STATIC(LOG, LOG_FD_NAME, "log file name")
+DEFINE_MTYPE_STATIC(LOG, LOG_FD_ROTATE, "log file rotate helper")
+DEFINE_MTYPE_STATIC(LOG, LOG_SYSL, "syslog target")
struct zlt_fd {
struct zlog_target zt;