]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: startup: move PID handling in init()
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Fri, 28 Jun 2024 16:15:44 +0000 (18:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:00:58 +0000 (22:00 +0200)
commit4cbfcc60f499328a6720b6b98b3be984a7fa5bb3
treec3c3de231750c528677b46ce53c8b5c26f031041
parent95c19be2abc3b2d4070c80344db7875adf23c22a
MEDIUM: startup: move PID handling in init()

Let's move PID handling in init() from the main() code. It is more appropriate
to open and to write the PID of the process just after daemonization fork. In
case of daemon monoprocess mode, we will simply write a PID of the process,
which is already in the background. In case of 'master-worker' mode, we keep
the previous behaviour and we write only a PID of the master process.

This allows to remove redundant tests of the process execution mode, tests of
the pidfd value and consequent writes to this pidfd. This patch prepares the
refactoring of master-worker fork by moving it in init() function as well.
src/haproxy.c