From: Willy Tarreau Date: Sat, 8 May 2021 10:30:50 +0000 (+0200) Subject: REORG: mworker: move proc_self from global to mworker X-Git-Tag: v2.4-dev19~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15f9ac3c59e9bef455b75ab97020f41155c4ea7a;p=thirdparty%2Fhaproxy.git REORG: mworker: move proc_self from global to mworker Only mworker uses proc_self, and it was declared in global.h, forcing users of global.h to include mworker and its dependencies. Moving it to mworker reduces the preprocessed size of version.c from 170 to 125kB by shrinking the number of local includes from 30 to 16 and the number of system includes from 147 to 132. --- diff --git a/include/haproxy/cli.h b/include/haproxy/cli.h index 0a4433b692..31020430ef 100644 --- a/include/haproxy/cli.h +++ b/include/haproxy/cli.h @@ -27,6 +27,7 @@ #include #include #include +#include #include diff --git a/include/haproxy/global.h b/include/haproxy/global.h index 547a2b8cee..a095a5268b 100644 --- a/include/haproxy/global.h +++ b/include/haproxy/global.h @@ -24,7 +24,6 @@ #include #include -#include extern const char *build_features; extern struct global global; @@ -49,7 +48,6 @@ extern char *localpeer; extern unsigned int warned; /* bitfield of a few warnings to emit just once */ extern volatile unsigned long sleeping_thread_mask; extern struct list proc_list; /* list of process in mworker mode */ -extern struct mworker_proc *proc_self; /* process structure of current process */ extern int master; /* 1 if in master, 0 otherwise */ extern unsigned int rlim_fd_cur_at_boot; extern unsigned int rlim_fd_max_at_boot; diff --git a/include/haproxy/mworker.h b/include/haproxy/mworker.h index edc612ec30..434077c0c0 100644 --- a/include/haproxy/mworker.h +++ b/include/haproxy/mworker.h @@ -17,6 +17,8 @@ #include #include +extern struct mworker_proc *proc_self; + void mworker_proc_list_to_env(); void mworker_env_to_proc_list(); diff --git a/src/haproxy.c b/src/haproxy.c index 3de53bfceb..41715c1050 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -252,8 +252,6 @@ unsigned int rlim_fd_max_at_boot = 0; /* per-boot randomness */ unsigned char boot_seed[20]; /* per-boot random seed (160 bits initially) */ -struct mworker_proc *proc_self = NULL; - static void *run_thread_poll_loop(void *data); /* bitfield of a few warnings to emit just once (WARN_*) */ diff --git a/src/mworker.c b/src/mworker.c index e3c579b571..b69c1adcb2 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -42,6 +42,7 @@ static int exitcode = -1; static int max_reloads = -1; /* number max of reloads a worker can have until they are killed */ +struct mworker_proc *proc_self = NULL; /* process structure of current process */ /* ----- children processes handling ----- */