From 84f44672414575d1e8e19cbb1b2504e682d82f83 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 7 Jul 2023 14:18:59 -0400 Subject: [PATCH] MT#56374 move rtpe_shutdown to auxlib This is a dependency of the poller and so is needed in lib/ as well to make it usable. Also consolidate the type. Change-Id: I70ec8a200d6cd65710ac93636a9495cf24c35ef4 --- daemon/helpers.c | 1 - daemon/main.c | 2 +- include/helpers.h | 7 ------- lib/auxlib.c | 1 + lib/auxlib.h | 2 +- lib/poller.c | 1 + 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/daemon/helpers.c b/daemon/helpers.c index 447140b18..3656604bf 100644 --- a/daemon/helpers.c +++ b/daemon/helpers.c @@ -47,7 +47,6 @@ static cond_t threads_cond = COND_STATIC_INIT; static mutex_t thread_wakers_lock = MUTEX_STATIC_INIT; static GList *thread_wakers; -volatile int rtpe_shutdown; #ifdef NEED_ATOMIC64_MUTEX mutex_t __atomic64_mutex = MUTEX_STATIC_INIT; diff --git a/daemon/main.c b/daemon/main.c index b68594f39..5f5794796 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -131,7 +131,7 @@ static void sighandler(gpointer x) { } if (ret == SIGINT || ret == SIGTERM) - rtpe_shutdown = 1; + rtpe_shutdown = true; else if (ret == SIGUSR1) { for (unsigned int i = 0; i < num_log_levels; i++) { g_atomic_int_add(&rtpe_config.common.log_levels[i], -1); diff --git a/include/helpers.h b/include/helpers.h index add4a246f..ac8f1b234 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -51,13 +51,6 @@ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ -/*** GLOBALS ***/ - -extern volatile int rtpe_shutdown; - - - - /*** PROTOTYPES ***/ typedef int (*parse_func)(char **, void **, void *); diff --git a/lib/auxlib.c b/lib/auxlib.c index b63c3ff78..108cc93b2 100644 --- a/lib/auxlib.c +++ b/lib/auxlib.c @@ -22,6 +22,7 @@ struct thread_buf { static int version; struct rtpengine_common_config *rtpe_common_config_ptr; __thread struct timeval rtpe_now; +volatile bool rtpe_shutdown; static __thread struct thread_buf t_bufs[NUM_THREAD_BUFS]; static __thread int t_buf_idx; diff --git a/lib/auxlib.h b/lib/auxlib.h index fb3e29b28..44cf1de32 100644 --- a/lib/auxlib.h +++ b/lib/auxlib.h @@ -41,7 +41,7 @@ extern struct rtpengine_common_config *rtpe_common_config_ptr; /*** GLOBALS ***/ extern __thread struct timeval rtpe_now; -extern volatile int rtpe_shutdown; +extern volatile bool rtpe_shutdown; diff --git a/lib/poller.c b/lib/poller.c index 4c0b3c4bf..f1782f140 100644 --- a/lib/poller.c +++ b/lib/poller.c @@ -16,6 +16,7 @@ #include "obj.h" #include "log_funcs.h" +#include "auxlib.h"