Add new global.c file which is a common C file between haproxy and ha-ring.
Move <global> global struct variable definition from haproxy.c to global.c.
Add a declaration for this object to global-t.h.
Also move <stopping> from haproxy.c to global.c. Some C modules refer to
this variable. This is the case for the muxes.
endif
OBJS_COMMON += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o \
- src/stick_table.o src/tools.o \
+ src/stick_table.o src/tools.o src/global.o \
src/activity.o src/cli.o \
src/backend.o src/connection.o src/proxy.o \
src/cache.o src/stconn.o src/http_htx.o src/debug.o \
--- /dev/null
+#include <haproxy/global.h>
+#include <haproxy/list.h>
+#include <haproxy/protocol-t.h>
+#include <haproxy/ticks.h>
+
+/* global options */
+struct global global = {
+ .uid = -1, // not set
+ .gid = -1, // not set
+ .hard_stop_after = TICK_ETERNITY,
+ .close_spread_time = TICK_ETERNITY,
+ .close_spread_end = TICK_ETERNITY,
+ .numa_cpu_mapping = 1,
+ .nbthread = 0,
+ .req_count = 0,
+ .loggers = LIST_HEAD_INIT(global.loggers),
+ .maxzlibmem = DEFAULT_MAXZLIBMEM * 1024U * 1024U,
+ .comp_rate_lim = 0,
+ .ssl_server_verify = SSL_SERVER_VERIFY_REQUIRED,
+ .unix_bind = {
+ .ux = {
+ .uid = -1,
+ .gid = -1,
+ .mode = 0,
+ }
+ },
+ .tune = {
+ .options = GTUNE_LISTENER_MQ_OPT,
+ .bufsize = (BUFSIZE + 2*sizeof(void *) - 1) & -(2*sizeof(void *)),
+ .bufsize_small = BUFSIZE_SMALL,
+ .maxrewrite = MAXREWRITE,
+ .reserved_bufs = RESERVED_BUFS,
+ .pattern_cache = DEFAULT_PAT_LRU_SIZE,
+ .pool_low_ratio = 20,
+ .pool_high_ratio = 25,
+ .max_http_hdr = MAX_HTTP_HDR,
+#ifdef USE_OPENSSL
+ .sslcachesize = SSLCACHESIZE,
+#endif
+ .comp_maxlevel = 1,
+ .glitch_kill_maxidle = 100,
+#ifdef DEFAULT_IDLE_TIMER
+ .idle_timer = DEFAULT_IDLE_TIMER,
+#else
+ .idle_timer = 1000, /* 1 second */
+#endif
+ .nb_stk_ctr = MAX_SESS_STKCTR,
+ .default_shards = -2, /* by-group */
+ },
+#ifdef USE_OPENSSL
+#ifdef DEFAULT_MAXSSLCONN
+ .maxsslconn = DEFAULT_MAXSSLCONN,
+#endif
+#endif
+ /* by default allow clients which use a privileged port for TCP only */
+ .clt_privileged_ports = HA_PROTO_TCP,
+ /* others NULL OK */
+};
+
+int stopping; /* non zero means stopping in progress */
static unsigned long stopping_tgroup_mask; /* Thread groups acknowledging stopping */
-/* global options */
-struct global global = {
- .uid = -1, // not set
- .gid = -1, // not set
- .hard_stop_after = TICK_ETERNITY,
- .close_spread_time = TICK_ETERNITY,
- .close_spread_end = TICK_ETERNITY,
- .numa_cpu_mapping = 1,
- .nbthread = 0,
- .req_count = 0,
- .loggers = LIST_HEAD_INIT(global.loggers),
- .maxzlibmem = DEFAULT_MAXZLIBMEM * 1024U * 1024U,
- .comp_rate_lim = 0,
- .ssl_server_verify = SSL_SERVER_VERIFY_REQUIRED,
- .unix_bind = {
- .ux = {
- .uid = -1,
- .gid = -1,
- .mode = 0,
- }
- },
- .tune = {
- .options = GTUNE_LISTENER_MQ_OPT,
- .bufsize = (BUFSIZE + 2*sizeof(void *) - 1) & -(2*sizeof(void *)),
- .bufsize_small = BUFSIZE_SMALL,
- .maxrewrite = MAXREWRITE,
- .reserved_bufs = RESERVED_BUFS,
- .pattern_cache = DEFAULT_PAT_LRU_SIZE,
- .pool_low_ratio = 20,
- .pool_high_ratio = 25,
- .max_http_hdr = MAX_HTTP_HDR,
-#ifdef USE_OPENSSL
- .sslcachesize = SSLCACHESIZE,
-#endif
- .comp_maxlevel = 1,
- .glitch_kill_maxidle = 100,
-#ifdef DEFAULT_IDLE_TIMER
- .idle_timer = DEFAULT_IDLE_TIMER,
-#else
- .idle_timer = 1000, /* 1 second */
-#endif
- .nb_stk_ctr = MAX_SESS_STKCTR,
- .default_shards = -2, /* by-group */
- },
-#ifdef USE_OPENSSL
-#ifdef DEFAULT_MAXSSLCONN
- .maxsslconn = DEFAULT_MAXSSLCONN,
-#endif
-#endif
- /* by default allow clients which use a privileged port for TCP only */
- .clt_privileged_ports = HA_PROTO_TCP,
- /* others NULL OK */
-};
-
/*********************************************************************/
-int stopping; /* non zero means stopping in progress */
int killed; /* non zero means a hard-stop is triggered */
int jobs = 0; /* number of active jobs (conns, listeners, active tasks, ...) */
int unstoppable_jobs = 0; /* number of active jobs that can't be stopped during a soft stop */