0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 01:31:55 +00:00

Merge commit 'fc2b4b26' into thread-merge-2.16

Actually, completely rewritten the original patch as in v3, the logging
initialization is much more complex and requires allocation.

This way, to bootstrap properly, the logger has a pre-defined log target
to stderr.
This commit is contained in:
Maria Matejka 2024-11-29 12:05:40 +01:00
commit ffba45657e

View File

@ -51,7 +51,7 @@ static struct log_channel * _Atomic global_logs;
/* Logging flags to validly prepare logging messages */ /* Logging flags to validly prepare logging messages */
static _Atomic uint logging_flags; static _Atomic uint logging_flags;
static _Atomic uint logging_mask; static _Atomic uint logging_mask = ~0U;
#ifdef HAVE_SYSLOG_H #ifdef HAVE_SYSLOG_H
#include <sys/syslog.h> #include <sys/syslog.h>
@ -189,9 +189,20 @@ log_commit(log_buffer *buf)
memcpy(buf->buf.end - sizeof TOO_LONG, TOO_LONG, sizeof TOO_LONG); memcpy(buf->buf.end - sizeof TOO_LONG, TOO_LONG, sizeof TOO_LONG);
#undef TOO_LONG #undef TOO_LONG
struct log_channel *glogs = atomic_load_explicit(&global_logs, memory_order_acquire);
if (!glogs)
{
static struct log_channel initial_stderr_log = {
.rf = &rf_stderr,
.mask = ~0,
.prepare = BIT32_ALL(LBPP_TERMINAL, LBP_CLASS, LBP_MSG),
};
glogs = &initial_stderr_log;
}
for ( for (
struct log_channel *l = atomic_load_explicit(&global_logs, memory_order_acquire); struct log_channel *l = glogs; l;
l;
l = atomic_load_explicit(&l->next, memory_order_acquire) l = atomic_load_explicit(&l->next, memory_order_acquire)
) )
{ {