the "-p" command line argument. The file must be accessible to the user
starting the process. See also "daemon".
-stats bind-process [ all | odd | even | <number 1-32> ] ...
+stats bind-process [ all | odd | even | <number 1-32>[-<number 1-32>] ] ...
Limits the stats socket to a certain set of processes numbers. By default the
stats socket is bound to all processes, causing a warning to be emitted when
nbproc is greater than 1 because there is no way to select the target process
documentation, and section 5 about bind options.
-bind-process [ all | odd | even | <number 1-32> ] ...
+bind-process [ all | odd | even | <number 1-32>[-<number 1-32>] ] ...
Limit visibility of an instance to a certain set of processes numbers.
May be used in sections : defaults | frontend | listen | backend
yes | yes | yes | yes
with less than 2 processes otherwise some instances might be
missing from all processes.
- number The instance will be enabled on this process number, between
- 1 and 32. You must be careful not to reference a process
- number greater than the configured global.nbproc, otherwise
- some instances might be missing from all processes.
+ number The instance will be enabled on this process number or range,
+ whose values must all be between 1 and 32. You must be
+ careful not to reference a process number greater than the
+ configured global.nbproc, otherwise some instances might be
+ missing from all processes.
This keyword limits binding of certain instances to certain processes. This
is useful in order not to have too many processes listening to the same
bind 10.0.0.3:80
bind-process 1 2 3 4
+ listen management
+ bind 10.0.0.4:80
+ bind-process 1-4
+
See also : "nbproc" in global section.
unsigned int set = 0;
while (*args[cur_arg]) {
- int u;
+ unsigned int low, high;
+
if (strcmp(args[cur_arg], "all") == 0) {
set = 0;
break;
else if (strcmp(args[cur_arg], "even") == 0) {
set |= 0xAAAAAAAA;
}
- else {
- u = str2uic(args[cur_arg]);
- if (u < 1 || u > 32) {
- Alert("parsing [%s:%d]: %s expects 'all', 'odd', 'even', or process numbers from 1 to 32.\n",
+ else if (isdigit(*args[cur_arg])) {
+ char *dash = strchr(args[cur_arg], '-');
+
+ low = high = str2uic(args[cur_arg]);
+ if (dash)
+ high = str2uic(dash + 1);
+
+ if (high < low) {
+ unsigned int swap = low;
+ low = high;
+ high = swap;
+ }
+
+ if (low < 1 || high > 32) {
+ Alert("parsing [%s:%d]: %s supports process numbers from 1 to 32.\n",
file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
- if (u > global.nbproc) {
- Warning("parsing [%s:%d]: %s references process number higher than global.nbproc.\n",
- file, linenum, args[0]);
+
+ if (high > global.nbproc) {
+ Warning("parsing [%s:%d]: %s references process number %d which is higher than global.nbproc (%d).\n",
+ file, linenum, args[0], high, global.nbproc);
err_code |= ERR_WARN;
}
- set |= 1 << (u - 1);
+ while (low <= high)
+ set |= 1 << (low++ - 1);
+ }
+ else {
+ Alert("parsing [%s:%d]: %s expects 'all', 'odd', 'even', or a list of process ranges with numbers from 1 to 32.\n",
+ file, linenum, args[0]);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
}
cur_arg++;
}
unsigned int set = 0;
while (*args[cur_arg]) {
- int u;
+ unsigned int low, high;
+
if (strcmp(args[cur_arg], "all") == 0) {
set = 0;
break;
else if (strcmp(args[cur_arg], "even") == 0) {
set |= 0xAAAAAAAA;
}
- else {
- u = str2uic(args[cur_arg]);
- if (u < 1 || u > 32) {
- memprintf(err,
- "'%s %s' expects 'all', 'odd', 'even', or process numbers from 1 to 32.\n",
- args[0], args[1]);
+ else if (isdigit(*args[cur_arg])) {
+ char *dash = strchr(args[cur_arg], '-');
+
+ low = high = str2uic(args[cur_arg]);
+ if (dash)
+ high = str2uic(dash + 1);
+
+ if (high < low) {
+ unsigned int swap = low;
+ low = high;
+ high = swap;
+ }
+
+ if (low < 1 || high > 32) {
+ memprintf(err, "'%s %s' supports process numbers from 1 to 32.\n",
+ args[0], args[1]);
return -1;
}
- set |= 1 << (u - 1);
+
+ while (low <= high)
+ set |= 1 << (low++ - 1);
+ }
+ else {
+ memprintf(err,
+ "'%s %s' expects 'all', 'odd', 'even', or a list of process ranges with numbers from 1 to 32.\n",
+ args[0], args[1]);
+ return -1;
}
cur_arg++;
}