From nobody@FreeBSD.org  Sun Jun 25 07:51:43 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3D3C216A492
	for <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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" <jau@iki.fi>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Enhancement: rc.subr could easily support starting some daemons with realtime priorities
X-Send-Pr-Version: www-2.3

>Number:         99444
>Category:       conf
>Synopsis:       [patch] Enhancement: rc.subr could easily support starting some daemons with realtime priorities
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-rc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 25 08:00:35 GMT 2006
>Closed-Date:    Wed Oct 31 09:52:30 UTC 2012
>Last-Modified:  Wed Oct 31 09:52:30 UTC 2012
>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:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Jun 25 08:36:35 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=99444 
State-Changed-From-To: open->closed 
State-Changed-By: crees 
State-Changed-When: Wed Oct 31 09:52:29 UTC 2012 
State-Changed-Why:  
Superseded by conf/123222, discussion should continue there.  Thanks for 
your submission, sorry it's been waiting a long time. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=99444 
>Unformatted:
