summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2012-10-27 19:09:09 +0000
committerhrs <hrs@FreeBSD.org>2012-10-27 19:09:09 +0000
commit5f663635880bff19e44417a230ced333f96f5366 (patch)
tree4e757c66f62f3b413f92dba2af2c1c7a320d521f /etc
parentae492a84bacb8e55a930317f47f37dc45dfea5ff (diff)
downloadFreeBSD-src-5f663635880bff19e44417a230ced333f96f5366.zip
FreeBSD-src-5f663635880bff19e44417a230ced333f96f5366.tar.gz
Add setfib(1) support for services as <name>_fib in rc.conf.
Diffstat (limited to 'etc')
-rw-r--r--etc/rc.subr7
1 files changed, 6 insertions, 1 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index 5f41d18..5c94097 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -462,6 +462,8 @@ check_startmsgs()
# NOTE: $flags from the parent environment
# can be used to override this.
#
+# ${name}_fib n Routing table number to run ${command} with.
+#
# ${name}_nice n Nice level to run ${command} at.
#
# ${name}_user n User to run ${command} as, using su(1) if not
@@ -640,7 +642,8 @@ run_rc_command()
fi
eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \
_nice=\$${name}_nice _user=\$${name}_user \
- _group=\$${name}_group _groups=\$${name}_groups
+ _group=\$${name}_group _groups=\$${name}_groups \
+ _fib=\$${name}_fib
if [ -n "$_user" ]; then # unset $_user if running as that user
if [ "$_user" = "$(eval $IDCMD)" ]; then
@@ -721,11 +724,13 @@ run_rc_command()
if [ -n "$_chroot" ]; then
_doit="\
${_nice:+nice -n $_nice }\
+${_fib:+setfib -F $_fib }\
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
$_chroot $command $rc_flags $command_args"
else
_doit="\
${_chdir:+cd $_chdir && }\
+${_fib:+setfib -F $_fib }\
$command $rc_flags $command_args"
if [ -n "$_user" ]; then
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
OpenPOWER on IntegriCloud