chiark / gitweb /
util: replace close_pipe() with new safe_close_pair()
[elogind.git] / src / core / manager.h
index 9dee48ddded2a72dd21f26875c7e031493129e84..38f1c89c930c6889701b20e3352acb20fcbd1949 100644 (file)
 
 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,
@@ -58,6 +68,7 @@ typedef enum ManagerExitCode {
 #include "execute.h"
 #include "unit-name.h"
 #include "exit-status.h"
+#include "show-status.h"
 
 struct Manager {
         /* Note that the set of units we know of is allowed to be
@@ -105,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;
@@ -167,7 +181,13 @@ struct Manager {
         Set *private_buses;
         int private_listen_fd;
         sd_event_source *private_listen_event_source;
-        Set *subscribed;
+
+        /* Contains all the clients that are subscribed to signals via
+        the API bus. Note that private bus connections are always
+        considered subscribes, since they last for very short only,
+        and it is much simpler that way. */
+        sd_bus_track *subscribed;
+        char **deserialized_subscribed;
 
         sd_bus_message *queued_message; /* This is used during reloading:
                                       * before the reload we queue the
@@ -221,7 +241,7 @@ struct Manager {
         bool default_memory_accounting;
         bool default_blockio_accounting;
 
-        struct rlimit *rlimit[RLIMIT_NLIMITS];
+        struct rlimit *rlimit[_RLIMIT_MAX];
 
         /* non-zero if we are reloading or reexecuting, */
         int n_reloading;
@@ -312,3 +332,10 @@ void manager_status_printf(Manager *m, bool ephemeral, const char *status, const
 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_;