service: Display updated WatchdogUSec from sd_notify
authorChris Down <chris@chrisdown.name>
Tue, 26 May 2020 13:35:18 +0000 (14:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 27 May 2020 07:09:40 +0000 (09:09 +0200)
commit4793c31083031e729e6eb17b87b540a3944bba3b
tree235e268f9942e0c8a0204133b824897d20c50ceb
parent2991fa41e4c97eea8b3707834c44ad299711d5a5
service: Display updated WatchdogUSec from sd_notify

Suppose a service has WatchdogSec set to 2 seconds in its unit file. I
then start the service and WatchdogUSec is set correctly:

    % systemctl --user show psi-notify -p WatchdogUSec
    WatchdogUSec=2s

Now I call `sd_notify(0, "WATCHDOG_USEC=10000000")`. The new timer seems
to have taken effect, since I only send `WATCHDOG=1` every 4 seconds,
and systemd isn't triggering the watchdog handler. However, `systemctl
show` still shows WatchdogUSec as 2s:

    % systemctl --user show psi-notify -p WatchdogUSec
    WatchdogUSec=2s

This seems surprising, since this "original" watchdog timer isn't the
one taking effect any more. This patch makes it so that we instead
display the new watchdog timer after sd_notify(WATCHDOG_USEC):

    % systemctl --user show psi-notify -p WatchdogUSec
    WatchdogUSec=10s

Fixes #15726.
src/core/dbus-service.c
src/core/service.c
src/core/service.h