From owner-svn-src-all@freebsd.org Wed Jan 24 14:15:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C361ED6453; Wed, 24 Jan 2018 14:15:07 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19CF78B099; Wed, 24 Jan 2018 14:15:07 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13A5A1EB42; Wed, 24 Jan 2018 14:15:07 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OEF6GF052977; Wed, 24 Jan 2018 14:15:06 GMT (envelope-from amdmi3@FreeBSD.org) Received: (from amdmi3@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OEF6vr052976; Wed, 24 Jan 2018 14:15:06 GMT (envelope-from amdmi3@FreeBSD.org) Message-Id: <201801241415.w0OEF6vr052976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: amdmi3 set sender to amdmi3@FreeBSD.org using -f From: Dmitry Marakasov Date: Wed, 24 Jan 2018 14:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328331 - head/etc X-SVN-Group: head X-SVN-Commit-Author: amdmi3 X-SVN-Commit-Paths: head/etc X-SVN-Commit-Revision: 328331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2018 14:15:07 -0000 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 #