daandemeyer / rpms / systemd

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