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.
Austin S. Hemmelgarn committed
Apr 11, 2024 at 07:40 UTC
8c84a6241ba89cd10b257ca37b442cf358ac7597
2 files changed
-10
src/libnetdata/log/log.c
-9
@@ -367,12 +367,6 @@ struct nd_log_source {
367
struct nd_log_limit limits;
368
};
369
370
-static __thread ND_LOG_SOURCES overwrite_thread_source = 0;
371
-
372
-void nd_log_set_thread_source(ND_LOG_SOURCES source) {
373
- overwrite_thread_source = source;
374
-}
375
-
370
static struct {
371
uuid_t invocation_id;
372
@@ -2237,9 +2231,6 @@ static ND_LOG_SOURCES nd_log_validate_source(ND_LOG_SOURCES source) {
2231
if(source >= _NDLS_MAX)
2232
source = NDLS_DAEMON;
2233
2240
- if(overwrite_thread_source)
2241
- source = overwrite_thread_source;
2242
-
2234
if(nd_log.overwrite_process_source)
2235
source = nd_log.overwrite_process_source;
2236
src/libnetdata/log/log.h
-1
@@ -150,7 +150,6 @@ void chown_open_file(int fd, uid_t uid, gid_t gid);
150
void nd_log_chown_log_files(uid_t uid, gid_t gid);
151
void nd_log_set_flood_protection(size_t logs, time_t period);
152
void nd_log_initialize_for_external_plugins(const char *name);
153
-void nd_log_set_thread_source(ND_LOG_SOURCES source);
153
bool nd_log_journal_socket_available(void);
154
ND_LOG_FIELD_ID nd_log_field_id_by_name(const char *field, size_t len);
155
int nd_log_priority2id(const char *priority);