1 |
commit: 1a44be0f16a7a1de8a176e7c656f8513494e0e64 |
2 |
Author: Alexander V Vershilov <qnikst <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 16 00:27:52 2014 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jul 10 15:56:37 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=1a44be0f |
7 |
|
8 |
cgroups: only run cgroup setup when starting a service |
9 |
|
10 |
Status call should not set limits as it requires root permissions, |
11 |
also this is not safe, as current process may reach limitation. |
12 |
|
13 |
Solution is to set limits and move process to service cgroup only |
14 |
on start. |
15 |
|
16 |
X-GENTOO-BUG: 500364 |
17 |
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500364 |
18 |
|
19 |
--- |
20 |
sh/runscript.sh.in | 2 ++ |
21 |
1 file changed, 2 insertions(+) |
22 |
|
23 |
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in |
24 |
index ceb9ab4..c72a784 100644 |
25 |
--- a/sh/runscript.sh.in |
26 |
+++ b/sh/runscript.sh.in |
27 |
@@ -215,12 +215,14 @@ if yesno "${rc_verbose:-$RC_VERBOSE}"; then |
28 |
fi |
29 |
|
30 |
# Apply cgroups settings if defined |
31 |
+if [ "$1" = "start" ] ; then |
32 |
if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then |
33 |
cgroup_add_service /sys/fs/cgroup/openrc |
34 |
cgroup_add_service /sys/fs/cgroup/systemd/system |
35 |
fi |
36 |
[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \ |
37 |
cgroup_set_limits |
38 |
+fi |
39 |
|
40 |
# Load our script |
41 |
sourcex "$RC_SERVICE" |