* suspend/hibernate/hybrid support, auto-suspend logic with idle hint
-* filter default cgroups in logind too
-
* udev: remove /sys and /dev configurability
* udev: find a way to tell udev to not cancel firmware requests when running in initramfs
* add systemctl switch to dump transaction without executing it
-* suspend, resume support?
-
* drop cap bounding set in readahead and other services
External:
log_debug("Created root group.");
- manager_shorten_default_controllers(m);
+ cg_shorten_controllers(m->default_controllers);
finish:
free(current);
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;
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);
#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
strv_free(m->default_controllers);
m->default_controllers = l;
- manager_shorten_default_controllers(m);
+ cg_shorten_controllers(m->default_controllers);
return 0;
}
assert(m);
assert(m->epoll_fd <= 0);
+ cg_shorten_controllers(m->reset_controllers);
+ cg_shorten_controllers(m->controllers);
+
m->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (m->epoll_fd < 0)
return -errno;
#include "set.h"
#include "macro.h"
#include "util.h"
+#include "strv.h"
int cg_enumerate_processes(const char *controller, const char *path, FILE **_f) {
char *fs;
*path = p;
return 0;
}
+
+char **cg_shorten_controllers(char **controllers) {
+ char **f, **t;
+
+ controllers = strv_uniq(controllers);
+
+ if (!controllers)
+ return controllers;
+
+ for (f = controllers, t = controllers; *f; f++) {
+ char *cc;
+
+ if (streq(*f, "systemd") || streq(*f, SYSTEMD_CGROUP_CONTROLLER)) {
+ free(*f);
+ continue;
+ }
+
+ cc = alloca(sizeof("/sys/fs/cgroup/") + strlen(*f));
+ strcpy(stpcpy(cc, "/sys/fs/cgroup/"), *f);
+
+ if (access(cc, F_OK) < 0) {
+ log_debug("Controller %s is not available, removing from controllers list.", *f);
+ free(*f);
+ continue;
+ }
+
+ *(t++) = *f;
+ }
+
+ *t = NULL;
+ return controllers;
+}
int cg_get_user_path(char **path);
+char **cg_shorten_controllers(char **controllers);
+
#endif