CLEANUP: global: introduce variable pid_bit to avoid shifts with relative_pid
At a number of places, bitmasks are used for process affinity and to map
listeners to processes. Every time 1UL<<(relative_pid-1) is used. Let's
create a "pid_bit" variable corresponding to this value to clean this up.
diff --git a/src/haproxy.c b/src/haproxy.c
index 8993b89..a22ed32 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -118,6 +118,7 @@
static struct list cfg_cfgfiles = LIST_HEAD_INIT(cfg_cfgfiles);
int pid; /* current process id */
int relative_pid = 1; /* process id starting at 1 */
+unsigned long pid_bit = 1; /* bit corresponding to the process id */
/* global options */
struct global global = {
@@ -2655,6 +2656,7 @@
shut_your_big_mouth_gcc(write(pidfd, pidstr, strlen(pidstr)));
}
relative_pid++; /* each child will get a different one */
+ pid_bit <<= 1;
}
#ifdef USE_CPU_AFFINITY