MINOR: listener: move bind_proc and bind_thread to struct settings
As mentioned previously, these two fields come under the settings
struct since they'll be used to bind receivers as well.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index c5b2b20..cc787b2 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -2323,7 +2323,7 @@
#endif
/* detect and address thread affinity inconsistencies */
- mask = thread_mask(bind_conf->bind_thread);
+ mask = thread_mask(bind_conf->settings.bind_thread);
if (!(mask & all_threads_mask)) {
unsigned long new_mask = 0;
@@ -2332,27 +2332,27 @@
mask >>= global.nbthread;
}
- bind_conf->bind_thread = new_mask;
+ bind_conf->settings.bind_thread = new_mask;
ha_warning("Proxy '%s': the thread range specified on the 'process' directive of 'bind %s' at [%s:%d] only refers to thread numbers out of the range defined by the global 'nbthread' directive. The thread numbers were remapped to existing threads instead (mask 0x%lx).\n",
curproxy->id, bind_conf->arg, bind_conf->file, bind_conf->line, new_mask);
}
/* detect process and nbproc affinity inconsistencies */
- mask = proc_mask(bind_conf->bind_proc) & proc_mask(curproxy->bind_proc);
+ mask = proc_mask(bind_conf->settings.bind_proc) & proc_mask(curproxy->bind_proc);
if (!(mask & all_proc_mask)) {
mask = proc_mask(curproxy->bind_proc) & all_proc_mask;
- nbproc = my_popcountl(bind_conf->bind_proc);
- bind_conf->bind_proc = proc_mask(bind_conf->bind_proc) & mask;
+ nbproc = my_popcountl(bind_conf->settings.bind_proc);
+ bind_conf->settings.bind_proc = proc_mask(bind_conf->settings.bind_proc) & mask;
- if (!bind_conf->bind_proc && nbproc == 1) {
+ if (!bind_conf->settings.bind_proc && nbproc == 1) {
ha_warning("Proxy '%s': the process number specified on the 'process' directive of 'bind %s' at [%s:%d] refers to a process not covered by the proxy. This has been fixed by forcing it to run on the proxy's first process only.\n",
curproxy->id, bind_conf->arg, bind_conf->file, bind_conf->line);
- bind_conf->bind_proc = mask & ~(mask - 1);
+ bind_conf->settings.bind_proc = mask & ~(mask - 1);
}
- else if (!bind_conf->bind_proc && nbproc > 1) {
+ else if (!bind_conf->settings.bind_proc && nbproc > 1) {
ha_warning("Proxy '%s': the process range specified on the 'process' directive of 'bind %s' at [%s:%d] only refers to processes not covered by the proxy. The directive was ignored so that all of the proxy's processes are used.\n",
curproxy->id, bind_conf->arg, bind_conf->file, bind_conf->line);
- bind_conf->bind_proc = 0;
+ bind_conf->settings.bind_proc = 0;
}
}
}
@@ -3641,7 +3641,7 @@
unsigned long mask;
mask = proc_mask(global.stats_fe->bind_proc) && all_proc_mask;
- mask &= proc_mask(bind_conf->bind_proc);
+ mask &= proc_mask(bind_conf->settings.bind_proc);
/* stop here if more than one process is used */
if (atleast2(mask))
@@ -3660,7 +3660,7 @@
list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
unsigned long mask;
- mask = proc_mask(bind_conf->bind_proc);
+ mask = proc_mask(bind_conf->settings.bind_proc);
curproxy->bind_proc |= mask;
}
curproxy->bind_proc = proc_mask(curproxy->bind_proc);
@@ -3670,7 +3670,7 @@
list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
unsigned long mask;
- mask = bind_conf->bind_proc ? bind_conf->bind_proc : 0;
+ mask = bind_conf->settings.bind_proc ? bind_conf->settings.bind_proc : 0;
global.stats_fe->bind_proc |= mask;
}
global.stats_fe->bind_proc = proc_mask(global.stats_fe->bind_proc);
@@ -3716,7 +3716,7 @@
int nbproc;
nbproc = my_popcountl(curproxy->bind_proc &
- (listener->bind_conf->bind_proc ? listener->bind_conf->bind_proc : curproxy->bind_proc) &
+ (listener->bind_conf->settings.bind_proc ? listener->bind_conf->settings.bind_proc : curproxy->bind_proc) &
all_proc_mask);
if (!nbproc) /* no intersection between listener and frontend */
@@ -3787,7 +3787,7 @@
int count, maxproc = 0;
list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
- count = my_popcountl(bind_conf->bind_proc);
+ count = my_popcountl(bind_conf->settings.bind_proc);
if (count > maxproc)
maxproc = count;
}
diff --git a/src/cli.c b/src/cli.c
index 673e173..a455be1 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1270,10 +1270,10 @@
else
chunk_appendf(&trash, " ");
- if (bind_conf->bind_proc != 0) {
+ if (bind_conf->settings.bind_proc != 0) {
int pos;
- for (pos = 0; pos < 8 * sizeof(bind_conf->bind_proc); pos++) {
- if (bind_conf->bind_proc & (1UL << pos)) {
+ for (pos = 0; pos < 8 * sizeof(bind_conf->settings.bind_proc); pos++) {
+ if (bind_conf->settings.bind_proc & (1UL << pos)) {
chunk_appendf(&trash, "%d,", pos+1);
}
}
@@ -2650,7 +2650,7 @@
bind_conf->level &= ~ACCESS_LVL_MASK;
bind_conf->level |= ACCESS_LVL_ADMIN; /* TODO: need to lower the rights with a CLI keyword*/
- bind_conf->bind_proc = 1UL << proc;
+ bind_conf->settings.bind_proc = 1UL << proc;
global.stats_fe->bind_proc = 0; /* XXX: we should be careful with that, it can be removed by configuration */
if (!memprintf(&path, "sockpair@%d", mworker_proc->ipc_fd[1])) {
diff --git a/src/haproxy.c b/src/haproxy.c
index 588ca1a..0f72d5a 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -3464,7 +3464,7 @@
list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
if (bind_conf->level & ACCESS_FD_LISTENERS) {
- if (!bind_conf->bind_proc || bind_conf->bind_proc & (1UL << proc)) {
+ if (!bind_conf->settings.bind_proc || bind_conf->settings.bind_proc & (1UL << proc)) {
global.tune.options |= GTUNE_SOCKET_TRANSFER;
break;
}
diff --git a/src/listener.c b/src/listener.c
index 42ab3f2..b0efa93 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -235,7 +235,7 @@
HA_SPIN_LOCK(LISTENER_LOCK, &listener->lock);
if (listener->state == LI_LISTEN) {
if ((global.mode & (MODE_DAEMON | MODE_MWORKER)) &&
- !(proc_mask(listener->bind_conf->bind_proc) & pid_bit)) {
+ !(proc_mask(listener->bind_conf->settings.bind_proc) & pid_bit)) {
/* we don't want to enable this listener and don't
* want any fd event to reach it.
*/
@@ -342,7 +342,7 @@
goto end;
if ((global.mode & (MODE_DAEMON | MODE_MWORKER)) &&
- !(proc_mask(l->bind_conf->bind_proc) & pid_bit))
+ !(proc_mask(l->bind_conf->settings.bind_proc) & pid_bit))
goto end;
if (l->state == LI_ASSIGNED) {
@@ -383,11 +383,11 @@
goto end;
}
- if (!(thread_mask(l->bind_conf->bind_thread) & tid_bit)) {
+ if (!(thread_mask(l->bind_conf->settings.bind_thread) & tid_bit)) {
/* we're not allowed to touch this listener's FD, let's requeue
* the listener into one of its owning thread's queue instead.
*/
- int first_thread = my_flsl(thread_mask(l->bind_conf->bind_thread) & all_threads_mask) - 1;
+ int first_thread = my_flsl(thread_mask(l->bind_conf->settings.bind_thread) & all_threads_mask) - 1;
work_list_add(&local_listener_queue[first_thread], &l->wait_queue);
goto end;
}
@@ -874,7 +874,7 @@
next_actconn = 0;
#if defined(USE_THREAD)
- mask = thread_mask(l->bind_conf->bind_thread) & all_threads_mask;
+ mask = thread_mask(l->bind_conf->settings.bind_thread) & all_threads_mask;
if (atleast2(mask) && (global.tune.options & GTUNE_LISTENER_MQ) && !stopping) {
struct accept_queue_ring *ring;
unsigned int t, t0, t1, t2;
@@ -1472,8 +1472,8 @@
*slash = '/';
}
- conf->bind_proc |= proc;
- conf->bind_thread |= thread;
+ conf->settings.bind_proc |= proc;
+ conf->settings.bind_thread |= thread;
return 0;
}
diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c
index 18fa770..ff7c0a2 100644
--- a/src/proto_sockpair.c
+++ b/src/proto_sockpair.c
@@ -126,7 +126,7 @@
listener->state = LI_LISTEN;
fd_insert(fd, listener, listener->proto->accept,
- thread_mask(listener->bind_conf->bind_thread) & all_threads_mask);
+ thread_mask(listener->bind_conf->settings.bind_thread) & all_threads_mask);
return err;
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 56e9391..57bef86 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -768,7 +768,7 @@
listener->state = LI_LISTEN;
fd_insert(fd, listener, listener->proto->accept,
- thread_mask(listener->bind_conf->bind_thread) & all_threads_mask);
+ thread_mask(listener->bind_conf->settings.bind_thread) & all_threads_mask);
/* for now, all regularly bound TCP listeners are exportable */
if (!(listener->options & LI_O_INHERITED))
diff --git a/src/proto_udp.c b/src/proto_udp.c
index be100b5..5ec8bc7 100644
--- a/src/proto_udp.c
+++ b/src/proto_udp.c
@@ -279,7 +279,7 @@
if (listener->bind_conf->frontend->mode == PR_MODE_SYSLOG)
fd_insert(fd, listener, syslog_fd_handler,
- thread_mask(listener->bind_conf->bind_thread) & all_threads_mask);
+ thread_mask(listener->bind_conf->settings.bind_thread) & all_threads_mask);
else {
err |= ERR_FATAL | ERR_ALERT;
msg = "UDP is not yet supported on this proxy mode";
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 8be2219..ac2fb53 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -263,7 +263,7 @@
listener->state = LI_LISTEN;
fd_insert(fd, listener, listener->proto->accept,
- thread_mask(listener->bind_conf->bind_thread) & all_threads_mask);
+ thread_mask(listener->bind_conf->settings.bind_thread) & all_threads_mask);
/* for now, all regularly bound UNIX listeners are exportable */
if (!(listener->options & LI_O_INHERITED))