From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 9 19:50:07 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C20010658A9 for ; Mon, 9 Mar 2009 19:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 060D38FC17 for ; Mon, 9 Mar 2009 19:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n29Jo63Q044169 for ; Mon, 9 Mar 2009 19:50:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n29Jo6QY044168; Mon, 9 Mar 2009 19:50:06 GMT (envelope-from gnats) Resent-Date: Mon, 9 Mar 2009 19:50:06 GMT Resent-Message-Id: <200903091950.n29Jo6QY044168@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Sergey Matveychuk Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BB3D1065694 for ; Mon, 9 Mar 2009 19:44:32 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id E38368FC33 for ; Mon, 9 Mar 2009 19:44:31 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n29JiVMX068576 for ; Mon, 9 Mar 2009 19:44:31 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n29JiV5W068575; Mon, 9 Mar 2009 19:44:31 GMT (envelope-from nobody) Message-Id: <200903091944.n29JiV5W068575@www.freebsd.org> Date: Mon, 9 Mar 2009 19:44:31 GMT From: Sergey Matveychuk To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: conf/132483: [rc.subr] [patch] setfib(1) support for rc.subr X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2009 19:50:09 -0000 >Number: 132483 >Category: conf >Synopsis: [rc.subr] [patch] setfib(1) support for rc.subr >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 09 19:50:06 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Sergey Matveychuk >Release: CURRENT >Organization: >Environment: >Description: Add support setfib(1) for rc.subr. If ${name}_fib specified and the number less then configured FIBs number, command will runned with setfib(1). >How-To-Repeat: >Fix: Patch attached with submission follows: --- etc/rc.subr.orig 2009-03-09 21:34:36.000000000 +0300 +++ etc/rc.subr 2009-03-09 22:15:33.000000000 +0300 @@ -58,6 +58,7 @@ IDCMD="if [ -x $ID ]; then $ID -un; fi" PS="/bin/ps -ww" JID=`$PS -p $$ -o jid=` +SETFIB="/usr/sbin/setfib" case ${OSTYPE} in FreeBSD) @@ -422,6 +423,8 @@ # ${name}_chdir n Directory to cd to before running ${command} # (if not using ${name}_chroot). # +# ${name}_fib n A FIB number for setfib(1). +# # ${name}_flags n Arguments to call ${command} with. # NOTE: $flags from the parent environment # can be used to override this. @@ -581,6 +584,12 @@ _pidcmd= _procname=${procname:-${command}} + eval _fib=\$${name}_fib + _setfibcmd= + if [ -n "$_fib" -a -x $SETFIB -a $_fib -lt `$SYSCTL_N net.fibs` ]; then + _setfibcmd="/usr/sbin/setfib -F $_fib" + fi + # setup pid check command if [ -n "$_procname" ]; then if [ -n "$pidfile" ]; then @@ -644,7 +653,7 @@ if [ -n "$_cmd" ]; then _run_rc_precmd || return 1 - _run_rc_doit "$_cmd $rc_extra_args" || return 1 + _run_rc_doit "$_setfibcmd $_cmd $rc_extra_args" || return 1 _run_rc_postcmd return $_return fi @@ -683,13 +692,13 @@ [ -z "${rc_quiet}" ] && echo "Starting ${name}." if [ -n "$_chroot" ]; then _doit="\ -${_nice:+nice -n $_nice }\ +${_nice:+nice -n $_nice } $_setfibcmd\ chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ $_chroot $command $rc_flags $command_args" else _doit="\ ${_chdir:+cd $_chdir && }\ -$command $rc_flags $command_args" +$_setfibcmd $command $rc_flags $command_args" if [ -n "$_user" ]; then _doit="su -m $_user -c 'sh -c \"$_doit\"'" fi --- share/man/man8/rc.subr.8.orig 2009-03-09 22:31:26.000000000 +0300 +++ share/man/man8/rc.subr.8 2009-03-09 22:31:31.000000000 +0300 @@ -587,6 +587,12 @@ Only supported after .Pa /usr is mounted. +.It Va ${name}_fib +If the number is less than configured FIBs number, +.Va command +will be runned with setfib(1). Only supported after +.Pa /usr +is mounted. .It Va ${name}_flags Arguments to call .Va command >Release-Note: >Audit-Trail: >Unformatted: