X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcgroup.c;h=0c6f20d4b75311bfa2b8b6e5944c26cb534db8b1;hb=e9816c4859454d341279f1c9e77df4af4bacd534;hp=5864858dd7e7099011aebcc48ed1b128e18ab1f2;hpb=12235040ec94279ad92693dcfae0a4d9c35a6076;p=elogind.git diff --git a/src/cgroup.c b/src/cgroup.c index 5864858dd..0c6f20d4b 100644 --- a/src/cgroup.c +++ b/src/cgroup.c @@ -63,7 +63,7 @@ int cgroup_bonding_realize_list(CGroupBonding *first) { return 0; } -void cgroup_bonding_free(CGroupBonding *b) { +void cgroup_bonding_free(CGroupBonding *b, bool remove_or_trim) { assert(b); if (b->unit) { @@ -82,7 +82,7 @@ void cgroup_bonding_free(CGroupBonding *b) { } } - if (b->realized && b->ours) { + if (b->realized && b->ours && remove_or_trim) { if (cgroup_bonding_is_empty(b) > 0) cg_delete(b->controller, b->path); @@ -95,11 +95,11 @@ void cgroup_bonding_free(CGroupBonding *b) { free(b); } -void cgroup_bonding_free_list(CGroupBonding *first) { +void cgroup_bonding_free_list(CGroupBonding *first, bool remove_or_trim) { CGroupBonding *b, *n; LIST_FOREACH_SAFE(by_unit, b, n, first) - cgroup_bonding_free(b); + cgroup_bonding_free(b, remove_or_trim); } void cgroup_bonding_trim(CGroupBonding *b, bool delete_root) { @@ -225,6 +225,12 @@ int manager_setup_cgroup(Manager *m) { assert(m); + /* 0. Be nice to Ingo Molnar #628004 */ + if (path_is_mount_point("/sys/fs/cgroup/systemd") <= 0) { + log_warning("No control group support available, not creating root group."); + return 0; + } + /* 1. Determine hierarchy */ if ((r = cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, 0, ¤t)) < 0) { log_error("Cannot determine cgroup we are running in: %s", strerror(-r));