]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: init: process all initcalls in order at boot time
authorWilly Tarreau <w@1wt.eu>
Sun, 25 Nov 2018 17:43:29 +0000 (18:43 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2018 18:50:32 +0000 (19:50 +0100)
main() now iterates over all initcall stages at boot time. This will allow
to move init code from constructors to initcalls.

src/haproxy.c

index 2c42a7096a353250592c7412762e70a910366d00..184225d95e9ea9811bad4917e9a9eca3a4142775 100644 (file)
@@ -75,6 +75,7 @@
 #include <common/config.h>
 #include <common/defaults.h>
 #include <common/errors.h>
+#include <common/initcall.h>
 #include <common/memory.h>
 #include <common/mini-clist.h>
 #include <common/namespace.h>
@@ -2733,6 +2734,15 @@ int main(int argc, char **argv)
        int pidfd = -1;
 
        setvbuf(stdout, NULL, _IONBF, 0);
+
+       /* process all initcalls in order of potential dependency */
+       RUN_INITCALLS(STG_PREPARE);
+       RUN_INITCALLS(STG_LOCK);
+       RUN_INITCALLS(STG_ALLOC);
+       RUN_INITCALLS(STG_POOL);
+       RUN_INITCALLS(STG_REGISTER);
+       RUN_INITCALLS(STG_INIT);
+
        init(argc, argv);
        signal_register_fct(SIGQUIT, dump, SIGQUIT);
        signal_register_fct(SIGUSR1, sig_soft_stop, SIGUSR1);