Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Jun 2006 07:51:42 GMT
From:      "Jukka A. Ukkonen" <jau@iki.fi>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/99444: Enhancement: rc.subr could easily support starting some daemons with realtime priorities
Message-ID:  <200606250751.k5P7pgfn039042@www.freebsd.org>
Resent-Message-ID: <200606250800.k5P80a0I036393@freefall.freebsd.org>

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

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606250751.k5P7pgfn039042>