diff options
-rw-r--r-- | sh/rc-cgroup.sh.in | 5 | ||||
-rw-r--r-- | sh/runscript.sh.in | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in index 21f5f50d..b3bab0f9 100644 --- a/sh/rc-cgroup.sh.in +++ b/sh/rc-cgroup.sh.in @@ -70,7 +70,7 @@ cgroup_set_values() return 0 } -cgroup_set_limits() +cgroup_add_service() { # relocate starting process to the top of the cgroup # it prevents from unwanted inheriting of the user @@ -86,7 +86,10 @@ cgroup_set_limits() mkdir -p "$cgroup" [ -f "$cgroup/tasks" ] && echo 0 > "$cgroup/tasks" fi +} +cgroup_set_limits() +{ local blkio="${rc_cgroup_blkio:-$RC_CGROUP_BLKIO}" [ -n "$blkio" ] && cgroup_set_values blkio "$blkio" diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index 58e8eacf..a1ed9c68 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -209,6 +209,10 @@ sourcex -e "@SYSCONFDIR@/rc.conf" [ -n "${rc_ulimit:-$RC_ULIMIT}" ] && ulimit ${rc_ulimit:-$RC_ULIMIT} # Apply cgroups settings if defined +if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then + cgroup_add_service /sys/fs/cgroup/openrc + cgroup_add_service /sys/fs/cgroup/systemd/system +fi [ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \ cgroup_set_limits |