CLEANUP: global: remove the nbproc field from the global structure
Let's use 1 in the rare places where it was still referenced since it's
now its only possible value.
diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h
index 057d90e..b5ecc55 100644
--- a/include/haproxy/global-t.h
+++ b/include/haproxy/global-t.h
@@ -90,7 +90,6 @@
int uid;
int gid;
int external_check;
- int nbproc;
int nbthread;
int mode;
unsigned int hard_stop_after; /* maximum time allowed to perform a soft-stop */
diff --git a/src/haproxy.c b/src/haproxy.c
index c4f2c9b..26c70bd 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -167,7 +167,6 @@
/* global options */
struct global global = {
.hard_stop_after = TICK_ETERNITY,
- .nbproc = 1,
.numa_cpu_mapping = 1,
.nbthread = 0,
.req_count = 0,
@@ -2009,19 +2008,18 @@
exit(1);
}
- /* recompute the amount of per-process memory depending on nbproc and
- * the shared SSL cache size (allowed to exist in all processes).
+ /* recompute the amount of per-process memory depending on
+ * the shared SSL cache size
*/
if (global.rlimit_memmax_all) {
#if defined (USE_OPENSSL) && !defined(USE_PRIVATE_CACHE)
int64_t ssl_cache_bytes = global.tune.sslcachesize * 200LL;
global.rlimit_memmax =
- ((((int64_t)global.rlimit_memmax_all * 1048576LL) -
- ssl_cache_bytes) / global.nbproc +
+ ((((int64_t)global.rlimit_memmax_all * 1048576LL) - ssl_cache_bytes) +
ssl_cache_bytes + 1048575LL) / 1048576LL;
#else
- global.rlimit_memmax = global.rlimit_memmax_all / global.nbproc;
+ global.rlimit_memmax = global.rlimit_memmax_all;
#endif
}
@@ -2332,15 +2330,6 @@
global.mode &= ~(MODE_DAEMON | MODE_QUIET);
}
- if ((global.nbproc > 1) && !(global.mode & (MODE_DAEMON | MODE_MWORKER))) {
- if (!(global.mode & (MODE_FOREGROUND | MODE_DEBUG)))
- ha_warning("<nbproc> is only meaningful in daemon mode or master-worker mode. Setting limit to 1 process.\n");
- global.nbproc = 1;
- }
-
- if (global.nbproc < 1)
- global.nbproc = 1;
-
if (global.nbthread < 1)
global.nbthread = 1;
@@ -3206,7 +3195,6 @@
} else {
/* wait mode */
- global.nbproc = 1;
in_parent = 1;
}
diff --git a/src/sample.c b/src/sample.c
index 09c272c..4c98012 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -3948,7 +3948,7 @@
smp_fetch_nbproc(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->data.type = SMP_T_SINT;
- smp->data.u.sint = global.nbproc;
+ smp->data.u.sint = 1;
return 1;
}
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 6839132..059fef3 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -4979,8 +4979,7 @@
if (!ssl_shctx && global.tune.sslcachesize) {
alloc_ctx = shctx_init(&ssl_shctx, global.tune.sslcachesize,
sizeof(struct sh_ssl_sess_hdr) + SHSESS_BLOCK_MIN_SIZE, -1,
- sizeof(*sh_ssl_sess_tree),
- ((global.nbthread > 1) || (!global_ssl.private_cache && (global.nbproc > 1))) ? 1 : 0);
+ sizeof(*sh_ssl_sess_tree), (global.nbthread > 1));
if (alloc_ctx <= 0) {
if (alloc_ctx == SHCTX_E_INIT_LOCK)
ha_alert("Unable to initialize the lock for the shared SSL session cache. You can retry using the global statement 'tune.ssl.force-private-cache' but it could increase CPU usage due to renegotiations if nbproc > 1.\n");
diff --git a/src/stats.c b/src/stats.c
index 1f2a684..1c0d45f 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -86,7 +86,7 @@
[INF_VERSION] = { .name = "Version", .desc = "Product version" },
[INF_RELEASE_DATE] = { .name = "Release_date", .desc = "Date of latest source code update" },
[INF_NBTHREAD] = { .name = "Nbthread", .desc = "Number of started threads (global.nbthread)" },
- [INF_NBPROC] = { .name = "Nbproc", .desc = "Number of started worker processes (global.nbproc)" },
+ [INF_NBPROC] = { .name = "Nbproc", .desc = "Number of started worker processes (historical, always 1)" },
[INF_PROCESS_NUM] = { .name = "Process_num", .desc = "Relative worker process number (1..Nbproc)" },
[INF_PID] = { .name = "Pid", .desc = "This worker process identifier for the system" },
[INF_UPTIME] = { .name = "Uptime", .desc = "How long ago this worker process was started (days+hours+minutes+seconds)" },
@@ -3339,7 +3339,7 @@
(appctx->ctx.stats.flags & STAT_SHNODE) ? (uri->node ? uri->node : global.node) : "",
(appctx->ctx.stats.flags & STAT_SHDESC) ? ": " : "",
(appctx->ctx.stats.flags & STAT_SHDESC) ? (uri->desc ? uri->desc : global.desc) : "",
- pid, relative_pid, global.nbproc, global.nbthread,
+ pid, relative_pid, 1, global.nbthread,
up / 86400, (up % 86400) / 3600,
(up % 3600) / 60, (up % 60),
global.rlimit_memmax ? ultoa(global.rlimit_memmax) : "unlimited",
@@ -4319,7 +4319,7 @@
info[INF_RELEASE_DATE] = mkf_str(FO_PRODUCT|FN_OUTPUT|FS_SERVICE, haproxy_date);
info[INF_NBTHREAD] = mkf_u32(FO_CONFIG|FS_SERVICE, global.nbthread);
- info[INF_NBPROC] = mkf_u32(FO_CONFIG|FS_SERVICE, global.nbproc);
+ info[INF_NBPROC] = mkf_u32(FO_CONFIG|FS_SERVICE, 1);
info[INF_PROCESS_NUM] = mkf_u32(FO_KEY, relative_pid);
info[INF_PID] = mkf_u32(FO_STATUS, pid);