diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-03-12 20:55:13 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-03-12 20:55:13 +0100 |
commit | f755e3b74b94296a534033dd6ae04d9506434210 (patch) | |
tree | 90298b78955a4a8995ce4b51b9a0364cb05be503 /src/core/manager.h | |
parent | 0325941fff60888ff3486f271b0d513a75f9a324 (diff) |
core: introduce system state enum
The system state knows the states starting →
running/degraded/maintenance → stopping, where:
starting = system startup
running = normal operation
degraded = at least one unit is currently in failed state
maintenance = rescue/emergency mode is active or queued
stopping = system shutdown
Diffstat (limited to 'src/core/manager.h')
-rw-r--r-- | src/core/manager.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/core/manager.h b/src/core/manager.h index e014abd04f..38f1c89c93 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -35,8 +35,18 @@ typedef struct Manager Manager; -typedef enum ManagerExitCode { +typedef enum ManagerState { + MANAGER_STARTING, MANAGER_RUNNING, + MANAGER_DEGRADED, + MANAGER_MAINTENANCE, + MANAGER_STOPPING, + _MANAGER_STATE_MAX, + _MANAGER_STATE_INVALID = -1 +} ManagerState; + +typedef enum ManagerExitCode { + MANAGER_OK, MANAGER_EXIT, MANAGER_RELOAD, MANAGER_REEXECUTE, @@ -106,6 +116,9 @@ struct Manager { Hashmap *watch_pids1; /* pid => Unit object n:1 */ Hashmap *watch_pids2; /* pid => Unit object n:1 */ + /* A set which contains all currently failed units */ + Set *failed_units; + sd_event_source *run_queue_event_source; char *notify_socket; @@ -321,3 +334,8 @@ void manager_flip_auto_status(Manager *m, bool enable); Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path); const char *manager_get_runtime_prefix(Manager *m); + +ManagerState manager_state(Manager *m); + +const char *manager_state_to_string(ManagerState m) _const_; +ManagerState manager_state_from_string(const char *s) _pure_; |