chiark / gitweb /
core: send sigabrt on watchdog timeout to get the stacktrace
[elogind.git] / src / core / unit.h
index a773762f36950a6a81543173c07919cfa1824e2d..081ab18f10289fd2b74dc2e9dc97e8ed959ddfcb 100644 (file)
@@ -41,6 +41,7 @@ typedef struct UnitStatusMessageFormats UnitStatusMessageFormats;
 #include "condition.h"
 #include "install.h"
 #include "unit-name.h"
+#include "failure-action.h"
 
 enum UnitActiveState {
         UNIT_ACTIVE,
@@ -53,6 +54,12 @@ enum UnitActiveState {
         _UNIT_ACTIVE_STATE_INVALID = -1
 };
 
+typedef enum KillOperation {
+        KILL_TERMINATE,
+        KILL_KILL,
+        KILL_ABORT,
+} KillOperation;
+
 static inline bool UNIT_IS_ACTIVE_OR_RELOADING(UnitActiveState t) {
         return t == UNIT_ACTIVE || t == UNIT_RELOADING;
 }
@@ -112,7 +119,10 @@ struct Unit {
         /* JOB_NOP jobs are special and can be installed without disturbing the real job. */
         Job *nop_job;
 
+        /* Job timeout and action to take */
         usec_t job_timeout;
+        FailureAction job_timeout_action;
+        char *job_timeout_reboot_arg;
 
         /* References to this */
         LIST_HEAD(UnitRef, refs);
@@ -127,12 +137,6 @@ struct Unit {
         dual_timestamp active_exit_timestamp;
         dual_timestamp inactive_enter_timestamp;
 
-        /* Counterparts in the cgroup filesystem */
-        char *cgroup_path;
-        CGroupControllerMask cgroup_realized_mask;
-        CGroupControllerMask cgroup_subtree_mask;
-        CGroupControllerMask cgroup_members_mask;
-
         UnitRef slice;
 
         /* Per type list */
@@ -176,6 +180,15 @@ struct Unit {
         /* Cached unit file state */
         UnitFileState unit_file_state;
 
+        /* Counterparts in the cgroup filesystem */
+        char *cgroup_path;
+        CGroupControllerMask cgroup_realized_mask;
+        CGroupControllerMask cgroup_subtree_mask;
+        CGroupControllerMask cgroup_members_mask;
+
+        /* How to start OnFailure units */
+        JobMode on_failure_job_mode;
+
         /* Garbage collect us we nobody wants or requires us anymore */
         bool stop_when_unneeded;
 
@@ -191,9 +204,6 @@ struct Unit {
         /* Allow isolation requests */
         bool allow_isolate;
 
-        /* How to start OnFailure units */
-        JobMode on_failure_job_mode;
-
         /* Ignore this unit when isolating */
         bool ignore_on_isolate;
 
@@ -572,7 +582,7 @@ int unit_write_drop_in_private_format(Unit *u, UnitSetPropertiesMode mode, const
 
 int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name);
 
-int unit_kill_context(Unit *u, KillContext *c, bool sigkill, pid_t main_pid, pid_t control_pid, bool main_pid_alien);
+int unit_kill_context(Unit *u, KillContext *c, KillOperation k, pid_t main_pid, pid_t control_pid, bool main_pid_alien);
 
 int unit_make_transient(Unit *u);