From: Valentine Krasnobaeva Date: Wed, 9 Oct 2024 13:44:25 +0000 (+0200) Subject: MINOR: mworker: add and set state PROC_O_INIT for new worker X-Git-Tag: v3.1-dev10~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=646299fc95a883bb0ecbf4960d14af4c117ef8cb;p=thirdparty%2Fhaproxy.git MINOR: mworker: add and set state PROC_O_INIT for new worker Here, to distinguish between the new worker and the previous one let's add a new process state PROC_O_INIT and let's set it, when the memory is allocated for the new worker in the processes list. --- diff --git a/include/haproxy/mworker-t.h b/include/haproxy/mworker-t.h index 3137ec0be9..46e125f36f 100644 --- a/include/haproxy/mworker-t.h +++ b/include/haproxy/mworker-t.h @@ -24,7 +24,9 @@ #define PROC_O_TYPE_PROG 0x00000004 /* 0x00000008 unused */ #define PROC_O_LEAVING 0x00000010 /* this process should be leaving */ -/* 0x00000020 to 0x00000080 unused */ +/* state of the newly forked worker process, which hasn't sent yet its READY message to master */ +#define PROC_O_INIT 0x00000020 +/* 0x00000040 to 0x00000080 unused */ #define PROC_O_START_RELOAD 0x00000100 /* Start the process even if the master was re-executed */ /* diff --git a/src/haproxy.c b/src/haproxy.c index e9198704b6..c6107e0dae 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2095,8 +2095,8 @@ static void init(int argc, char **argv) ha_alert("Cannot allocate process structures.\n"); exit(EXIT_FAILURE); } - tmproc->options |= PROC_O_TYPE_WORKER; /* worker */ - + /* worker */ + tmproc->options |= (PROC_O_TYPE_WORKER | PROC_O_INIT); /* create a sockpair to copy it via fork(), thus it will be in * master and in worker processes */