X Tutup
Skip to content

Commit 463aef2

Browse files
fbuihuupoettering
authored andcommitted
manager: reexecute on SIGRTMIN+25, user instances only
Before this patch, there was no way to request all running user instances for reexecuting. However this can be useful especially during package updates otherwise user instances are never updated and keep running a potentially very old version of the binaries. Now assuming that we have enough priviledge, it's possible to request reexecution of all user instances: systemctl kill --signal=SIGRTMIN+25 "user@*.service" Note that this request is obviously asynchronous as it relies on a signal. Keeping "systemctl kill" as the only interface should be good enough to make this obvious and that's the reason why another interface, such as "systemctl --global daemon-reexec" has not been considered. PID1 already uses SIGTERM for reexecuting hence sending it SIGRTMIN+25 is a nop.
1 parent fac5588 commit 463aef2

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

man/systemd.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,17 @@
585585
for --user instances).</para></listitem>
586586
</varlistentry>
587587

588+
<varlistentry>
589+
<term><constant>SIGRTMIN+25</constant></term>
590+
591+
<listitem><para>Upon receiving this signal the systemd manager will reexecute itself. This
592+
is mostly equivalent to <command>systemctl daemon-reexec</command> except that it will be
593+
done asynchronously.</para>
594+
595+
<para>The systemd system manager treats this signal the same way as
596+
<constant>SIGTERM</constant>.</para></listitem>
597+
</varlistentry>
598+
588599
<varlistentry>
589600
<term><constant>SIGRTMIN+26</constant></term>
590601

src/core/manager.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,7 @@ static int manager_setup_signals(Manager *m) {
578578
SIGRTMIN+22, /* systemd: set log level to LOG_DEBUG */
579579
SIGRTMIN+23, /* systemd: set log level to LOG_INFO */
580580
SIGRTMIN+24, /* systemd: Immediate exit (--user only) */
581-
582-
/* .. one free signal here ... */
581+
SIGRTMIN+25, /* systemd: reexecute manager */
583582

584583
/* Apparently Linux on hppa had fewer RT signals until v3.18,
585584
* SIGRTMAX was SIGRTMIN+25, and then SIGRTMIN was lowered,
@@ -2846,6 +2845,10 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
28462845
/* This is a nop on init */
28472846
break;
28482847

2848+
case 25:
2849+
m->objective = MANAGER_REEXECUTE;
2850+
break;
2851+
28492852
case 26:
28502853
case 29: /* compatibility: used to be mapped to LOG_TARGET_SYSLOG_OR_KMSG */
28512854
manager_restore_original_log_target(m);

0 commit comments

Comments
 (0)
X Tutup