X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fswap.c;h=23a98dd63f12070e309095f8819d53d6cd97f409;hb=867b3b7d6b88ba4d07ec7c830576d4ac2f7dd226;hp=0d3cb2f40622c608865313ff23876f5139bc5c17;hpb=cfcfd4aefe2141d324f51033057674d9f1171ef3;p=elogind.git diff --git a/src/swap.c b/src/swap.c index 0d3cb2f40..23a98dd63 100644 --- a/src/swap.c +++ b/src/swap.c @@ -36,6 +36,7 @@ #include "dbus-swap.h" #include "special.h" #include "bus-errors.h" +#include "exit-status.h" static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = { [SWAP_DEAD] = UNIT_INACTIVE, @@ -501,7 +502,7 @@ static void swap_set_state(Swap *s, SwapState state) { swap_state_to_string(old_state), swap_state_to_string(state)); - unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state]); + unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true); } static int swap_coldplug(Unit *u) { @@ -995,13 +996,23 @@ static void swap_timer_event(Unit *u, uint64_t elapsed, Watch *w) { break; case SWAP_ACTIVATING_SIGTERM: - log_warning("%s activation timed out. Killing.", u->meta.id); - swap_enter_signal(s, SWAP_ACTIVATING_SIGKILL, false); + if (s->exec_context.send_sigkill) { + log_warning("%s activation timed out. Killing.", u->meta.id); + swap_enter_signal(s, SWAP_ACTIVATING_SIGKILL, false); + } else { + log_warning("%s activation timed out. Skipping SIGKILL. Ignoring.", u->meta.id); + swap_enter_dead(s, false); + } break; case SWAP_DEACTIVATING_SIGTERM: - log_warning("%s deactivation timed out. Killing.", u->meta.id); - swap_enter_signal(s, SWAP_DEACTIVATING_SIGKILL, false); + if (s->exec_context.send_sigkill) { + log_warning("%s deactivation timed out. Killing.", u->meta.id); + swap_enter_signal(s, SWAP_DEACTIVATING_SIGKILL, false); + } else { + log_warning("%s deactivation timed out. Skipping SIGKILL. Ignoring.", u->meta.id); + swap_enter_dead(s, false); + } break; case SWAP_ACTIVATING_SIGKILL: