X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=manager.h;h=9321e809b64037df0750d29bfe307fff22b3371e;hb=51f7e59683d103590e70d17a177f1710b0b0326c;hp=58e709b116725be1683d94943c1eeb40b372cca2;hpb=8d567588cad053f79abe603ab113e1b85a92f1da;p=elogind.git diff --git a/manager.h b/manager.h index 58e709b11..9321e809b 100644 --- a/manager.h +++ b/manager.h @@ -25,13 +25,23 @@ #include #include #include - #include +#include "fdset.h" + typedef struct Manager Manager; typedef enum WatchType WatchType; typedef struct Watch Watch; +typedef enum ManagerExitCode { + MANAGER_RUNNING, + MANAGER_EXIT, + MANAGER_RELOAD, + MANAGER_REEXECUTE, + _MANAGER_EXIT_CODE_MAX, + _MANAGER_EXIT_CODE_INVALID = -1 +} ManagerExitCode; + typedef enum ManagerRunningAs { MANAGER_INIT, /* root and pid=1 */ MANAGER_SYSTEM, /* root and pid!=1 */ @@ -108,9 +118,6 @@ struct Watch { #define SPECIAL_RUNLEVEL6_TARGET "runlevel6.target" struct Manager { - /* In which mode are we running */ - ManagerRunningAs running_as; - uint32_t current_job_id; /* Note that the set of units we know of is allowed to be @@ -155,6 +162,9 @@ struct Manager { bool confirm_spawn:1; + ManagerExitCode exit_code:4; + ManagerRunningAs running_as; + Hashmap *watch_pids; /* pid => Unit object n:1 */ int epoll_fd; @@ -179,6 +189,10 @@ struct Manager { /* Data specific to the D-Bus subsystem */ DBusConnection *api_bus, *system_bus; Set *subscribed; + DBusMessage *queued_message; /* This is used during reloading: + * before the reload we queue the + * reply message here, and + * afterwards we send it */ Hashmap *watch_bus; /* D-Bus names => Unit object n:1 */ int32_t name_data_slot; @@ -190,12 +204,17 @@ struct Manager { /* Data specific to the Automount subsystem */ int dev_autofs_fd; + + /* Data specific to the Snapshot subsystem */ + unsigned n_snapshots; }; int manager_new(ManagerRunningAs running_as, bool confirm_spawn, Manager **m); void manager_free(Manager *m); +int manager_enumerate(Manager *m); int manager_coldplug(Manager *m); +int manager_startup(Manager *m, FILE *serialization, FDSet *fds); Job *manager_get_job(Manager *m, uint32_t id); Unit *manager_get_unit(Manager *m, const char *name); @@ -227,6 +246,13 @@ void manager_write_utmp_runlevel(Manager *m, Unit *t); void manager_dispatch_bus_name_owner_changed(Manager *m, const char *name, const char* old_owner, const char *new_owner); void manager_dispatch_bus_query_pid_done(Manager *m, const char *name, pid_t pid); +int manager_open_serialization(FILE **_f); + +int manager_serialize(Manager *m, FILE *f, FDSet *fds); +int manager_deserialize(Manager *m, FILE *f, FDSet *fds); + +int manager_reload(Manager *m); + const char *manager_running_as_to_string(ManagerRunningAs i); ManagerRunningAs manager_running_as_from_string(const char *s);