diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-04-16 19:14:11 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-04-16 19:15:00 +0200 |
commit | b59e246565337d6c6967059dd15a52a15277433e (patch) | |
tree | 3ea65b16f40db14e76ee5437a76c9d2173ea8728 /src/core | |
parent | b69d29ce049f12d463a589e18561dd10ee8c09f1 (diff) |
logind: remove redundant entries from logind's default controller lists too
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/cgroup.c | 31 | ||||
-rw-r--r-- | src/core/cgroup.h | 1 | ||||
-rw-r--r-- | src/core/manager.c | 3 |
3 files changed, 3 insertions, 32 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c index b1e22e0ac3..e07d1ed3c9 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -373,7 +373,7 @@ int manager_setup_cgroup(Manager *m) { log_debug("Created root group."); - manager_shorten_default_controllers(m); + cg_shorten_controllers(m->default_controllers); finish: free(current); @@ -397,35 +397,6 @@ void manager_shutdown_cgroup(Manager *m, bool delete) { m->cgroup_hierarchy = NULL; } -void manager_shorten_default_controllers(Manager *m) { - char **f, **t; - - strv_uniq(m->default_controllers); - - if (!m->default_controllers) - return; - - for (f = m->default_controllers, t = m->default_controllers; *f; f++) { - - if (!streq(*f, "systemd") && !streq(*f, "name=systemd")) { - char *cc; - - cc = alloca(sizeof("/sys/fs/cgroup/") + strlen(*f)); - strcpy(stpcpy(cc, "/sys/fs/cgroup/"), *f); - - if (access(cc, F_OK) >= 0) { - *(t++) = *f; - continue; - } - } - - log_debug("Controller %s not available or redundant, removing from default controllers list.", *f); - free(*f); - } - - *t = NULL; -} - int cgroup_bonding_get(Manager *m, const char *cgroup, CGroupBonding **bonding) { CGroupBonding *b; char *p; diff --git a/src/core/cgroup.h b/src/core/cgroup.h index dd2e6a4aee..95f09e0019 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -85,7 +85,6 @@ pid_t cgroup_bonding_search_main_pid_list(CGroupBonding *b); int manager_setup_cgroup(Manager *m); void manager_shutdown_cgroup(Manager *m, bool delete); -void manager_shorten_default_controllers(Manager *m); int cgroup_bonding_get(Manager *m, const char *cgroup, CGroupBonding **bonding); int cgroup_notify_empty(Manager *m, const char *group); diff --git a/src/core/manager.c b/src/core/manager.c index 44690525ea..1446c01ea5 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -63,6 +63,7 @@ #include "exit-status.h" #include "virt.h" #include "watchdog.h" +#include "cgroup-util.h" /* As soon as 16 units are in our GC queue, make sure to run a gc sweep */ #define GC_QUEUE_ENTRIES_MAX 16 @@ -3172,7 +3173,7 @@ int manager_set_default_controllers(Manager *m, char **controllers) { strv_free(m->default_controllers); m->default_controllers = l; - manager_shorten_default_controllers(m); + cg_shorten_controllers(m->default_controllers); return 0; } |