* source here to get the value of the 'vars' pointer, but it is defined
* as 'static inline', so unfortunately none of this is possible.
*/
- flt_ot_vars_scope_dump(&(global.vars), "PROC");
+ flt_ot_vars_scope_dump(&(proc_vars), "PROC");
flt_ot_vars_scope_dump(&(s->sess->vars), "SESS");
flt_ot_vars_scope_dump(&(s->vars_txn), "TXN");
flt_ot_vars_scope_dump(&(s->vars_reqres), "REQ/RES");
struct vars *retptr = NULL;
if (strcasecmp(scope, "proc") == 0)
- retptr = &(global.vars);
+ retptr = &(proc_vars);
else if (strcasecmp(scope, "sess") == 0)
retptr = (&(s->sess->vars));
else if (strcasecmp(scope, "txn") == 0)
#include <haproxy/api-t.h>
#include <haproxy/buf-t.h>
#include <haproxy/freq_ctr-t.h>
-#include <haproxy/vars-t.h>
/* modes of operation (global.mode) */
#define MODE_DEBUG 0x01
unsigned int shctx_lookups, shctx_misses;
unsigned int req_count; /* request counter (HTTP or TCP session) for logs and unique_id */
int last_checks;
- struct vars vars; /* list of variables for the process scope. */
/* leave this at the end to make sure we don't share this cache line by accident */
ALWAYS_ALIGN(64);
#include <haproxy/api-t.h>
#include <haproxy/global-t.h>
#include <haproxy/mworker-t.h>
-#include <haproxy/vars-t.h>
extern const char *build_features;
extern struct global global;
#include <haproxy/stream-t.h>
#include <haproxy/vars-t.h>
+extern struct vars proc_vars;
+
void vars_init(struct vars *vars, enum vars_scope scope);
void var_accounting_diff(struct vars *vars, struct session *sess, struct stream *strm, int size);
unsigned int var_clear(struct var *var);
hlua_init();
/* Initialize process vars */
- vars_init(&global.vars, SCOPE_PROC);
+ vars_init(&proc_vars, SCOPE_PROC);
global.tune.options |= GTUNE_USE_SELECT; /* select() is always available */
#if defined(USE_POLL)
free(tff);
}
- vars_prune(&global.vars, NULL, NULL);
+ vars_prune(&proc_vars, NULL, NULL);
pool_destroy_all();
deinit_pollers();
} /* end deinit() */
/* This contains a pool of struct vars */
DECLARE_STATIC_POOL(var_pool, "vars", sizeof(struct var));
+/* list of variables for the process scope. */
+struct vars proc_vars THREAD_ALIGNED(64);
+
/* This array contain all the names of all the HAProxy vars.
* This permits to identify two variables name with
* only one pointer. It permits to not using strdup() for
{
switch (scope) {
case SCOPE_PROC:
- return &global.vars;
+ return &proc_vars;
case SCOPE_SESS:
return sess ? &sess->vars : NULL;
case SCOPE_CHECK: {
_HA_ATOMIC_ADD(&sess->vars.size, size);
/* fall through */
case SCOPE_PROC:
- _HA_ATOMIC_ADD(&global.vars.size, size);
+ _HA_ATOMIC_ADD(&proc_vars.size, size);
_HA_ATOMIC_ADD(&var_global_size, size);
}
}
return 0;
/* fall through */
case SCOPE_PROC:
- if (var_proc_limit && global.vars.size + size > var_proc_limit)
+ if (var_proc_limit && proc_vars.size + size > var_proc_limit)
return 0;
if (var_global_limit && var_global_size + size > var_global_limit)
return 0;
HA_RWLOCK_WRUNLOCK(VARS_LOCK, &vars->rwlock);
_HA_ATOMIC_SUB(&vars->size, size);
- _HA_ATOMIC_SUB(&global.vars.size, size);
+ _HA_ATOMIC_SUB(&proc_vars.size, size);
_HA_ATOMIC_SUB(&var_global_size, size);
}