From fb6becb4436ae4078337011b2017ce294e7361cf Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 2 Jul 2013 01:46:30 +0200 Subject: logind: port over to use scopes+slices for all cgroup stuff In order to prepare things for the single-writer cgroup scheme, let's make logind use systemd's own primitives for cgroup management. Every login user now gets his own private slice unit, in which his sessions live in a scope unit each. Also, add user@$UID.service to the same slice, and implicitly start it on first login. --- src/login/logind-machine.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/login/logind-machine.h') diff --git a/src/login/logind-machine.h b/src/login/logind-machine.h index cd5174ff9e..a09f07195a 100644 --- a/src/login/logind-machine.h +++ b/src/login/logind-machine.h @@ -28,6 +28,14 @@ typedef struct Machine Machine; #include "logind.h" #include "logind-session.h" +typedef enum MachineState { + MACHINE_OPENING, /* Machine is being registered */ + MACHINE_RUNNING, /* Machine is running */ + MACHINE_CLOSING, /* Machine is terminating */ + _MACHINE_STATE_MAX, + _MACHINE_STATE_INVALID = -1 +} MachineState; + typedef enum MachineClass { MACHINE_CONTAINER, MACHINE_VM, @@ -41,14 +49,16 @@ struct Machine { char *name; sd_id128_t id; + MachineState state; MachineClass class; char *state_file; char *service; - char *cgroup_path; - char *slice; char *root_directory; + char *scope; + char *scope_job; + pid_t leader; dual_timestamp timestamp; @@ -56,6 +66,8 @@ struct Machine { bool in_gc_queue:1; bool started:1; + DBusMessage *create_message; + LIST_FIELDS(Machine, gc_queue); }; @@ -71,10 +83,17 @@ int machine_kill(Machine *m, KillWho who, int signo); char *machine_bus_path(Machine *s); +MachineState machine_get_state(Machine *u); + extern const DBusObjectPathVTable bus_machine_vtable; int machine_send_signal(Machine *m, bool new_machine); int machine_send_changed(Machine *m, const char *properties); +int machine_send_create_reply(Machine *m, DBusError *error); + const char* machine_class_to_string(MachineClass t) _const_; MachineClass machine_class_from_string(const char *s) _pure_; + +const char* machine_state_to_string(MachineState t) _const_; +MachineState machine_state_from_string(const char *s) _pure_; -- cgit v1.2.3-54-g00ecf