Bug 123222 - [patch] Add rtprio(1)/idprio(1) support to rc.subr(8).
Summary: [patch] Add rtprio(1)/idprio(1) support to rc.subr(8).
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 8.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-29 18:00 UTC by Norikatsu Shigemura
Modified: 2017-12-31 22:36 UTC (History)
0 users

See Also:


Attachments
rc.subr-8current.diff (2.50 KB, patch)
2008-04-29 18:00 UTC, Norikatsu Shigemura
no flags Details | Diff
rc.subr-6stable.diff (1.81 KB, patch)
2008-04-29 18:00 UTC, Norikatsu Shigemura
no flags Details | Diff
file.diff (1.56 KB, patch)
2008-04-29 18:00 UTC, Norikatsu Shigemura
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Norikatsu Shigemura freebsd_committer 2008-04-29 18:00:06 UTC
	I want to run some daemons with rtprio(1)/idprio(1) like nice(1).
	So I made patches to support rtprio(1)/idprio(1) to rc.subr(8).

	Ex.
	# /etc/rc.conf
	canna_enable="YES"
	canna_rtprio="31"

	As a result, I got more interactive performance than before.

Fix: I made 4 patches for FreeBSD 4 major versions.

	rc.subr-8current.diff
		src/etc/rc.subr
		src/share/man/man8/rc.subr.8
	rc.subr-7stable.diff
		src/etc/rc.subr
	rc.subr-6stable.diff
		src/etc/rc.subr
	rc.subr-5stable.diff
		src/etc/rc.subr

Index: rc.subr
===================================================================
RCS file: /home/ncvs/src/etc/rc.subr,v
retrieving revision 1.77
diff -u -r1.77 rc.subr
--- rc.subr	9 Oct 2007 07:20:44 -0000	1.77
+++ rc.subr	29 Apr 2008 16:11:13 -0000
@@ -423,6 +423,10 @@
 #
 #	${name}_nice	n	Nice level to run ${command} at.
 #
+#	${name}_rtprio	n	Realtime scheduling priority to run ${command} at.
+#
+#	${name}_idprio	n	Idletime scheduling priority to run ${command} at.
+#
 #	${name}_user	n	User to run ${command} as, using su(1) if not
 #				using ${name}_chroot.
 #				Requires /usr to be mounted.
@@ -591,7 +595,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	_idprio=\$${name}_idprio
 
 	if [ -n "$_user" ]; then	# unset $_user if running as that user
 		if [ "$_user" = "$(eval $IDCMD)" ]; then
@@ -662,6 +667,8 @@
 			if [ -n "$_chroot" ]; then
 				_doit="\
 ${_nice:+nice -n $_nice }\
+${_rtprio:+rtprio $_rtprio }\
+${_idprio:+idprio $_idprio }\
 chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
 $_chroot $command $rc_flags $command_args"
 			else
@@ -671,12 +678,20 @@
 				if [ -n "$_user" ]; then
 				    _doit="su -m $_user -c 'sh -c \"$_doit\"'"
 				fi
-				if [ -n "$_nice" ]; then
+				if [ -n "$_nice$_rtprio$_idprio" ]; then
 					if [ -z "$_user" ]; then
 						_doit="sh -c \"$_doit\""
-					fi	
+					fi
+				fi
+				if [ -n "$_nice" ]; then
 					_doit="nice -n $_nice $_doit"
 				fi
+				if [ -n "$_rtprio" ]; then
+					_doit="rtprio $_rtprio $_doit"
+				fi
+				if [ -n "$_idprio" ]; then
+					_doit="idprio $_idprio $_doit"
+				fi
 			fi
 
 					# run the full command
--- rc.subr-7stable.diff ends here ---
How-To-Repeat: 	N/A
Comment 1 Norikatsu Shigemura freebsd_committer 2008-04-29 18:07:25 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to rc.subr(8) maintainers.
Comment 2 Kris Kennaway freebsd_committer 2008-04-30 09:14:59 UTC
Norikatsu Shigemura wrote:

>> Description:
> 	I want to run some daemons with rtprio(1)/idprio(1) like nice(1).
> 	So I made patches to support rtprio(1)/idprio(1) to rc.subr(8).

idprio is dangerous and should not be used unless you are sure you know 
what you're doing (it can cause deadlocks from priority inversion). 
There might be similar issues with rtprio.

Kris
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:15 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped