aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-09-16 16:46:42 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-09-16 16:49:22 -0500
commitcd5722aca50f0eaddde7ce04ee00da53c313ba7d (patch)
treed32308c9eff85ab7b82274ef2bee2f99e869efee
parentdcb4a4d2613a1fdf85651b32e5b7a87528f487bc (diff)
cgroup2_find_path: use legacy mode if cgroup2 is not in the kernel
This is related to #164.
-rw-r--r--sh/rc-cgroup.sh.in10
1 files changed, 6 insertions, 4 deletions
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 930eeefc..9e93d841 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -146,10 +146,12 @@ cgroup_set_limits()
cgroup2_find_path()
{
- case "${rc_cgroup_mode:-hybrid}" in
- hybrid) printf "/sys/fs/cgroup/unified" ;;
- unified) printf "/sys/fs/cgroup" ;;
+ if grep -qw cgroup2 /proc/filesystems; then
+ case "${rc_cgroup_mode:-hybrid}" in
+ hybrid) printf "/sys/fs/cgroup/unified" ;;
+ unified) printf "/sys/fs/cgroup" ;;
esac
+ fi
return 0
}
@@ -180,7 +182,7 @@ cgroup2_set_limits()
{
local cgroup_path
cgroup_path="$(cgroup2_find_path)"
- [ -z "${cgroup_path}" ] && return 0
+ [ -d "${cgroup_path}" ] || return 0
rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
local OIFS="$IFS"
IFS="