On 7 June 2018 at 10:35, Lennart Poettering <lenn...@poettering.net> wrote: > Nah, daemon() does not write PID files, you have to do that in your > own code.
As daemon() calls _exit() (not even exit()) in the parent after the fork, the only way to synchronize the pid writing is not to use the daemon() at all and inline daemon() functionality. I doubt that it will ever be done for the wast majority of sources using the function. And under systemd there are zero incentives to do that as the workaround with waiting for the pid file to appear is good enough to make things reliable. So as such the warning that currently systemd produces is just a distraction that a user cannot do nothing about. As a side note the usage of daemon() in 3 from 4 sources I randomly picked up on github is wrong as the code calls the function and then writes the pid file right after parsing the config before any initialization of sockets, but that just pointed out how lack of simple service initialization API lead to everybody inventing own buggy code... _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel