return cg_translate_error(r, errno);
}
- free(m->cgroup_controller);
- if (!(m->cgroup_controller = strdup("name=systemd")))
- return -ENOMEM;
-
free(m->cgroup_mount_point);
m->cgroup_mount_point = NULL;
- if ((r = cgroup_get_subsys_mount_point(m->cgroup_controller, &m->cgroup_mount_point)))
+ if ((r = cgroup_get_subsys_mount_point(SYSTEMD_CGROUP_CONTROLLER, &m->cgroup_mount_point)))
return cg_translate_error(r, errno);
pid = getpid();
- if ((r = cgroup_get_current_controller_path(pid, m->cgroup_controller, &cp)))
+ if ((r = cgroup_get_current_controller_path(pid, SYSTEMD_CGROUP_CONTROLLER, &cp)))
return cg_translate_error(r, errno);
snprintf(suffix, sizeof(suffix), "/systemd-%u", (unsigned) pid);
return -ENOMEM;
}
- log_debug("Using cgroup controller <%s>, hierarchy mounted at <%s>, using root group <%s>.",
- m->cgroup_controller,
+ log_debug("Using cgroup controller <" SYSTEMD_CGROUP_CONTROLLER ">, hierarchy mounted at <%s>, using root group <%s>.",
m->cgroup_mount_point,
m->cgroup_hierarchy);
- if ((r = cg_install_release_agent(m->cgroup_controller, CGROUP_AGENT_PATH)) < 0)
+ if ((r = cg_install_release_agent(SYSTEMD_CGROUP_CONTROLLER, CGROUP_AGENT_PATH)) < 0)
log_warning("Failed to install release agent, ignoring: %s", strerror(-r));
else
log_debug("Installed release agent, or already installed.");
- if ((r = cg_create_and_attach(m->cgroup_controller, m->cgroup_hierarchy, 0)) < 0)
+ if ((r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_hierarchy, 0)) < 0)
log_error("Failed to create root cgroup hierarchy: %s", strerror(-r));
else
log_debug("Created root group.");
int manager_shutdown_cgroup(Manager *m) {
assert(m);
- if (!m->cgroup_controller || !m->cgroup_hierarchy)
+ if (!m->cgroup_hierarchy)
return 0;
- return cg_delete(m->cgroup_controller, m->cgroup_hierarchy);
+ return cg_delete(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_hierarchy);
}
int cgroup_notify_empty(Manager *m, const char *group) {
if (pid <= 1)
return NULL;
- if ((r = cg_get_by_pid(m->cgroup_controller, pid, &group)))
+ if ((r = cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, pid, &group)))
return NULL;
l = hashmap_get(m->cgroup_bondings, group);
if (n > 0)
controller = strndup(name, n);
else
- controller = strdup(u->meta.manager->cgroup_controller);
+ controller = strdup(SYSTEMD_CGROUP_CONTROLLER);
if (!controller) {
r = -ENOMEM;
if (!(b = new0(CGroupBonding, 1)))
return -ENOMEM;
- if (!(b->controller = strdup(u->meta.manager->cgroup_controller)))
+ if (!(b->controller = strdup(SYSTEMD_CGROUP_CONTROLLER)))
goto fail;
if (!(b->path = default_cgroup_path(u)))
CGroupBonding* unit_get_default_cgroup(Unit *u) {
assert(u);
- return cgroup_bonding_find_list(u->meta.cgroup_bondings, u->meta.manager->cgroup_controller);
+ return cgroup_bonding_find_list(u->meta.cgroup_bondings, SYSTEMD_CGROUP_CONTROLLER);
}
int unit_load_related_unit(Unit *u, const char *type, Unit **_found) {