diff --git a/include/haproxy/bug.h b/include/haproxy/bug.h index 52a1ebe6b..ebd4a0e58 100644 --- a/include/haproxy/bug.h +++ b/include/haproxy/bug.h @@ -28,6 +28,7 @@ #ifndef _HAPROXY_BUG_H #define _HAPROXY_BUG_H +#include #include /* quick debugging hack, should really be removed ASAP */ @@ -97,6 +98,28 @@ *__x = NULL; \ } while (0) + +/* handle 'tainted' status */ +enum tainted_flags { + TAINTED_CONFIG_EXP_KW_DECLARED = 0x00000001, + TAINTED_ACTION_EXP_EXECUTED = 0x00000002, + TAINTED_CLI_EXPERT_MODE = 0x00000004, + TAINTED_CLI_EXPERIMENTAL_MODE = 0x00000008, +}; + +/* this is a bit field made of TAINTED_*, and is declared in haproxy.c */ +extern unsigned int tainted; + +static inline void mark_tainted(const enum tainted_flags flag) +{ + HA_ATOMIC_OR(&tainted, flag); +} + +static inline unsigned int get_tainted() +{ + return HA_ATOMIC_LOAD(&tainted); +} + #if defined(DEBUG_MEM_STATS) #include #include diff --git a/include/haproxy/global.h b/include/haproxy/global.h index 03c21d535..9d9a7fc48 100644 --- a/include/haproxy/global.h +++ b/include/haproxy/global.h @@ -82,16 +82,6 @@ static inline unsigned long proc_mask(unsigned long mask) return mask ? mask : 1; } -/* handle 'tainted' status */ -enum tainted_flags { - TAINTED_CONFIG_EXP_KW_DECLARED = 0x1, - TAINTED_ACTION_EXP_EXECUTED = 0x2, - TAINTED_CLI_EXPERT_MODE = 0x4, - TAINTED_CLI_EXPERIMENTAL_MODE = 0x8, -}; -void mark_tainted(const enum tainted_flags flag); -unsigned int get_tainted(void); - extern unsigned int experimental_directives_allowed; struct cfg_keyword; diff --git a/src/haproxy.c b/src/haproxy.c index 7a659f798..0da19ccdf 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -261,7 +261,7 @@ static void *run_thread_poll_loop(void *data); unsigned int warned = 0; /* set if experimental features have been used for the current process */ -static unsigned int tainted = 0; +unsigned int tainted = 0; unsigned int experimental_directives_allowed = 0; @@ -1449,17 +1449,6 @@ static int check_if_maxsock_permitted(int maxsock) return ret == 0; } -void mark_tainted(const enum tainted_flags flag) -{ - HA_ATOMIC_OR(&tainted, flag); -} - -unsigned int get_tainted() -{ - return HA_ATOMIC_LOAD(&tainted); -} - - /* This performs th every basic early initialization at the end of the PREPARE * init stage. It may only assume that list heads are initialized, but not that * anything else is correct. It will initialize a number of variables that