From 8885580986ab8adc951fe32b9323c8b16130fb4f Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Thu, 14 Sep 2017 10:44:52 -0500 Subject: [PATCH] rc-cgroup.sh: move cgroup_cleanup to the end of the file --- sh/rc-cgroup.sh.in | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in index 40501f22..1bf819e7 100644 --- a/sh/rc-cgroup.sh.in +++ b/sh/rc-cgroup.sh.in @@ -134,25 +134,6 @@ cgroup_set_limits() return 0 } -cgroup_cleanup() -{ - cgroup_running || return 0 - ebegin "starting cgroups cleanup" - for sig in TERM QUIT INT; do - cgroup_get_pids || { eend 0 "finished" ; return 0 ; } - for i in 0 1; do - kill -s $sig $pids - for j in 0 1 2; do - cgroup_get_pids || { eend 0 "finished" ; return 0 ; } - sleep 1 - done - done 2>/dev/null - done - cgroup_get_pids || { eend 0 "finished" ; return 0; } - kill -9 $pids - eend $(cgroup_running && echo 1 || echo 0) "fail to stop all processes" -} - cgroup2_find_path() { case "${rc_cgroup_mode:-hybrid}" in @@ -203,3 +184,22 @@ cgroup2_set_limits() IFS="$OIFS" return 0 } + +cgroup_cleanup() +{ + cgroup_running || return 0 + ebegin "starting cgroups cleanup" + for sig in TERM QUIT INT; do + cgroup_get_pids || { eend 0 "finished" ; return 0 ; } + for i in 0 1; do + kill -s $sig $pids + for j in 0 1 2; do + cgroup_get_pids || { eend 0 "finished" ; return 0 ; } + sleep 1 + done + done 2>/dev/null + done + cgroup_get_pids || { eend 0 "finished" ; return 0; } + kill -9 $pids + eend $(cgroup_running && echo 1 || echo 0) "fail to stop all processes" +}