Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jan 2018 14:15:06 +0000 (UTC)
From:      Dmitry Marakasov <amdmi3@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328331 - head/etc
Message-ID:  <201801241415.w0OEF6vr052976@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: amdmi3 (ports committer)
Date: Wed Jan 24 14:15:06 2018
New Revision: 328331
URL: https://svnweb.freebsd.org/changeset/base/328331

Log:
  Support configuring arbitrary limits(1) for any daemon in rc.conf
  
  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).
  
  Approved by:	cy
  Differential Revision:	https://reviews.freebsd.org/D14015

Modified:
  head/etc/rc.subr

Modified: head/etc/rc.subr
==============================================================================
--- head/etc/rc.subr	Wed Jan 24 13:57:01 2018	(r328330)
+++ head/etc/rc.subr	Wed Jan 24 14:15:06 2018	(r328331)
@@ -775,6 +775,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
 					#



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801241415.w0OEF6vr052976>