bstarynk/helpcovid

Enable the conventional LISTEN_FDS mechanism

jdebp opened this issue · 0 comments

jdebp commented

Per https://unix.stackexchange.com/a/578832/5132 the program should be capable of taking the listening socket as an already open file descriptor set up by a service manager, e.g. a systemd socket unit with Accept=No, the nosh toolset, or even inetd in its wait mode. The former two examples support the LISTEN_FDS mechanism, which allow the program to know that this is happening and what file descriptor(s) are open listening socket file descriptors.

This unfortunately involves a change to the underlying http utility library, which (despite this being common practice because of inetd) does not apparently have a method for doing this.

The aforelinked StackExchange answer has my code for implementing the part of the LISTEN_FDS mechanism that the service program needs to have. There are other implementations available, not least the sd_listen_fds() function in libsystemd0, albeit that that is not portable.

Providing this functionality enables things addressed in further issues.