Add support for systemd style socket activation.
If the LISTEN_FDS environment variable is set and tinc is run in the foreground, tinc will use filedescriptors 3 to 3 + LISTEN_FDS for its listening TCP sockets. For now, tinc will create matching listening UDP sockets itself. There is no dependency on systemd or on libsystemd-daemon.
This commit is contained in:
parent
cc6aee7846
commit
89f4574e0b
2 changed files with 94 additions and 47 deletions
|
|
@ -539,6 +539,12 @@ int main(int argc, char **argv) {
|
|||
|
||||
g_argv = argv;
|
||||
|
||||
if(getenv("LISTEN_PID") && atoi(getenv("LISTEN_PID")) == getpid())
|
||||
do_detach = false;
|
||||
#ifdef HAVE_UNSETENV
|
||||
unsetenv("LISTEN_PID");
|
||||
#endif
|
||||
|
||||
init_configuration(&config_tree);
|
||||
|
||||
/* Slllluuuuuuurrrrp! */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue