mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
DEBUG: move the tainted stuff to bug.h for easier inclusion
The functions needed to manipulate the "tainted" flags were located in too high a level to be callable from the lower code layers. Let's move them to bug.h.
This commit is contained in:
parent
9b4a0e6bac
commit
edd426871f
@ -28,6 +28,7 @@
|
|||||||
#ifndef _HAPROXY_BUG_H
|
#ifndef _HAPROXY_BUG_H
|
||||||
#define _HAPROXY_BUG_H
|
#define _HAPROXY_BUG_H
|
||||||
|
|
||||||
|
#include <haproxy/atomic.h>
|
||||||
#include <haproxy/compiler.h>
|
#include <haproxy/compiler.h>
|
||||||
|
|
||||||
/* quick debugging hack, should really be removed ASAP */
|
/* quick debugging hack, should really be removed ASAP */
|
||||||
@ -97,6 +98,28 @@
|
|||||||
*__x = NULL; \
|
*__x = NULL; \
|
||||||
} while (0)
|
} 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)
|
#if defined(DEBUG_MEM_STATS)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -82,16 +82,6 @@ static inline unsigned long proc_mask(unsigned long mask)
|
|||||||
return mask ? mask : 1;
|
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;
|
extern unsigned int experimental_directives_allowed;
|
||||||
|
|
||||||
struct cfg_keyword;
|
struct cfg_keyword;
|
||||||
|
@ -261,7 +261,7 @@ static void *run_thread_poll_loop(void *data);
|
|||||||
unsigned int warned = 0;
|
unsigned int warned = 0;
|
||||||
|
|
||||||
/* set if experimental features have been used for the current process */
|
/* 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;
|
unsigned int experimental_directives_allowed = 0;
|
||||||
|
|
||||||
@ -1449,17 +1449,6 @@ static int check_if_maxsock_permitted(int maxsock)
|
|||||||
return ret == 0;
|
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
|
/* 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
|
* 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
|
* anything else is correct. It will initialize a number of variables that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user