Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/
Date: Fri, 23 Feb 2018 21:39:01
Message-Id: 1519420024.38032626a6c2f8e869197999f32ac3634667cc86.williamh@OpenRC
1 commit: 38032626a6c2f8e869197999f32ac3634667cc86
2 Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
3 AuthorDate: Fri Feb 23 21:07:04 2018 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 23 21:07:04 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=38032626
7
8 improve cgroup configuration checks
9
10 make the base/controller functions return successfully if cgroups v1/v2
11 are not configured in the kernel
12
13 init.d/cgroups.in | 13 ++++++-------
14 1 file changed, 6 insertions(+), 7 deletions(-)
15
16 diff --git a/init.d/cgroups.in b/init.d/cgroups.in
17 index fe21904c..8ec91ef6 100644
18 --- a/init.d/cgroups.in
19 +++ b/init.d/cgroups.in
20 @@ -42,7 +42,8 @@ cgroup1_base()
21
22 cgroup1_controllers()
23 {
24 - yesno "${rc_controller_cgroups:-YES}" && [ -e /proc/cgroups ] || return 0
25 + yesno "${rc_controller_cgroups:-YES}" && [ -e /proc/cgroups ] &&
26 + grep -qw cgroup /proc/filesystems || return 0
27 while read -r name _ _ enabled _; do
28 case "${enabled}" in
29 1) mountinfo -q "/sys/fs/cgroup/${name}" && continue
30 @@ -64,6 +65,7 @@ cgroup1_controllers()
31
32 cgroup2_base()
33 {
34 + grep -qw cgroup2 /proc/filesystems || return 0
35 local base
36 base="$(cgroup2_find_path)"
37 mkdir -p "${base}"
38 @@ -74,6 +76,7 @@ cgroup2_base()
39
40 cgroup2_controllers()
41 {
42 + grep -qw cgroup2 /proc/filesystems || return 0
43 local active cgroup_path x y
44 cgroup_path="$(cgroup2_find_path)"
45 [ -z "${cgroup_path}" ] && return 0
46 @@ -91,19 +94,15 @@ cgroup2_controllers()
47
48 cgroups_hybrid()
49 {
50 - grep -qw cgroup /proc/filesystems || return 0
51 cgroup1_base
52 - if grep -qw cgroup2 /proc/filesystems; then
53 - cgroup2_base
54 - cgroup2_controllers
55 - fi
56 + cgroup2_base
57 + cgroup2_controllers
58 cgroup1_controllers
59 return 0
60 }
61
62 cgroups_legacy()
63 {
64 - grep -qw cgroup /proc/filesystems || return 0
65 cgroup1_base
66 cgroup1_controllers
67 return 0