]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
manager: send an sd_notify() message informing the container manager when systemd...
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Mar 2024 17:48:28 +0000 (18:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 Mar 2024 16:24:16 +0000 (17:24 +0100)
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.

src/core/manager.c

index e0fdbfe0e601d4b79ef298c96c2b75c1de88934c..7eeb7f3a26ba9130f75dbdc54a0702a2286cc7b5 100644 (file)
@@ -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);