summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorkevans <kevans@FreeBSD.org>2018-04-02 15:28:48 +0000
committerkevans <kevans@FreeBSD.org>2018-04-02 15:28:48 +0000
commit0f8014018211d7891dfa72334526a4c5d7201490 (patch)
treee8c27a5dae5c016acf1a4f9aa22427e1db843821 /etc
parent032be492d537d4d04d0a448089d260e4a0839fec (diff)
downloadFreeBSD-src-0f8014018211d7891dfa72334526a4c5d7201490.zip
FreeBSD-src-0f8014018211d7891dfa72334526a4c5d7201490.tar.gz
MFC r328331: Support configuring arbitrary limits(1) for any rc.conf daemon
Usage is ${name}_limits, and the argument is any flags accepted by limits(1), such as `-n 100' (e.g. only allow 100 open files).
Diffstat (limited to 'etc')
-rw-r--r--etc/rc.subr6
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index bfa43e2..358c53f 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -773,6 +773,8 @@ check_startmsgs()
#
# ${name}_login_class n Login class to use, else "daemon".
#
+# ${name}_limits n limits(1) to apply to ${command}.
+#
# ${rc_arg}_cmd n If set, use this as the method when invoked;
# Otherwise, use default command (see below)
#
@@ -952,7 +954,7 @@ run_rc_command()
_group=\$${name}_group _groups=\$${name}_groups \
_fib=\$${name}_fib _env=\$${name}_env \
_prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \
- _oomprotect=\$${name}_oomprotect
+ _limits=\$${name}_limits _oomprotect=\$${name}_oomprotect
if [ -n "$_user" ]; then # unset $_user if running as that user
if [ "$_user" = "$(eval $IDCMD)" ]; then
@@ -1073,7 +1075,7 @@ $command $rc_flags $command_args"
fi
# Prepend default limits
- _doit="$_cd limits -C $_login_class $_doit"
+ _doit="$_cd limits -C $_login_class $_limits $_doit"
# run the full command
#
OpenPOWER on IntegriCloud