diff --git a/include/haproxy/global.h b/include/haproxy/global.h index d3f2e7ee2..20a0950ea 100644 --- a/include/haproxy/global.h +++ b/include/haproxy/global.h @@ -96,6 +96,13 @@ static inline unsigned long thread_mask(unsigned long mask) return mask ? mask : all_threads_mask; } +/* handle 'tainted' status */ +enum tainted_flags { + TAINTED_UNIMPLEMENTED, // TO REMOVE once an enum value is implemented +}; +void mark_tainted(const enum tainted_flags flag); +unsigned int get_tainted(); + /* simplified way to declare static build options in a file */ #define REGISTER_BUILD_OPTS(str) \ INITCALL2(STG_REGISTER, hap_register_build_opts, (str), 0) diff --git a/src/haproxy.c b/src/haproxy.c index ef4a40ca6..4c7ff556e 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -259,6 +259,9 @@ static void *run_thread_poll_loop(void *data); /* bitfield of a few warnings to emit just once (WARN_*) */ unsigned int warned = 0; +/* set if experimental features have been used for the current process */ +static unsigned int tainted = 0; + /* master CLI configuration (-S flag) */ struct list mworker_cli_conf = LIST_HEAD_INIT(mworker_cli_conf); @@ -1417,6 +1420,17 @@ 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() +{ + int tainted_state; + HA_ATOMIC_STORE(&tainted_state, tainted); + return tainted_state; +} /* * This function initializes all the necessary variables. It only returns