Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions sh/openrc-run.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -289,27 +289,26 @@ if yesno "${rc_verbose:-$RC_VERBOSE}"; then
export EINFO_VERBOSE
fi

case $1 in
status|describe) ;;
*)
# Apply any ulimit(s) defined
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && apply_ulimits ${rc_ulimit:-$RC_ULIMIT}
_setup_cgroup() {
grep -qs /sys/fs/cgroup /proc/1/mountinfo || return
[ -w /sys/fs/cgroup ] || {
yesno "$RC_USER_SERVICES" || eerror "No permission to apply cgroup settings"
return
}

# Apply cgroups settings if defined
if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then
if grep -qs /sys/fs/cgroup /proc/1/mountinfo
then
if [ -d /sys/fs/cgroup -a ! -w /sys/fs/cgroup ]; then
eerror "No permission to apply cgroup settings"
break
fi
fi
cgroup_add_service
fi

[ "$(command -v cgroup_add_service)" = "cgroup_add_service" ] && cgroup_add_service
[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && cgroup_set_limits
[ "$(command -v cgroup2_set_limits)" = "cgroup2_set_limits" ] && cgroup2_set_limits
;;
}

case $1 in
status|describe) ;;
*)
# Apply any ulimit(s) defined
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && apply_ulimits ${rc_ulimit:-$RC_ULIMIT}
_setup_cgroup
;;
esac

eval "printf '%s\n' $required_dirs" | while read _d; do
Expand Down
Loading