conf/124248: adds support for nice value for rc.d/jail + rc.conf
Miroslav Lachman
000.fbsd at quip.cz
Tue Jun 3 20:20:02 UTC 2008
>Number: 124248
>Category: conf
>Synopsis: adds support for nice value for rc.d/jail + rc.conf
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Jun 03 20:20:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Miroslav Lachman
>Release: FreeBSD 7.0-RELEASE i386
>Organization:
codeLab.cz
>Environment:
FreeBSD fbsd7.quip.test 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24 19:59:52 UTC 2008 root at logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
Adds jail_nice="5" and jail_jname_nice="5" variables to rc.conf to alter priority of processes in jail.
Based on http://lists.freebsd.org/pipermail/freebsd-security/2008-February/004682.html
It doesn't change any default behaviour.
>How-To-Repeat:
>Fix:
Apply the patch.
Patch attached with submission follows:
--- etc/defaults/rc.conf 2008-06-03 16:45:22.000000000 +0200
+++ etc/defaults/rc.conf 2008-06-03 20:44:39.000000000 +0200
@@ -605,6 +605,7 @@
#jail_example_devfs_ruleset="ruleset_name" # devfs ruleset to apply to jail
#jail_example_fstab="" # fstab(5) for mount/umount
#jail_example_flags="-l -U root" # flags for jail(8)
+#jail_example_nice="5" # nice(1) for jail execution
##############################################################
### Define source_rc_confs, the mechanism used by /etc/rc.* ##
--- etc/rc.d/jail 2008-05-29 00:21:09.000000000 +0200
+++ etc/rc.d/jail 2008-06-03 21:03:55.000000000 +0200
@@ -83,6 +83,7 @@
[ -z "${_flags}" ] && _flags="-l -U root"
eval _consolelog=\"\${jail_${_j}_consolelog:-${jail_consolelog}}\"
[ -z "${_consolelog}" ] && _consolelog="/var/log/jail_${_j}_console.log"
+ eval _nice=\"\${jail_${_j}_nice:-${jail_nice}}\"
# Debugging aid
#
@@ -117,6 +118,7 @@
debug "$_j exec stop: $_exec_stop"
debug "$_j flags: $_flags"
debug "$_j consolelog: $_consolelog"
+ debug "$_j nice: $_nice"
if [ -z "${_hostname}" ]; then
err 3 "$name: No hostname has been defined for ${_j}"
@@ -350,7 +352,14 @@
fi
fi
_tmp_jail=${_tmp_dir}/jail.$$
- eval jail ${_flags} -i ${_rootdir} ${_hostname} \
+
+ if [ -z "${_nice}" ]; then
+ _nice_cmd=""
+ else
+ _nice_cmd="nice -n ${_nice}"
+ fi
+
+ eval ${_nice_cmd} jail ${_flags} -i ${_rootdir} ${_hostname} \
${_ip} ${_exec_start} > ${_tmp_jail} 2>&1
if [ "$?" -eq 0 ] ; then
--- usr/src/share/man/man5/rc.conf.5 2008-06-03 20:47:19.000000000 +0200
+++ usr/src/share/man/man5/rc.conf.5 2008-06-03 20:35:26.000000000 +0200
@@ -3312,6 +3312,13 @@
.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
for every jail in
.Va jail_list .
+.It Va jail_nice
+.Pq Vt int
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _nice
+for every jail in
+.Va jail_list .
.It Va jail_ Ns Ao Ar jname Ac Ns Va _rootdir
.Pq Vt str
Unset by default.
@@ -3412,6 +3419,11 @@
.Dq Li /bin/sh /etc/rc.shutdown
by default.
This is the command executed at jail shutdown.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _nice
+.Pq Vt int
+Unset by default.
+When set, sets the nice value to alter priority of processes in jail.
+The higher the nice value the lower its scheduling priority.
.It Va jail_set_hostname_allow
.Pq Vt bool
If set to
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list