From: Mike Yuan Date: Sun, 27 Apr 2025 18:20:14 +0000 (+0200) Subject: socket-activate: signal READY=1 once sockets are open for --accept mode X-Git-Tag: v258-rc1~729^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bff4701d8b1020cde57f9baf9d4d3f8c2cfbbed;p=thirdparty%2Fsystemd.git socket-activate: signal READY=1 once sockets are open for --accept mode --- diff --git a/src/socket-activate/socket-activate.c b/src/socket-activate/socket-activate.c index 2f81316dfc3..1fd07bfa0de 100644 --- a/src/socket-activate/socket-activate.c +++ b/src/socket-activate/socket-activate.c @@ -10,6 +10,7 @@ #include "alloc-util.h" #include "build.h" +#include "daemon-util.h" #include "env-util.h" #include "errno-util.h" #include "escape.h" @@ -472,6 +473,13 @@ static int run(int argc, char **argv) { if (n == 0) return log_error_errno(SYNTHETIC_ERRNO(ENOENT), "No sockets to listen on specified or passed in."); + /* Notify the caller that all sockets are open now. We only do this in --accept mode however, + * since otherwise our process will be replaced and it's better to leave the readiness notify + * to the actual payload. */ + _unused_ _cleanup_(notify_on_cleanup) const char *notify = NULL; + if (arg_accept) + notify = notify_start(NOTIFY_READY, NOTIFY_STOPPING); + for (;;) { struct epoll_event event;