diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2012-08-19 15:40:11 -0400 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2012-08-19 15:40:11 -0400 |
| commit | ba06d8a8cf5071458643a408fc477f32184d84d3 (patch) | |
| tree | cbda2a521c77e590c728b1dc54c9d4b4b519719d /fcgiwrap.c | |
| parent | 6a9e4209349bc05819ec4b99a2b7837f2f1f2c94 (diff) | |
Add support for socket activation via systemd
This prevents the need for starting fcgiwrap explicitly, or using a
tool such as spawn-fcgi. The type of socket does not matter, we merely
accept a single FD passed from pid 1 and listen on it.
Diffstat (limited to 'fcgiwrap.c')
| -rw-r--r-- | fcgiwrap.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -47,6 +47,10 @@ #include <sys/un.h> #include <netinet/in.h> +#ifdef HAVE_SYSTEMD +#include <systemd/sd-daemon.h> +#endif + /* glibc doesn't seem to export it */ #ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX 108 @@ -788,6 +792,14 @@ int main(int argc, char **argv) } } +#ifdef HAVE_SYSTEMD + if (sd_listen_fds(true) > 0) { + /* systemd woke us up. we should never see more than one FD passed to us. */ + if (listen_on_fd(SD_LISTEN_FDS_START) < 0) { + return 1; + } + } else +#endif if (socket_url) { if (setup_socket(socket_url) < 0) { return 1; |
