mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-01 22:48:25 +00:00
MINOR: config: keep an all_proc_mask like we have all_threads_mask
This simplifies some mask comparisons at various places where nbits(global.nbproc) was used.
This commit is contained in:
parent
cafa56ecd6
commit
a38a7175b1
@ -198,6 +198,7 @@ extern struct global global;
|
||||
extern int pid; /* current process id */
|
||||
extern int relative_pid; /* process id starting at 1 */
|
||||
extern unsigned long pid_bit; /* bit corresponding to the process id */
|
||||
extern unsigned long all_proc_mask; /* mask of all processes */
|
||||
extern int actconn; /* # of active sessions */
|
||||
extern int listeners;
|
||||
extern int jobs; /* # of active jobs (listeners, sessions, open devices) */
|
||||
|
@ -489,6 +489,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
global.nbproc = atol(args[1]);
|
||||
all_proc_mask = nbits(global.nbproc);
|
||||
if (global.nbproc < 1 || global.nbproc > LONGBITS) {
|
||||
ha_alert("parsing [%s:%d] : '%s' must be between 1 and %d (was %d).\n",
|
||||
file, linenum, args[0], LONGBITS, global.nbproc);
|
||||
|
@ -2246,7 +2246,7 @@ int check_config_validity()
|
||||
*/
|
||||
nbproc = my_popcountl(curproxy->bind_proc);
|
||||
|
||||
curproxy->bind_proc &= nbits(global.nbproc);
|
||||
curproxy->bind_proc &= all_proc_mask;
|
||||
if (!curproxy->bind_proc && nbproc == 1) {
|
||||
ha_warning("Proxy '%s': the process specified on the 'bind-process' directive refers to a process number that is higher than global.nbproc. The proxy has been forced to run on process 1 only.\n", curproxy->id);
|
||||
curproxy->bind_proc = 1;
|
||||
@ -2311,7 +2311,7 @@ int check_config_validity()
|
||||
if (!bind_conf->bind_proc)
|
||||
continue;
|
||||
|
||||
mask = nbits(global.nbproc);
|
||||
mask = all_proc_mask;
|
||||
if (curproxy->bind_proc)
|
||||
mask &= curproxy->bind_proc;
|
||||
/* mask cannot be null here thanks to the previous checks */
|
||||
@ -3550,7 +3550,7 @@ out_uri_auth_compat:
|
||||
list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
|
||||
unsigned long mask;
|
||||
|
||||
mask = nbits(global.nbproc);
|
||||
mask = all_proc_mask;
|
||||
if (global.stats_fe->bind_proc)
|
||||
mask &= global.stats_fe->bind_proc;
|
||||
|
||||
@ -3574,12 +3574,12 @@ out_uri_auth_compat:
|
||||
list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
|
||||
unsigned long mask;
|
||||
|
||||
mask = bind_conf->bind_proc ? bind_conf->bind_proc : nbits(global.nbproc);
|
||||
mask = bind_conf->bind_proc ? bind_conf->bind_proc : all_proc_mask;
|
||||
curproxy->bind_proc |= mask;
|
||||
}
|
||||
|
||||
if (!curproxy->bind_proc)
|
||||
curproxy->bind_proc = nbits(global.nbproc);
|
||||
curproxy->bind_proc = all_proc_mask;
|
||||
}
|
||||
|
||||
if (global.stats_fe) {
|
||||
@ -3590,7 +3590,7 @@ out_uri_auth_compat:
|
||||
global.stats_fe->bind_proc |= mask;
|
||||
}
|
||||
if (!global.stats_fe->bind_proc)
|
||||
global.stats_fe->bind_proc = nbits(global.nbproc);
|
||||
global.stats_fe->bind_proc = all_proc_mask;
|
||||
}
|
||||
|
||||
/* propagate bindings from frontends to backends. Don't do it if there
|
||||
@ -3607,7 +3607,7 @@ out_uri_auth_compat:
|
||||
for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {
|
||||
if (curproxy->bind_proc)
|
||||
continue;
|
||||
curproxy->bind_proc = nbits(global.nbproc);
|
||||
curproxy->bind_proc = all_proc_mask;
|
||||
}
|
||||
|
||||
/*******************************************************/
|
||||
@ -3637,7 +3637,7 @@ out_uri_auth_compat:
|
||||
|
||||
nbproc = my_popcountl(curproxy->bind_proc &
|
||||
(listener->bind_conf->bind_proc ? listener->bind_conf->bind_proc : curproxy->bind_proc) &
|
||||
nbits(global.nbproc));
|
||||
all_proc_mask);
|
||||
|
||||
if (!nbproc) /* no intersection between listener and frontend */
|
||||
nbproc = 1;
|
||||
@ -3707,7 +3707,7 @@ out_uri_auth_compat:
|
||||
bind_conf->xprt->destroy_bind_conf(bind_conf);
|
||||
}
|
||||
|
||||
if (atleast2(curproxy->bind_proc & nbits(global.nbproc))) {
|
||||
if (atleast2(curproxy->bind_proc & all_proc_mask)) {
|
||||
if (curproxy->uri_auth) {
|
||||
int count, maxproc = 0;
|
||||
|
||||
|
@ -129,6 +129,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 */
|
||||
unsigned long all_proc_mask = 1; /* mask of all processes */
|
||||
|
||||
volatile unsigned long sleeping_thread_mask; /* Threads that are about to sleep in poll() */
|
||||
/* global options */
|
||||
@ -903,6 +904,7 @@ static void mworker_loop()
|
||||
global.nbthread = 1;
|
||||
relative_pid = 1;
|
||||
pid_bit = 1;
|
||||
all_proc_mask = 1;
|
||||
|
||||
#ifdef USE_THREAD
|
||||
tid_bit = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user