Use exception-based approach for cgroup/ulimit setup
Note from William Hubbs: I spoke with Roy about this, and he pointed out that user-defined functions may need the limits applied, so it is better to go with a method that uses exceptions to determine which functions apply the limits. X-Gentoo-Bug: 522408 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=522408
This commit is contained in:
parent
de60ffeebe
commit
50658449bd
@ -209,18 +209,28 @@ unset _conf_d
|
|||||||
# Load any system overrides
|
# Load any system overrides
|
||||||
sourcex -e "@SYSCONFDIR@/rc.conf"
|
sourcex -e "@SYSCONFDIR@/rc.conf"
|
||||||
|
|
||||||
# Apply any ulimit defined
|
for _cmd; do
|
||||||
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && ulimit ${rc_ulimit:-$RC_ULIMIT}
|
if [ "$_cmd" != status -a "$_cmd" != describe ]; then
|
||||||
|
# Apply any ulimit defined
|
||||||
# Apply cgroups settings if defined
|
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && \
|
||||||
if [ "$1" = "start" ] ; then
|
ulimit ${rc_ulimit:-$RC_ULIMIT}
|
||||||
if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then
|
# Apply cgroups settings if defined
|
||||||
cgroup_add_service /sys/fs/cgroup/openrc
|
if [ "$(command -v cgroup_add_service)" = \
|
||||||
cgroup_add_service /sys/fs/cgroup/systemd/system
|
"cgroup_add_service" ]
|
||||||
|
then
|
||||||
|
if [ -d /sys/fs/cgroup -a ! -w /sys/fs/cgroup ]; then
|
||||||
|
eerror "No permission to apply cgroup settings"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
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
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
|
done
|
||||||
cgroup_set_limits
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load our script
|
# Load our script
|
||||||
sourcex "$RC_SERVICE"
|
sourcex "$RC_SERVICE"
|
||||||
|
Loading…
Reference in New Issue
Block a user