chiark / gitweb /
manager: make list of default controllers configurable
[elogind.git] / src / manager.c
index 25d85eaf110727f2d790a85a447e0eb92533979f..62847061a27319be99daebe533c49afd0352d20e 100644 (file)
@@ -222,6 +222,9 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
         if (!(m->environment = strv_copy(environ)))
                 goto fail;
 
+        if (!(m->default_controllers = strv_new("cpu", NULL)))
+                goto fail;
+
         if (!(m->units = hashmap_new(string_hash_func, string_compare_func)))
                 goto fail;
 
@@ -461,6 +464,8 @@ void manager_free(Manager *m) {
         lookup_paths_free(&m->lookup_paths);
         strv_free(m->environment);
 
+        strv_free(m->default_controllers);
+
         hashmap_free(m->cgroup_bondings);
         set_free_free(m->unit_path_cache);
 
@@ -2447,8 +2452,8 @@ void manager_send_unit_plymouth(Manager *m, Unit *u) {
 
         zero(sa);
         sa.sa.sa_family = AF_UNIX;
-        strncpy(sa.un.sun_path+1, "/ply-boot-protocol", sizeof(sa.un.sun_path)-1);
-        if (connect(fd, &sa.sa, sizeof(sa.un)) < 0) {
+        strncpy(sa.un.sun_path+1, "/org/freedesktop/plymouthd", sizeof(sa.un.sun_path)-1);
+        if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
 
                 if (errno != EPIPE &&
                     errno != EAGAIN &&
@@ -2988,6 +2993,20 @@ void manager_undo_generators(Manager *m) {
         m->generator_unit_path = NULL;
 }
 
+int manager_set_default_controllers(Manager *m, char **controllers) {
+        char **l;
+
+        assert(m);
+
+        if (!(l = strv_copy(controllers)))
+                return -ENOMEM;
+
+        strv_free(m->default_controllers);
+        m->default_controllers = l;
+
+        return 0;
+}
+
 static const char* const manager_running_as_table[_MANAGER_RUNNING_AS_MAX] = {
         [MANAGER_SYSTEM] = "system",
         [MANAGER_USER] = "user"