naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
923a60
From 2b787d523662b91334da24f1c77a7d803e53fab9 Mon Sep 17 00:00:00 2001
923a60
From: Lukas Nykryn <lnykryn@redhat.com>
923a60
Date: Tue, 3 Jan 2017 16:05:42 +0100
923a60
Subject: [PATCH] failure-action: generalize failure action to emergency action
923a60
923a60
Cherry-picked from: 87a47f99bc8e576a63581ad2593c62eb10a53814
923a60
Resolves: #1353028
923a60
---
923a60
 Makefile.am                                   |  4 +-
923a60
 src/core/dbus-service.c                       |  6 +-
923a60
 src/core/dbus-unit.c                          |  4 +-
923a60
 .../{failure-action.c => emergency-action.c}  | 65 ++++++++++---------
923a60
 .../{failure-action.h => emergency-action.h}  | 28 ++++----
923a60
 src/core/job.c                                |  2 +-
923a60
 src/core/load-fragment-gperf.gperf.m4         |  6 +-
923a60
 src/core/load-fragment.c                      |  4 +-
923a60
 src/core/load-fragment.h                      |  2 +-
923a60
 src/core/manager.h                            |  2 +-
923a60
 src/core/service.c                            |  4 +-
923a60
 src/core/service.h                            |  6 +-
923a60
 src/core/unit.c                               |  4 +-
923a60
 src/core/unit.h                               |  4 +-
923a60
 src/test/test-tables.c                        |  2 +-
923a60
 15 files changed, 72 insertions(+), 71 deletions(-)
923a60
 rename src/core/{failure-action.c => emergency-action.c} (63%)
923a60
 rename src/core/{failure-action.h => emergency-action.h} (58%)
923a60
923a60
diff --git a/Makefile.am b/Makefile.am
923a60
index 3848338a23..b347aed7db 100644
923a60
--- a/Makefile.am
923a60
+++ b/Makefile.am
923a60
@@ -1182,8 +1182,8 @@ libsystemd_core_la_SOURCES = \
923a60
 	src/core/audit-fd.h \
923a60
 	src/core/show-status.c \
923a60
 	src/core/show-status.h \
923a60
-	src/core/failure-action.c \
923a60
-	src/core/failure-action.h
923a60
+	src/core/emergency-action.c \
923a60
+	src/core/emergency-action.h
923a60
 
923a60
 nodist_libsystemd_core_la_SOURCES = \
923a60
 	src/core/load-fragment-gperf.c \
923a60
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
923a60
index 6d4713babc..325ed13f58 100644
923a60
--- a/src/core/dbus-service.c
923a60
+++ b/src/core/dbus-service.c
923a60
@@ -34,7 +34,7 @@ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, service_type, ServiceType
923a60
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, service_result, ServiceResult);
923a60
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_restart, service_restart, ServiceRestart);
923a60
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_notify_access, notify_access, NotifyAccess);
923a60
-static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_failure_action, failure_action, FailureAction);
923a60
+static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_emergency_action, emergency_action, EmergencyAction);
923a60
 
923a60
 const sd_bus_vtable bus_service_vtable[] = {
923a60
         SD_BUS_VTABLE_START(0),
923a60
@@ -49,9 +49,9 @@ const sd_bus_vtable bus_service_vtable[] = {
923a60
         BUS_PROPERTY_DUAL_TIMESTAMP("WatchdogTimestamp", offsetof(Service, watchdog_timestamp), 0),
923a60
         SD_BUS_PROPERTY("StartLimitInterval", "t", bus_property_get_usec, offsetof(Service, start_limit.interval), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("StartLimitBurst", "u", bus_property_get_unsigned, offsetof(Service, start_limit.burst), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
-        SD_BUS_PROPERTY("StartLimitAction", "s", property_get_failure_action, offsetof(Service, start_limit_action), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
+        SD_BUS_PROPERTY("StartLimitAction", "s", property_get_emergency_action, offsetof(Service, start_limit_action), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("RebootArgument", "s", NULL, offsetof(Service, reboot_arg), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
-        SD_BUS_PROPERTY("FailureAction", "s", property_get_failure_action, offsetof(Service, failure_action), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
+        SD_BUS_PROPERTY("FailureAction", "s", property_get_emergency_action, offsetof(Service, emergency_action), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("PermissionsStartOnly", "b", bus_property_get_bool, offsetof(Service, permissions_start_only), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("RootDirectoryStartOnly", "b", bus_property_get_bool, offsetof(Service, root_directory_start_only), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("RemainAfterExit", "b", bus_property_get_bool, offsetof(Service, remain_after_exit), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
923a60
index c3654db9ea..89b00e94c6 100644
923a60
--- a/src/core/dbus-unit.c
923a60
+++ b/src/core/dbus-unit.c
923a60
@@ -33,7 +33,7 @@
923a60
 
923a60
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_load_state, unit_load_state, UnitLoadState);
923a60
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_job_mode, job_mode, JobMode);
923a60
-static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_failure_action, failure_action, FailureAction);
923a60
+static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_emergency_action, emergency_action, EmergencyAction);
923a60
 
923a60
 static int property_get_names(
923a60
                 sd_bus *bus,
923a60
@@ -595,7 +595,7 @@ const sd_bus_vtable bus_unit_vtable[] = {
923a60
         SD_BUS_PROPERTY("IgnoreOnSnapshot", "b", bus_property_get_bool, offsetof(Unit, ignore_on_snapshot), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("NeedDaemonReload", "b", property_get_need_daemon_reload, 0, SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("JobTimeoutUSec", "t", bus_property_get_usec, offsetof(Unit, job_timeout), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
-        SD_BUS_PROPERTY("JobTimeoutAction", "s", property_get_failure_action, offsetof(Unit, job_timeout_action), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
+        SD_BUS_PROPERTY("JobTimeoutAction", "s", property_get_emergency_action, offsetof(Unit, job_timeout_action), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("JobTimeoutRebootArgument", "s", NULL, offsetof(Unit, job_timeout_reboot_arg), SD_BUS_VTABLE_PROPERTY_CONST),
923a60
         SD_BUS_PROPERTY("ConditionResult", "b", bus_property_get_bool, offsetof(Unit, condition_result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
923a60
         SD_BUS_PROPERTY("AssertResult", "b", bus_property_get_bool, offsetof(Unit, assert_result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
923a60
diff --git a/src/core/failure-action.c b/src/core/emergency-action.c
923a60
similarity index 63%
923a60
rename from src/core/failure-action.c
923a60
rename to src/core/emergency-action.c
923a60
index ce522a4e4f..f07b1257a0 100644
923a60
--- a/src/core/failure-action.c
923a60
+++ b/src/core/emergency-action.c
923a60
@@ -27,44 +27,45 @@
923a60
 #include "bus-util.h"
923a60
 #include "bus-error.h"
923a60
 #include "special.h"
923a60
-#include "failure-action.h"
923a60
+#include "emergency-action.h"
923a60
 
923a60
-static void log_and_status(Manager *m, const char *message) {
923a60
-        log_warning("%s", message);
923a60
+static void log_and_status(Manager *m, const char *message, const char *reason) {
923a60
+        log_warning("%s: %s", message, reason);
923a60
         manager_status_printf(m, STATUS_TYPE_EMERGENCY,
923a60
                               ANSI_HIGHLIGHT_RED_ON " !!  " ANSI_HIGHLIGHT_OFF,
923a60
-                              "%s", message);
923a60
+                              "%s: %s", message, reason);
923a60
 }
923a60
 
923a60
-int failure_action(
923a60
+int emergency_action(
923a60
                 Manager *m,
923a60
-                FailureAction action,
923a60
-                const char *reboot_arg) {
923a60
+                EmergencyAction action,
923a60
+                const char *reboot_arg,
923a60
+                const char *reason) {
923a60
 
923a60
         int r;
923a60
 
923a60
         assert(m);
923a60
         assert(action >= 0);
923a60
-        assert(action < _FAILURE_ACTION_MAX);
923a60
+        assert(action < _EMERGENCY_ACTION_MAX);
923a60
 
923a60
-        if (action == FAILURE_ACTION_NONE)
923a60
+        if (action == EMERGENCY_ACTION_NONE)
923a60
                 return -ECANCELED;
923a60
 
923a60
         if (m->running_as == SYSTEMD_USER) {
923a60
                 /* Downgrade all options to simply exiting if we run
923a60
                  * in user mode */
923a60
 
923a60
-                log_warning("Exiting as result of failure.");
923a60
+                log_warning("Exiting: %s", reason);
923a60
                 m->exit_code = MANAGER_EXIT;
923a60
                 return -ECANCELED;
923a60
         }
923a60
 
923a60
         switch (action) {
923a60
 
923a60
-        case FAILURE_ACTION_REBOOT: {
923a60
+        case EMERGENCY_ACTION_REBOOT: {
923a60
                 _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
923a60
 
923a60
-                log_and_status(m, "Rebooting as result of failure.");
923a60
+                log_and_status(m, "Rebooting", reason);
923a60
 
923a60
                 update_reboot_param_file(reboot_arg);
923a60
                 r = manager_add_job_by_name(m, JOB_START, SPECIAL_REBOOT_TARGET, JOB_REPLACE, true, &error, NULL);
923a60
@@ -74,15 +75,15 @@ int failure_action(
923a60
                 break;
923a60
         }
923a60
 
923a60
-        case FAILURE_ACTION_REBOOT_FORCE:
923a60
-                log_and_status(m, "Forcibly rebooting as result of failure.");
923a60
+        case EMERGENCY_ACTION_REBOOT_FORCE:
923a60
+                log_and_status(m, "Forcibly rebooting", reason);
923a60
 
923a60
                 update_reboot_param_file(reboot_arg);
923a60
                 m->exit_code = MANAGER_REBOOT;
923a60
                 break;
923a60
 
923a60
-        case FAILURE_ACTION_REBOOT_IMMEDIATE:
923a60
-                log_and_status(m, "Rebooting immediately as result of failure.");
923a60
+        case EMERGENCY_ACTION_REBOOT_IMMEDIATE:
923a60
+                log_and_status(m, "Rebooting immediately", reason);
923a60
 
923a60
                 sync();
923a60
 
923a60
@@ -95,10 +96,10 @@ int failure_action(
923a60
                 reboot(RB_AUTOBOOT);
923a60
                 break;
923a60
 
923a60
-        case FAILURE_ACTION_POWEROFF: {
923a60
+        case EMERGENCY_ACTION_POWEROFF: {
923a60
                 _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
923a60
 
923a60
-                log_and_status(m, "Powering off as result of failure.");
923a60
+                log_and_status(m, "Powering off", reason);
923a60
 
923a60
                 r = manager_add_job_by_name(m, JOB_START, SPECIAL_POWEROFF_TARGET, JOB_REPLACE, true, &error, NULL);
923a60
                 if (r < 0)
923a60
@@ -107,13 +108,13 @@ int failure_action(
923a60
                 break;
923a60
         }
923a60
 
923a60
-        case FAILURE_ACTION_POWEROFF_FORCE:
923a60
-                log_and_status(m, "Forcibly powering off as result of failure.");
923a60
+        case EMERGENCY_ACTION_POWEROFF_FORCE:
923a60
+                log_and_status(m, "Forcibly powering off", reason);
923a60
                 m->exit_code = MANAGER_POWEROFF;
923a60
                 break;
923a60
 
923a60
-        case FAILURE_ACTION_POWEROFF_IMMEDIATE:
923a60
-                log_and_status(m, "Powering off immediately as result of failure.");
923a60
+        case EMERGENCY_ACTION_POWEROFF_IMMEDIATE:
923a60
+                log_and_status(m, "Powering off immediately", reason);
923a60
 
923a60
                 sync();
923a60
 
923a60
@@ -122,19 +123,19 @@ int failure_action(
923a60
                 break;
923a60
 
923a60
         default:
923a60
-                assert_not_reached("Unknown failure action");
923a60
+                assert_not_reached("Unknown emergency action");
923a60
         }
923a60
 
923a60
         return -ECANCELED;
923a60
 }
923a60
 
923a60
-static const char* const failure_action_table[_FAILURE_ACTION_MAX] = {
923a60
-        [FAILURE_ACTION_NONE] = "none",
923a60
-        [FAILURE_ACTION_REBOOT] = "reboot",
923a60
-        [FAILURE_ACTION_REBOOT_FORCE] = "reboot-force",
923a60
-        [FAILURE_ACTION_REBOOT_IMMEDIATE] = "reboot-immediate",
923a60
-        [FAILURE_ACTION_POWEROFF] = "poweroff",
923a60
-        [FAILURE_ACTION_POWEROFF_FORCE] = "poweroff-force",
923a60
-        [FAILURE_ACTION_POWEROFF_IMMEDIATE] = "poweroff-immediate"
923a60
+static const char* const emergency_action_table[_EMERGENCY_ACTION_MAX] = {
923a60
+        [EMERGENCY_ACTION_NONE] = "none",
923a60
+        [EMERGENCY_ACTION_REBOOT] = "reboot",
923a60
+        [EMERGENCY_ACTION_REBOOT_FORCE] = "reboot-force",
923a60
+        [EMERGENCY_ACTION_REBOOT_IMMEDIATE] = "reboot-immediate",
923a60
+        [EMERGENCY_ACTION_POWEROFF] = "poweroff",
923a60
+        [EMERGENCY_ACTION_POWEROFF_FORCE] = "poweroff-force",
923a60
+        [EMERGENCY_ACTION_POWEROFF_IMMEDIATE] = "poweroff-immediate"
923a60
 };
923a60
-DEFINE_STRING_TABLE_LOOKUP(failure_action, FailureAction);
923a60
+DEFINE_STRING_TABLE_LOOKUP(emergency_action, EmergencyAction);
923a60
diff --git a/src/core/failure-action.h b/src/core/emergency-action.h
923a60
similarity index 58%
923a60
rename from src/core/failure-action.h
923a60
rename to src/core/emergency-action.h
923a60
index 1af4dd987b..d3ac0f31c9 100644
923a60
--- a/src/core/failure-action.h
923a60
+++ b/src/core/emergency-action.h
923a60
@@ -22,22 +22,22 @@
923a60
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
923a60
 ***/
923a60
 
923a60
-typedef enum FailureAction {
923a60
-        FAILURE_ACTION_NONE,
923a60
-        FAILURE_ACTION_REBOOT,
923a60
-        FAILURE_ACTION_REBOOT_FORCE,
923a60
-        FAILURE_ACTION_REBOOT_IMMEDIATE,
923a60
-        FAILURE_ACTION_POWEROFF,
923a60
-        FAILURE_ACTION_POWEROFF_FORCE,
923a60
-        FAILURE_ACTION_POWEROFF_IMMEDIATE,
923a60
-        _FAILURE_ACTION_MAX,
923a60
-        _FAILURE_ACTION_INVALID = -1
923a60
-} FailureAction;
923a60
+typedef enum EmergencyAction {
923a60
+        EMERGENCY_ACTION_NONE,
923a60
+        EMERGENCY_ACTION_REBOOT,
923a60
+        EMERGENCY_ACTION_REBOOT_FORCE,
923a60
+        EMERGENCY_ACTION_REBOOT_IMMEDIATE,
923a60
+        EMERGENCY_ACTION_POWEROFF,
923a60
+        EMERGENCY_ACTION_POWEROFF_FORCE,
923a60
+        EMERGENCY_ACTION_POWEROFF_IMMEDIATE,
923a60
+        _EMERGENCY_ACTION_MAX,
923a60
+        _EMERGENCY_ACTION_INVALID = -1
923a60
+} EmergencyAction;
923a60
 
923a60
 #include "macro.h"
923a60
 #include "manager.h"
923a60
 
923a60
-int failure_action(Manager *m, FailureAction action, const char *reboot_arg);
923a60
+int emergency_action(Manager *m, EmergencyAction action, const char *reboot_arg, const char *reason);
923a60
 
923a60
-const char* failure_action_to_string(FailureAction i) _const_;
923a60
-FailureAction failure_action_from_string(const char *s) _pure_;
923a60
+const char* emergency_action_to_string(EmergencyAction i) _const_;
923a60
+EmergencyAction emergency_action_from_string(const char *s) _pure_;
923a60
diff --git a/src/core/job.c b/src/core/job.c
923a60
index c2876dec18..703286496f 100644
923a60
--- a/src/core/job.c
923a60
+++ b/src/core/job.c
923a60
@@ -916,7 +916,7 @@ static int job_dispatch_timer(sd_event_source *s, uint64_t monotonic, void *user
923a60
         u = j->unit;
923a60
         job_finish_and_invalidate(j, JOB_TIMEOUT, true, false);
923a60
 
923a60
-        failure_action(u->manager, u->job_timeout_action, u->job_timeout_reboot_arg);
923a60
+        emergency_action(u->manager, u->job_timeout_action, u->job_timeout_reboot_arg, "job timed out");
923a60
 
923a60
         return 0;
923a60
 }
923a60
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
923a60
index ce1397c7e8..45d1ead45b 100644
923a60
--- a/src/core/load-fragment-gperf.gperf.m4
923a60
+++ b/src/core/load-fragment-gperf.gperf.m4
923a60
@@ -156,7 +156,7 @@ Unit.OnFailureIsolate,           config_parse_job_mode_isolate,      0,
923a60
 Unit.IgnoreOnIsolate,            config_parse_bool,                  0,                             offsetof(Unit, ignore_on_isolate)
923a60
 Unit.IgnoreOnSnapshot,           config_parse_bool,                  0,                             offsetof(Unit, ignore_on_snapshot)
923a60
 Unit.JobTimeoutSec,              config_parse_sec,                   0,                             offsetof(Unit, job_timeout)
923a60
-Unit.JobTimeoutAction,           config_parse_failure_action,        0,                             offsetof(Unit, job_timeout_action)
923a60
+Unit.JobTimeoutAction,           config_parse_emergency_action,        0,                             offsetof(Unit, job_timeout_action)
923a60
 Unit.JobTimeoutRebootArgument,   config_parse_string,                0,                             offsetof(Unit, job_timeout_reboot_arg)
923a60
 Unit.ConditionPathExists,        config_parse_unit_condition_path,   CONDITION_PATH_EXISTS,         offsetof(Unit, conditions)
923a60
 Unit.ConditionPathExistsGlob,    config_parse_unit_condition_path,   CONDITION_PATH_EXISTS_GLOB,    offsetof(Unit, conditions)
923a60
@@ -211,9 +211,9 @@ Service.TimeoutStopSec,          config_parse_service_timeout,       0,
923a60
 Service.WatchdogSec,             config_parse_sec,                   0,                             offsetof(Service, watchdog_usec)
923a60
 Service.StartLimitInterval,      config_parse_sec,                   0,                             offsetof(Service, start_limit.interval)
923a60
 Service.StartLimitBurst,         config_parse_unsigned,              0,                             offsetof(Service, start_limit.burst)
923a60
-Service.StartLimitAction,        config_parse_failure_action,        0,                             offsetof(Service, start_limit_action)
923a60
+Service.StartLimitAction,        config_parse_emergency_action,      0,                             offsetof(Service, start_limit_action)
923a60
 Service.RebootArgument,          config_parse_string,                0,                             offsetof(Service, reboot_arg)
923a60
-Service.FailureAction,           config_parse_failure_action,        0,                             offsetof(Service, failure_action)
923a60
+Service.FailureAction,           config_parse_emergency_action,      0,                             offsetof(Service, emergency_action)
923a60
 Service.Type,                    config_parse_service_type,          0,                             offsetof(Service, type)
923a60
 Service.Restart,                 config_parse_service_restart,       0,                             offsetof(Service, restart)
923a60
 Service.PermissionsStartOnly,    config_parse_bool,                  0,                             offsetof(Service, permissions_start_only)
923a60
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
923a60
index 83b6e7efca..4fecb83142 100644
923a60
--- a/src/core/load-fragment.c
923a60
+++ b/src/core/load-fragment.c
923a60
@@ -2382,7 +2382,7 @@ int config_parse_unit_condition_null(
923a60
 }
923a60
 
923a60
 DEFINE_CONFIG_PARSE_ENUM(config_parse_notify_access, notify_access, NotifyAccess, "Failed to parse notify access specifier");
923a60
-DEFINE_CONFIG_PARSE_ENUM(config_parse_failure_action, failure_action, FailureAction, "Failed to parse failure action specifier");
923a60
+DEFINE_CONFIG_PARSE_ENUM(config_parse_emergency_action, emergency_action, EmergencyAction, "Failed to parse failure action specifier");
923a60
 
923a60
 int config_parse_unit_requires_mounts_for(
923a60
                 const char *unit,
923a60
@@ -3931,7 +3931,7 @@ void unit_dump_config_items(FILE *f) {
923a60
                 { config_parse_unit_slice,            "SLICE" },
923a60
                 { config_parse_documentation,         "URL" },
923a60
                 { config_parse_service_timeout,       "SECONDS" },
923a60
-                { config_parse_failure_action,        "ACTION" },
923a60
+                { config_parse_emergency_action,      "ACTION" },
923a60
                 { config_parse_set_status,            "STATUS" },
923a60
                 { config_parse_service_sockets,       "SOCKETS" },
923a60
                 { config_parse_environ,               "ENVIRON" },
923a60
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
923a60
index 359794d0ac..6114796126 100644
923a60
--- a/src/core/load-fragment.h
923a60
+++ b/src/core/load-fragment.h
923a60
@@ -78,7 +78,7 @@ int config_parse_unit_condition_string(const char *unit, const char *filename, u
923a60
 int config_parse_unit_condition_null(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
923a60
 int config_parse_kill_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
923a60
 int config_parse_notify_access(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
923a60
-int config_parse_failure_action(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
923a60
+int config_parse_emergency_action(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
923a60
 int config_parse_unit_requires_mounts_for(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
923a60
 int config_parse_syscall_filter(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
923a60
 int config_parse_syscall_archs(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
923a60
diff --git a/src/core/manager.h b/src/core/manager.h
923a60
index 42be1fc437..59913f4896 100644
923a60
--- a/src/core/manager.h
923a60
+++ b/src/core/manager.h
923a60
@@ -85,7 +85,7 @@ typedef enum StatusType {
923a60
 #include "unit-name.h"
923a60
 #include "exit-status.h"
923a60
 #include "show-status.h"
923a60
-#include "failure-action.h"
923a60
+#include "emergency-action.h"
923a60
 
923a60
 struct Manager {
923a60
         /* Note that the set of units we know of is allowed to be
923a60
diff --git a/src/core/service.c b/src/core/service.c
923a60
index babd3c52ae..6e7baa76c6 100644
923a60
--- a/src/core/service.c
923a60
+++ b/src/core/service.c
923a60
@@ -1280,7 +1280,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
923a60
 
923a60
         if (s->result != SERVICE_SUCCESS) {
923a60
                 log_unit_warning(UNIT(s)->id, "%s failed.", UNIT(s)->id);
923a60
-                failure_action(UNIT(s)->manager, s->failure_action, s->reboot_arg);
923a60
+                emergency_action(UNIT(s)->manager, s->emergency_action, s->reboot_arg, "service failed");
923a60
         }
923a60
 
923a60
         if (allow_restart &&
923a60
@@ -1821,7 +1821,7 @@ static int service_start_limit_test(Service *s) {
923a60
 
923a60
         log_unit_warning(UNIT(s)->id, "start request repeated too quickly for %s", UNIT(s)->id);
923a60
 
923a60
-        return failure_action(UNIT(s)->manager, s->start_limit_action, s->reboot_arg);
923a60
+        return emergency_action(UNIT(s)->manager, s->start_limit_action, s->reboot_arg, "service failed");
923a60
 }
923a60
 
923a60
 static int service_start(Unit *u) {
923a60
diff --git a/src/core/service.h b/src/core/service.h
923a60
index dfeee6a68c..1f937dfe57 100644
923a60
--- a/src/core/service.h
923a60
+++ b/src/core/service.h
923a60
@@ -29,7 +29,7 @@ typedef struct ServiceFDStore ServiceFDStore;
923a60
 #include "ratelimit.h"
923a60
 #include "kill.h"
923a60
 #include "exit-status.h"
923a60
-#include "failure-action.h"
923a60
+#include "emergency-action.h"
923a60
 
923a60
 typedef enum ServiceState {
923a60
         SERVICE_DEAD,
923a60
@@ -197,8 +197,8 @@ struct Service {
923a60
         int status_errno;
923a60
 
923a60
         RateLimit start_limit;
923a60
-        FailureAction start_limit_action;
923a60
-        FailureAction failure_action;
923a60
+        EmergencyAction start_limit_action;
923a60
+        EmergencyAction emergency_action;
923a60
         char *reboot_arg;
923a60
 
923a60
         UnitRef accept_socket;
923a60
diff --git a/src/core/unit.c b/src/core/unit.c
923a60
index a7d6d2f45b..4eb0d78f44 100644
923a60
--- a/src/core/unit.c
923a60
+++ b/src/core/unit.c
923a60
@@ -937,8 +937,8 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
923a60
         if (u->job_timeout > 0)
923a60
                 fprintf(f, "%s\tJob Timeout: %s\n", prefix, format_timespan(timespan, sizeof(timespan), u->job_timeout, 0));
923a60
 
923a60
-        if (u->job_timeout_action != FAILURE_ACTION_NONE)
923a60
-                fprintf(f, "%s\tJob Timeout Action: %s\n", prefix, failure_action_to_string(u->job_timeout_action));
923a60
+        if (u->job_timeout_action != EMERGENCY_ACTION_NONE)
923a60
+                fprintf(f, "%s\tJob Timeout Action: %s\n", prefix, emergency_action_to_string(u->job_timeout_action));
923a60
 
923a60
         if (u->job_timeout_reboot_arg)
923a60
                 fprintf(f, "%s\tJob Timeout Reboot Argument: %s\n", prefix, u->job_timeout_reboot_arg);
923a60
diff --git a/src/core/unit.h b/src/core/unit.h
923a60
index 35287a5b75..85f52df187 100644
923a60
--- a/src/core/unit.h
923a60
+++ b/src/core/unit.h
923a60
@@ -41,7 +41,7 @@ typedef struct UnitStatusMessageFormats UnitStatusMessageFormats;
923a60
 #include "condition.h"
923a60
 #include "install.h"
923a60
 #include "unit-name.h"
923a60
-#include "failure-action.h"
923a60
+#include "emergency-action.h"
923a60
 
923a60
 enum UnitActiveState {
923a60
         UNIT_ACTIVE,
923a60
@@ -121,7 +121,7 @@ struct Unit {
923a60
 
923a60
         /* Job timeout and action to take */
923a60
         usec_t job_timeout;
923a60
-        FailureAction job_timeout_action;
923a60
+        EmergencyAction job_timeout_action;
923a60
         char *job_timeout_reboot_arg;
923a60
 
923a60
         /* References to this */
923a60
diff --git a/src/test/test-tables.c b/src/test/test-tables.c
923a60
index bda224bec6..e4097903c4 100644
923a60
--- a/src/test/test-tables.c
923a60
+++ b/src/test/test-tables.c
923a60
@@ -67,7 +67,7 @@ int main(int argc, char **argv) {
923a60
         test_table(device_state, DEVICE_STATE);
923a60
         test_table(exec_input, EXEC_INPUT);
923a60
         test_table(exec_output, EXEC_OUTPUT);
923a60
-        test_table(failure_action, FAILURE_ACTION);
923a60
+        test_table(emergency_action, EMERGENCY_ACTION);
923a60
         test_table(job_mode, JOB_MODE);
923a60
         test_table(job_result, JOB_RESULT);
923a60
         test_table(job_state, JOB_STATE);