aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2011-11-18 08:32:06 -0600
committerWilliam Hubbs <williamh@gentoo.org>2011-11-18 08:32:06 -0600
commita5ba2f3264397ac1ca1545ae67fbfdafa1b30b67 (patch)
tree2ebc672ed5db3dc881d4dc28cfb5ba35e7d97419
parent62f4438376098f20ed293fec1fec6fabc014b7ef (diff)
CGroups: fix group initialization
Make sure cpuset.cpus and cpuset.mems exist in the parent group before attempting to copy them to the new group.
-rw-r--r--sh/runscript.sh.in7
1 files changed, 5 insertions, 2 deletions
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 722364ab..c7d712be 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -194,8 +194,11 @@ if [ -d /sys/fs/cgroup/ ]; then
# use RC_SVCNAME unless overridden in conf.d
SVC_CGROUP=${rc_cgroup:-$RC_SVCNAME}
mkdir -p /sys/fs/cgroup/${SVC_CGROUP}
- cp /sys/fs/cgroup/cpuset.cpus /sys/fs/cgroup/${SVC_CGROUP}
- cp /sys/fs/cgroup/cpuset.mems /sys/fs/cgroup/${SVC_CGROUP}
+ for f in cpuset.cpus cpuset.mems; do
+ if [ -f /sys/fs/cgroup/${f} ]; then
+ cp /sys/fs/cgroup/${f} /sys/fs/cgroup/${SVC_CGROUP}
+ fi
+ done
# now attach self to cgroup - any children of this process will inherit this
echo $$ > /sys/fs/cgroup/${SVC_CGROUP}/tasks
# TODO: set res limits from conf.d