From owner-freebsd-bugs@FreeBSD.ORG Sun Jun 25 08:00:40 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 44F5A16A506 for ; Sun, 25 Jun 2006 08:00:40 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E99943D45 for ; Sun, 25 Jun 2006 08:00:36 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k5P80aPM036394 for ; Sun, 25 Jun 2006 08:00:36 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k5P80a0I036393; Sun, 25 Jun 2006 08:00:36 GMT (envelope-from gnats) Resent-Date: Sun, 25 Jun 2006 08:00:36 GMT Resent-Message-Id: <200606250800.k5P80a0I036393@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, "Jukka A. Ukkonen" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3D3C216A492 for ; Sun, 25 Jun 2006 07:51:43 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7107843D67 for ; Sun, 25 Jun 2006 07:51:42 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k5P7pgLX039043 for ; Sun, 25 Jun 2006 07:51:42 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k5P7pgfn039042; Sun, 25 Jun 2006 07:51:42 GMT (envelope-from nobody) Message-Id: <200606250751.k5P7pgfn039042@www.freebsd.org> Date: Sun, 25 Jun 2006 07:51:42 GMT From: "Jukka A. Ukkonen" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: conf/99444: Enhancement: rc.subr could easily support starting some daemons with realtime priorities 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: Sun, 25 Jun 2006 08:00:40 -0000 >Number: 99444 >Category: conf >Synopsis: Enhancement: rc.subr could easily support starting some daemons with realtime priorities >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jun 25 08:00:35 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Jukka A. Ukkonen >Release: 6.1-STABLE >Organization: private individual >Environment: FreeBSD mjolnir 6.1-STABLE FreeBSD 6.1-STABLE #5: Sun Jun 25 09:40:42 EET DST 2006 root@mjolnir:/usr/obj/usr/src/sys/Mjolnir i386 >Description: It is a weird inconsistency in FreeBSD that while there is a relatively good realtime scheduling policy support in the kernel one cannot start some of the daemons automatically with RT priorities. This would be beneficial with some daemons like natd to improve the behaviour of the system. Personally I have been for about half a year now running certain daemons with automatic RT priorities specified in rc.conf. With the attached patch installed one could do something like this in rc.conf... moused_rtprio="24" named_rtprio="22" ntpd_rtprio="21" rarpd_rtprio="26" natd_rtprio="20" These are just examples. One could obviously find a lot of other uses for this little amendment. >How-To-Repeat: No problem, just added functionality. Simply apply the patch and start adding RT priorities in rc.conf. If no RT priority has been specified for a service/daemon, everything will remain as before. No rtprio will be applied. The attached patch has been copied in the web form using xcut and xclipboard to retain all tab characters. It should be possible to apply the patch as is. >Fix: --- etc/rc.subr.orig Thu Jun 8 07:25:51 2006 +++ etc/rc.subr Thu Jun 8 07:26:18 2006 @@ -536,7 +536,8 @@ 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 \ + _rtprio=\$${name}_rtprio if [ -n "$_user" ]; then # unset $_user if running as that user if [ "$_user" = "$(eval $IDCMD)" ]; then @@ -662,12 +663,14 @@ if [ -n "$_chroot" ]; then _doit="\ ${_nice:+nice -n $_nice }\ +${_rtprio:+rtprio $_rtprio} \ chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ $_chroot $command $rc_flags $command_args" else _doit="\ ${_chdir:+cd $_chdir; }\ ${_nice:+nice -n $_nice }\ +${_rtprio:+rtprio $_rtprio} \ $command $rc_flags $command_args" if [ -n "$_user" ]; then _doit="su -m $_user -c 'sh -c \"$_doit\"'" >Release-Note: >Audit-Trail: >Unformatted: