View | Details | Raw Unified | Return to bug 142434
Collapse All | Expand All

(-)/etc/rc.subr (-3 / +23 lines)
Lines 58-63 Link Here
58
IDCMD="if [ -x $ID ]; then $ID -un; fi"
58
IDCMD="if [ -x $ID ]; then $ID -un; fi"
59
PS="/bin/ps -ww"
59
PS="/bin/ps -ww"
60
JID=`$PS -p $$ -o jid=`
60
JID=`$PS -p $$ -o jid=`
61
CPUSET="/usr/bin/cpuset"
61
62
62
case ${OSTYPE} in
63
case ${OSTYPE} in
63
FreeBSD)
64
FreeBSD)
Lines 464-469 Link Here
464
#	${name}_chdir	n	Directory to cd to before running ${command}
465
#	${name}_chdir	n	Directory to cd to before running ${command}
465
#				(if not using ${name}_chroot).
466
#				(if not using ${name}_chroot).
466
#
467
#
468
#	${name}_cpuset	n	A list of CPUs to run ${command} on.
469
#				Requires /usr to be mounted.
470
#
467
#	${name}_flags	n	Arguments to call ${command} with.
471
#	${name}_flags	n	Arguments to call ${command} with.
468
#				NOTE:	$flags from the parent environment
472
#				NOTE:	$flags from the parent environment
469
#					can be used to override this.
473
#					can be used to override this.
Lines 623-628 Link Here
623
	_pidcmd=
627
	_pidcmd=
624
	_procname=${procname:-${command}}
628
	_procname=${procname:-${command}}
625
629
630
	eval _cpuset=\$${name}_cpuset
631
	# fix for background-fsck problem / check if value start with number
632
	case "$_cpuset" in
633
	[0-9]*)	;;
634
	*)	_cpuset="" ;;
635
	esac
636
	_cpusetcmd=
637
	if [ -n "$_cpuset" -a -x $CPUSET ]; then
638
		_cpusetcmd="$CPUSET -l $_cpuset"
639
	fi
640
626
					# setup pid check command
641
					# setup pid check command
627
	if [ -n "$_procname" ]; then
642
	if [ -n "$_procname" ]; then
628
		if [ -n "$pidfile" ]; then
643
		if [ -n "$pidfile" ]; then
Lines 686-692 Link Here
686
701
687
		if [ -n "$_cmd" ]; then
702
		if [ -n "$_cmd" ]; then
688
			_run_rc_precmd || return 1
703
			_run_rc_precmd || return 1
689
			_run_rc_doit "$_cmd $rc_extra_args" || return 1
704
			_run_rc_doit "$_cpusetcmd $_cmd $rc_extra_args" || return 1
690
			_run_rc_postcmd
705
			_run_rc_postcmd
691
			return $_return
706
			return $_return
692
		fi
707
		fi
Lines 697-702 Link Here
697
			_run_rc_precmd || return 1
712
			_run_rc_precmd || return 1
698
			if [ -n "$rc_pid" ]; then
713
			if [ -n "$rc_pid" ]; then
699
				echo "${name} is running as pid $rc_pid."
714
				echo "${name} is running as pid $rc_pid."
715
				# for cpuset debug only, not committable (cut)
716
				if [ -n "$_cpuset" -a -x $CPUSET ]; then
717
					echo -n "on CPU(s)"
718
					$CPUSET -g -p "$rc_pid" | cut -s -d: -f 2
719
				fi
700
			else
720
			else
701
				echo "${name} is not running."
721
				echo "${name} is not running."
702
				return 1
722
				return 1
Lines 725-737 Link Here
725
			check_startmsgs && echo "Starting ${name}."
745
			check_startmsgs && echo "Starting ${name}."
726
			if [ -n "$_chroot" ]; then
746
			if [ -n "$_chroot" ]; then
727
				_doit="\
747
				_doit="\
728
${_nice:+nice -n $_nice }\
748
${_nice:+nice -n $_nice } $_cpusetcmd\
729
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
749
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
730
$_chroot $command $rc_flags $command_args"
750
$_chroot $command $rc_flags $command_args"
731
			else
751
			else
732
				_doit="\
752
				_doit="\
733
${_chdir:+cd $_chdir && }\
753
${_chdir:+cd $_chdir && }\
734
$command $rc_flags $command_args"
754
$_cpusetcmd $command $rc_flags $command_args"
735
				if [ -n "$_user" ]; then
755
				if [ -n "$_user" ]; then
736
				    _doit="su -m $_user -c 'sh -c \"$_doit\"'"
756
				    _doit="su -m $_user -c 'sh -c \"$_doit\"'"
737
				fi
757
				fi

Return to bug 142434