]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mworker: remove USE_SYSTEMD requirement for -Ws
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 20 Nov 2024 11:02:39 +0000 (12:02 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 20 Nov 2024 11:07:38 +0000 (12:07 +0100)
Since sd_notify() is now implemented in src/systemd.c, there is no need
anymore to build its support conditionnally with USE_SYSTEMD.

This patch add supports for -Ws for every build and removes the
USE_SYSTEMD build option. It also remove every reference to USE_SYSTEMD
in the documentation and the CI.

This also allows to run the reg-tests in -Ws with the new VTest support.

.github/matrix.py
.github/workflows/coverity.yml
.github/workflows/fedora-rawhide.yml
.travis.yml
INSTALL
Makefile
doc/management.txt
src/cli.c
src/haproxy.c
src/mworker.c

index f90bbac4e6beed7e7899fd0a6b6cdbd9f15d9256..c08bbfb1717902e4f73cc2a4ab09184397f3f659 100755 (executable)
@@ -127,7 +127,6 @@ def main(ref_name):
                     "USE_PCRE2_JIT=1",
                     "USE_LUA=1",
                     "USE_OPENSSL=1",
-                    "USE_SYSTEMD=1",
                     "USE_WURFL=1",
                     "WURFL_INC=addons/wurfl/dummy",
                     "WURFL_LIB=addons/wurfl/dummy",
@@ -161,7 +160,6 @@ def main(ref_name):
                     "USE_PCRE2_JIT=1",
                     "USE_LUA=1",
                     "USE_OPENSSL=1",
-                    "USE_SYSTEMD=1",
                     "USE_WURFL=1",
                     "WURFL_INC=addons/wurfl/dummy",
                     "WURFL_LIB=addons/wurfl/dummy",
index fa28acfc92b5f79bdb48d999419d4347c8fd56ea..e52e6de040e3219f1a1aec7a2080ce0d97fb6208 100644 (file)
@@ -38,7 +38,7 @@ jobs:
     - name: Build with Coverity build tool
       run: |
         export PATH=`pwd`/coverity_tool/bin:$PATH
-        cov-build --dir cov-int make CC=clang TARGET=linux-glibc USE_ZLIB=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_QUIC=1 USE_SYSTEMD=1 USE_WURFL=1 WURFL_INC=addons/wurfl/dummy WURFL_LIB=addons/wurfl/dummy USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_51DEGREES=1 51DEGREES_SRC=addons/51degrees/dummy/pattern ADDLIB=\"-Wl,-rpath,$HOME/opt/lib/\" SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include DEBUG+=-DDEBUG_STRICT=1 DEBUG+=-DDEBUG_USE_ABORT=1
+        cov-build --dir cov-int make CC=clang TARGET=linux-glibc USE_ZLIB=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_QUIC=1 USE_WURFL=1 WURFL_INC=addons/wurfl/dummy WURFL_LIB=addons/wurfl/dummy USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_51DEGREES=1 51DEGREES_SRC=addons/51degrees/dummy/pattern ADDLIB=\"-Wl,-rpath,$HOME/opt/lib/\" SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include DEBUG+=-DDEBUG_STRICT=1 DEBUG+=-DDEBUG_USE_ABORT=1
     - name: Submit build result to Coverity Scan
       run: |
         tar czvf cov.tar.gz cov-int
index 3035219974ed78734bff25f015f5a81c323e2391..f1b1afaab84899f054d68a341df3f37d8acc927d 100644 (file)
@@ -40,7 +40,7 @@ jobs:
         make dev/hpack/decode dev/hpack/gen-enc dev/hpack/gen-rht
     - name: Compile HAProxy with ${{ matrix.platform.cc }}
       run: |
-        make -j3 CC=${{ matrix.platform.cc }} V=1 ERR=1 TARGET=linux-glibc USE_OPENSSL=1 USE_QUIC=1 USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 USE_SYSTEMD=1 ADDLIB="${{ matrix.platform.ADDLIB_ATOMIC }} -Wl,-rpath,${HOME}/opt/lib" SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include ARCH_FLAGS="${{ matrix.platform.ARCH_FLAGS }}"
+        make -j3 CC=${{ matrix.platform.cc }} V=1 ERR=1 TARGET=linux-glibc USE_OPENSSL=1 USE_QUIC=1 USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 ADDLIB="${{ matrix.platform.ADDLIB_ATOMIC }} -Wl,-rpath,${HOME}/opt/lib" SSL_LIB=${HOME}/opt/lib SSL_INC=${HOME}/opt/include ARCH_FLAGS="${{ matrix.platform.ARCH_FLAGS }}"
         make install
     - name: Show HAProxy version
       id: show-version
index 7f5110e323aac4b5cd4e20b51d6ecbe79bc1daa8..e995143a7e8ebf2421ef527e75a389c4329ddc66 100644 (file)
@@ -8,7 +8,7 @@ branches:
 
 env:
   global:
-    - FLAGS="USE_LUA=1 USE_OPENSSL=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_SYSTEMD=1 USE_ZLIB=1"
+    - FLAGS="USE_LUA=1 USE_OPENSSL=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_ZLIB=1"
     - TMPDIR=/tmp
 
 addons:
diff --git a/INSTALL b/INSTALL
index 46ff3cd529730247203d1a8786343192ae349764..40c051c331281af857554a7ae4c76c87321e2d5d 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -465,12 +465,6 @@ are the extra libraries that may be referenced at build time :
                   on Linux. It is automatically detected and may be disabled
                   using "USE_DL=", though it should never harm.
 
-  - USE_SYSTEMD=1 enables support for the sdnotify features of systemd,
-                  allowing better integration with systemd on Linux systems
-                  which come with it. It is never enabled by default so there
-                  is no need to disable it.
-
-
 4.10) Common errors
 -------------------
 Some build errors may happen depending on the options combinations or the
index 4a8066daa03002f423ab12d098d15e3bf486026b..e70891ee2dede5596efe1df00d64a5c803f8aa4c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -56,7 +56,6 @@
 #   USE_DEVICEATLAS         : enable DeviceAtlas api.
 #   USE_51DEGREES           : enable third party device detection library from 51Degrees
 #   USE_WURFL               : enable WURFL detection library from Scientiamobile
-#   USE_SYSTEMD             : enable sd_notify() support.
 #   USE_OBSOLETE_LINKER     : use when the linker fails to emit __start_init/__stop_init
 #   USE_THREAD_DUMP         : use the more advanced thread state dump system. Automatic.
 #   USE_OT                  : enable the OpenTracing filter
@@ -340,7 +339,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER USE_POLL                        \
            USE_SSL USE_LUA USE_ACCEPT4 USE_CLOSEFROM USE_ZLIB USE_SLZ         \
            USE_CPU_AFFINITY USE_TFO USE_NS USE_DL USE_RT USE_LIBATOMIC        \
            USE_MATH USE_DEVICEATLAS USE_51DEGREES                             \
-           USE_WURFL USE_SYSTEMD USE_OBSOLETE_LINKER USE_PRCTL USE_PROCCTL    \
+           USE_WURFL USE_OBSOLETE_LINKER USE_PRCTL USE_PROCCTL                \
            USE_THREAD_DUMP USE_EVPORTS USE_OT USE_QUIC USE_PROMEX             \
            USE_MEMORY_PROFILING USE_SHM_OPEN                                  \
            USE_STATIC_PCRE USE_STATIC_PCRE2                                   \
@@ -381,7 +380,7 @@ ifeq ($(TARGET),linux-glibc)
     USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER  \
     USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY USE_LINUX_CAP      \
     USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO     \
-    USE_GETADDRINFO USE_BACKTRACE USE_SHM_OPEN USE_SYSTEMD)
+    USE_GETADDRINFO USE_BACKTRACE USE_SHM_OPEN)
   INSTALL = install -v
 endif
 
@@ -765,10 +764,6 @@ ifneq ($(USE_WURFL:0=),)
   WURFL_LDFLAGS    = $(if $(WURFL_LIB),-L$(WURFL_LIB)) -lwurfl
 endif
 
-ifneq ($(USE_SYSTEMD:0=),)
-  OPTIONS_OBJS    += src/systemd.o
-endif
-
 ifneq ($(USE_PCRE:0=)$(USE_STATIC_PCRE:0=)$(USE_PCRE_JIT:0=),)
   ifneq ($(USE_PCRE2:0=)$(USE_STATIC_PCRE2:0=)$(USE_PCRE2_JIT:0=),)
     $(error cannot compile both PCRE and PCRE2 support)
@@ -988,7 +983,7 @@ OBJS += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o src/stream.o               \
         src/cebub_tree.o src/cebuib_tree.o src/cebuis_tree.o           \
         src/cebul_tree.o src/cebus_tree.o                              \
         src/ebtree.o src/dgram.o src/hash.o src/version.o              \
-        src/limits.o src/mux_spop.o
+        src/limits.o src/mux_spop.o src/systemd.o
 
 ifneq ($(TRACE),)
   OBJS += src/calltrace.o
index a62116ac41a386120c771e93fc2194886eea94ca..a27f2454a5bcdcac43fd46c7d5a6ebc486936f02 100644 (file)
@@ -191,8 +191,6 @@ list of options is :
     recommended to use this mode with multiprocess and systemd.
 
   -Ws : master-worker mode with support of `notify` type of systemd service.
-    This option is only available when HAProxy was built with `USE_SYSTEMD`
-    build option enabled.
 
   -c : only performs a check of the configuration files and exits before trying
     to bind. The exit status is zero if everything is OK, or non-zero if an
index 48e58bb586d3dbcc07df76f4b6205925bf477cad..a64ce8aa2f3e0b8344f5c51fcf91126b985cd9ea 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
 
 #include <net/if.h>
 
-#if defined(USE_SYSTEMD)
-#include <haproxy/systemd.h>
-#endif
-
 #include <haproxy/api.h>
 #include <haproxy/applet.h>
 #include <haproxy/base64.h>
@@ -63,6 +59,7 @@
 #include <haproxy/stats-t.h>
 #include <haproxy/stconn.h>
 #include <haproxy/stream.h>
+#include <haproxy/systemd.h>
 #include <haproxy/task.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
@@ -2532,10 +2529,8 @@ static int _send_status(char **args, char *payload, struct appctx *appctx, void
        load_status = 1;
        ha_notice("Loading success.\n");
 
-#if defined(USE_SYSTEMD)
        if (global.tune.options & GTUNE_USE_SYSTEMD)
                sd_notifyf(0, "READY=1\nMAINPID=%lu\nSTATUS=Ready.\n", (unsigned long)getpid());
-#endif
        return 1;
 }
 
index f32d488d09796cd0c82043f87c44f1f7b8dbe116..6f371cf2b77664239a98a999321d9209581b6eac 100644 (file)
@@ -59,9 +59,6 @@
 #ifdef DEBUG_FULL
 #include <assert.h>
 #endif
-#if defined(USE_SYSTEMD)
-#include <haproxy/systemd.h>
-#endif
 
 #include <import/sha1.h>
 
 #include <haproxy/stats-file.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/stream.h>
+#include <haproxy/systemd.h>
 #include <haproxy/task.h>
 #include <haproxy/thread.h>
 #include <haproxy/time.h>
@@ -619,9 +617,7 @@ static void usage(char *name)
                "        -V enters verbose mode (disables quiet mode)\n"
                "        -D goes daemon ; -C changes to <dir> before loading files.\n"
                "        -W master-worker mode.\n"
-#if defined(USE_SYSTEMD)
                "        -Ws master-worker mode with systemd notify support.\n"
-#endif
                "        -q quiet mode : don't display messages\n"
                "        -c check mode : only check config files and exit\n"
                "        -cc check condition : evaluate a condition and exit\n"
@@ -868,7 +864,6 @@ void mworker_reload(int hardreload)
                child->reloads++;
        }
 
-#if defined(USE_SYSTEMD)
        if (global.tune.options & GTUNE_USE_SYSTEMD) {
                struct timespec ts;
 
@@ -880,7 +875,6 @@ void mworker_reload(int hardreload)
                               "MONOTONIC_USEC=%" PRIu64 "\n",
                           (ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000ULL));
        }
-#endif
        mworker_reexec(hardreload);
 }
 
@@ -938,12 +932,10 @@ void on_new_child_failure()
        usermsgs_clr(NULL);
        load_status = 0;
        ha_warning("Failed to load worker!\n");
-#if defined(USE_SYSTEMD)
        /* the sd_notify API is not able to send a reload failure signal. So
         * the READY=1 signal still need to be sent */
        if (global.tune.options & GTUNE_USE_SYSTEMD)
                sd_notify(0, "READY=1\nSTATUS=Reload failed!\n");
-#endif
 }
 
 /*
@@ -1783,12 +1775,7 @@ static void init_args(int argc, char **argv)
                                arg_mode |= MODE_DAEMON;
                        else if (*flag == 'W' && flag[1] == 's') {
                                arg_mode |= MODE_MWORKER | MODE_FOREGROUND;
-#if defined(USE_SYSTEMD)
                                global.tune.options |= GTUNE_USE_SYSTEMD;
-#else
-                               ha_alert("master-worker mode with systemd support (-Ws) requested, but not compiled. Use master-worker mode (-W) if you are not using Type=notify in your unit file or recompile with USE_SYSTEMD=1.\n\n");
-                               usage(progname);
-#endif
                        }
                        else if (*flag == 'W')
                                arg_mode |= MODE_MWORKER;
@@ -3063,12 +3050,10 @@ static void run_master_in_recovery_mode(int argc, char **argv)
        list_for_each_entry(proc, &proc_list, list) {
                proc->failedreloads++;
        }
-#if defined(USE_SYSTEMD)
        /* the sd_notify API is not able to send a reload failure signal. So
         * the READY=1 signal still need to be sent */
        if (global.tune.options & GTUNE_USE_SYSTEMD)
                sd_notify(0, "READY=1\nSTATUS=Reload failed (master failed to load or to parse new configuration)!\n");
-#endif
 
        global.nbtgroups = 1;
        global.nbthread = 1;
index d0ef3141e252a0cc96f256acce41052e41cea6c5..be453990a210d286f9ab731fdc682154f988049b 100644 (file)
 #include <haproxy/signal.h>
 #include <haproxy/stconn.h>
 #include <haproxy/stream.h>
+#include <haproxy/systemd.h>
 #include <haproxy/tools.h>
 #include <haproxy/version.h>
 
-#if defined(USE_SYSTEMD)
-#include <haproxy/systemd.h>
-#endif
 
 static int exitcode = -1;
 int max_reloads = INT_MAX; /* max number of reloads a worker can have until they are killed */
@@ -308,11 +306,9 @@ void mworker_catch_sigterm(struct sig_handler *sh)
 {
        int sig = sh->arg;
 
-#if defined(USE_SYSTEMD)
        if (global.tune.options & GTUNE_USE_SYSTEMD) {
                sd_notify(0, "STOPPING=1");
        }
-#endif
        ha_warning("Exiting Master process...\n");
        mworker_kill(sig);
 }