X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftimer.c;h=b4521e6efc9b5acd57648e2912dfdbeffcd40732;hp=f0005f55ce364a9378f0e7d6800a5d39cb010e8d;hb=f60f22dfbb8cfa0eb55d1896db0e4c3f7d3cfacb;hpb=032ff4afc953cae076ce0ee6a0b85020eeb1a75a diff --git a/src/timer.c b/src/timer.c index f0005f55c..b4521e6ef 100644 --- a/src/timer.c +++ b/src/timer.c @@ -25,6 +25,7 @@ #include "unit-name.h" #include "timer.h" #include "dbus-timer.h" +#include "special.h" static const UnitActiveState state_translation_table[_TIMER_STATE_MAX] = { [TIMER_DEAD] = UNIT_INACTIVE, @@ -89,6 +90,11 @@ static int timer_load(Unit *u) { if ((r = unit_add_dependency(u, UNIT_BEFORE, t->unit, true)) < 0) return r; + + /* Timers shouldn't stay around on shutdown */ + if (t->meta.default_dependencies) + if ((r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true)) < 0) + return r; } return timer_verify(t); @@ -434,11 +440,11 @@ static const char* const timer_state_table[_TIMER_STATE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(timer_state, TimerState); static const char* const timer_base_table[_TIMER_BASE_MAX] = { - [TIMER_ACTIVE] = "OnActive", - [TIMER_BOOT] = "OnBoot", - [TIMER_STARTUP] = "OnStartup", - [TIMER_UNIT_ACTIVE] = "OnUnitActive", - [TIMER_UNIT_INACTIVE] = "OnUnitInactive" + [TIMER_ACTIVE] = "OnActiveSec", + [TIMER_BOOT] = "OnBootSec", + [TIMER_STARTUP] = "OnStartupSec", + [TIMER_UNIT_ACTIVE] = "OnUnitActiveSec", + [TIMER_UNIT_INACTIVE] = "OnUnitInactiveSec" }; DEFINE_STRING_TABLE_LOOKUP(timer_base, TimerBase);