From: Lennart Poettering Date: Tue, 12 Mar 2024 17:48:28 +0000 (+0100) Subject: manager: send an sd_notify() message informing the container manager when systemd... X-Git-Tag: v256-rc1~521^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dfa0a9d4c37fa73ce1c5fc17ab09d19b054df18;p=thirdparty%2Fsystemd.git manager: send an sd_notify() message informing the container manager when systemd's special UNIX signals become available From the outside it's difficult to determine whether (and when) the PID1 inside a container supports systemd's more complete set of UNIX process signals or not. Let's make this easier, and simply send a notification message when we are ready. --- diff --git a/src/core/manager.c b/src/core/manager.c index e0fdbfe0e60..7eeb7f3a26b 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -594,6 +594,17 @@ static int manager_setup_signals(Manager *m) { if (r < 0) return r; + /* Report to supervisor that we now process the above signals. We report this as level "2", to + * indicate that we support more than sysvinit's signals (of course, sysvinit never sent this + * message, but conceptually it makes sense to consider level "1" to be equivalent to sysvinit's + * signal handling). Also, by setting this to "2" people looking for this hopefully won't + * misunderstand this as a boolean concept. Signal level 2 shall refer to the signals PID 1 + * understands at the time of release of systemd v256, i.e. including basic SIGRTMIN+18 handling for + * memory pressure and stuff. When more signals are hooked up (or more SIGRTMIN+18 multiplex + * operations added, this level should be increased). */ + (void) sd_notify(/* unset_environment= */ false, + "X_SYSTEMD_SIGNALS_LEVEL=2"); + if (MANAGER_IS_SYSTEM(m)) return enable_special_signals(m);