From 8c84a6241ba89cd10b257ca37b442cf358ac7597 Mon Sep 17 00:00:00 2001 From: "Austin S. Hemmelgarn" Date: Thu, 11 Apr 2024 07:40:52 -0400 Subject: Remove seemingly dead logging related code from libnetdata. (#17320) Remove seemingly dead code from libnetdata. overwrite_thread_source is only accessed in two locations: - It gets written to only by nd_log_set_thread_source, which does not appear to ever be called anywhere in our current code. - It is only ever read by nd_log_validate_source, which because nd_log_set_thread_source is never called should never end up resulting in any actual behavioral changes (since it will always be 0). Based on this, the code is functionally dead, and therefore can safely be removed. --- src/libnetdata/log/log.c | 9 --------- src/libnetdata/log/log.h | 1 - 2 files changed, 10 deletions(-) diff --git a/src/libnetdata/log/log.c b/src/libnetdata/log/log.c index bfba93ddb2..2be7a78813 100644 --- a/src/libnetdata/log/log.c +++ b/src/libnetdata/log/log.c @@ -367,12 +367,6 @@ struct nd_log_source { struct nd_log_limit limits; }; -static __thread ND_LOG_SOURCES overwrite_thread_source = 0; - -void nd_log_set_thread_source(ND_LOG_SOURCES source) { - overwrite_thread_source = source; -} - static struct { uuid_t invocation_id; @@ -2237,9 +2231,6 @@ static ND_LOG_SOURCES nd_log_validate_source(ND_LOG_SOURCES source) { if(source >= _NDLS_MAX) source = NDLS_DAEMON; - if(overwrite_thread_source) - source = overwrite_thread_source; - if(nd_log.overwrite_process_source) source = nd_log.overwrite_process_source; diff --git a/src/libnetdata/log/log.h b/src/libnetdata/log/log.h index 51d6c8bff5..3bafbe89bf 100644 --- a/src/libnetdata/log/log.h +++ b/src/libnetdata/log/log.h @@ -150,7 +150,6 @@ void chown_open_file(int fd, uid_t uid, gid_t gid); void nd_log_chown_log_files(uid_t uid, gid_t gid); void nd_log_set_flood_protection(size_t logs, time_t period); void nd_log_initialize_for_external_plugins(const char *name); -void nd_log_set_thread_source(ND_LOG_SOURCES source); bool nd_log_journal_socket_available(void); ND_LOG_FIELD_ID nd_log_field_id_by_name(const char *field, size_t len); int nd_log_priority2id(const char *priority); -- cgit v1.2.3