mirror of
https://github.com/apache/httpd.git
synced 2026-10-23 22:49:01 +03:00
Add support for systemd socket activation to listener sockets. * configure.in: Simplify/fix systemd detection: move later to fix autoconf warnings; define HAVE_SYSTEMD rather than using CPPFLAGS. * server/listen.c: Use HAVE_SYSTEMD for systemd #define. * modules/arch/unix/config5.m4: Update systemd headers check. * server/listen.c: duplicate sockets correctly when using systemd socket activation, fix addrlen in getsockname() call. Follow up r1608686, pass process to alloc_systemd_listener. * server/listen.c: detect systemd socket activation using sd_listen_fds(), drop the support for "Listen systemd" and use standard Listen syntax instead. This allows using the same configuration file with or without socket activation and allows setting protocol when using socket activation. Remove libsystemd dependency from main httpd binary Until this change httpd was linking libsystemd to the main httpd binary. If you want to run lightweight version of httpd in container, sometimes you just want to install httpd binary with as little dependencies as possible to make container small in size and do not pull uncencessary dependencies and libraries. This change will move all systemd library calls from listen.c to mod_systemd module and remove systemd linking from the main httpd bin. Fixed mixed declaration and wrongly declared variable. Submitted by: Luboš Uhliarik <luhliari redhat.com> mod_systemd: Axe APR_OPTIONAL_FN redeclarations to avoid compiler warning. ap_find_systemd_socket() and ap_systemd_listen_fds() are already declared in "ap_listen.h", so just include them. mod_systemd: if SELinux is available and enabled, log the SELinux context at startup, since this may vary when httpd is started via systemd vs being started directly. * modules/arch/unix/mod_systemd.c (systemd_post_config): Do nothing for the pre-config iteration. Log the SELinux context if available. * modules/arch/unix/config5.m4: Detect libselinux. Have at least one CI job build mod_systemd. Fix a cppcheck warning. Remove some dead code. Updating 'last' is pointless here. Ensure that ALL fields of the ap_listen_rec structure are initialized alloc_listener initializes more fields in the created ap_listen_rec structure than alloc_systemd_listener as it has more data to add to this structure. Ensure that all fields of the ap_listen_rec structure are initialized at least with 0 as later code using this structure depends on this. Reviewed by: rpluem, jorton, ylavic Github: closes #515 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1926113 13f79535-47bb-0310-9956-ffa450edef68