Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Dec 2025 14:17:39 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: cd0e5f95d070 - stable/15 - rc.subr: Try to make svjc option handling a bit easier to read
Message-ID:  <6936de03.2feac.6fecb084@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help

The branch stable/15 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=cd0e5f95d070d832675b8b9af696ed366d8fdb2c

commit cd0e5f95d070d832675b8b9af696ed366d8fdb2c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-11-17 16:39:43 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-12-08 14:14:57 +0000

    rc.subr: Try to make svjc option handling a bit easier to read
    
    Specifically, make this code fit in fewer columns:
    - deindent cases to conform to the usual style,
    - use a local variable to minimize duplication in each case.
    
    No functional change intended.
    
    Reviewed by:    0mp, netchild
    MFC after:      2 weeks
    Sponsored by:   Klara, Inc.
    Sponsored by:   Modirum MDPay
    Differential Revision:  https://reviews.freebsd.org/D53754
    
    (cherry picked from commit 7861d051de2ea2f244bcf73111a04389dc5bcf51)
---
 libexec/rc/rc.subr | 88 +++++++++++++++++++++++++++++-------------------------
 1 file changed, 47 insertions(+), 41 deletions(-)

diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index 8317ff5c0922..ec4970c8db94 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -1246,49 +1246,55 @@ run_rc_command()
 	if [ -n "$_svcj_options" ]; then	# translate service jail options
 		_svcj_sysvipc_x=0
 		for _svcj_option in $_svcj_options; do
+			_opts=
 			case "$_svcj_option" in
-				mlock)
-					_svcj_cmd_options="allow.mlock ${_svcj_cmd_options}"
-					;;
-				netv4)
-					_svcj_cmd_options="${_svcj_ip4} allow.reserved_ports ${_svcj_cmd_options}"
-					;;
-				netv6)
-					_svcj_cmd_options="${_svcj_ip6} allow.reserved_ports ${_svcj_cmd_options}"
-					;;
-				net_basic)
-					_svcj_cmd_options="${_svcj_ip4} ${_svcj_ip6} allow.reserved_ports ${_svcj_cmd_options}"
-					;;
-				net_raw)
-					_svcj_cmd_options="allow.raw_sockets ${_svcj_cmd_options}"
-					;;
-				net_all)
-					_svcj_cmd_options="allow.socket_af allow.raw_sockets allow.reserved_ports ${_svcj_ip4} ${_svcj_ip6} ${_svcj_cmd_options}"
-					;;
-				nfsd)
-					_svcj_cmd_options="allow.nfsd enforce_statfs=1 ${_svcj_cmd_options}"
-					;;
-				routing)
-					_svcj_cmd_options="allow.routing ${_svcj_cmd_options}"
-					;;
-				settime)
-					_svcj_cmd_options="allow.settime ${_svcj_cmd_options}"
-					;;
-				sysvipc)
-					_svcj_sysvipc_x=$((${_svcj_sysvipc_x} + 1))
-					_svcj_cmd_options="sysvmsg=inherit sysvsem=inherit sysvshm=inherit  ${_svcj_cmd_options}"
-					;;
-				sysvipcnew)
-					_svcj_sysvipc_x=$((${_svcj_sysvipc_x} + 1))
-					_svcj_cmd_options="sysvmsg=new sysvsem=new sysvshm=new ${_svcj_cmd_options}"
-					;;
-				vmm)
-					_svcj_cmd_options="allow.vmm ${_svcj_cmd_options}"
-					;;
-				*)
-					echo ${name}: unknown service jail option: $_svcj_option
-					;;
+			mlock)
+				_opts="allow.mlock"
+				;;
+			netv4)
+				_opts="${_svcj_ip4} allow.reserved_ports"
+				;;
+			netv6)
+				_opts="${_svcj_ip6} allow.reserved_ports"
+				;;
+			net_basic)
+				_opts="${_svcj_ip4} ${_svcj_ip6}"
+				_opts="${_opts} allow.reserved_ports"
+				;;
+			net_raw)
+				_opts="allow.raw_sockets"
+				;;
+			net_all)
+				_opts="allow.socket_af"
+				_opts="${_opts} allow.raw_sockets"
+				_opts="${_opts} allow.reserved_ports"
+				_opts="${_opts} ${_svcj_ip4} ${_svcj_ip6}"
+				;;
+			nfsd)
+				_opts="allow.nfsd enforce_statfs=1"
+				;;
+			routing)
+				_opts="allow.routing"
+				;;
+			settime)
+				_opts="allow.settime"
+				;;
+			sysvipc)
+				_svcj_sysvipc_x=$((${_svcj_sysvipc_x} + 1))
+				_opts="sysvmsg=inherit sysvsem=inherit sysvshm=inherit"
+				;;
+			sysvipcnew)
+				_svcj_sysvipc_x=$((${_svcj_sysvipc_x} + 1))
+				_opts="sysvmsg=new sysvsem=new sysvshm=new"
+				;;
+			vmm)
+				_opts="allow.vmm"
+				;;
+			*)
+				echo ${name}: unknown service jail option: $_svcj_option
+				;;
 			esac
+			_svcj_cmd_options="${_opts} ${_svcj_cmd_options}"
 		done
 		if [ ${_svcj_sysvipc_x} -gt 1 ]; then
 			echo -n "ERROR: more than one sysvipc option is "



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6936de03.2feac.6fecb084>