Date: Wed, 18 Mar 2009 06:00:38 GMT From: KOIE Hidetaka <hide@koie.org> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/132766: wait_for_pids() in /etc/rc.subr is dull. Message-ID: <200903180600.n2I60ct2008504@www.freebsd.org> Resent-Message-ID: <200903180610.n2I6A4Kw019908@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 132766 >Category: misc >Synopsis: wait_for_pids() in /etc/rc.subr is dull. >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: Wed Mar 18 06:10:04 UTC 2009 >Closed-Date: >Last-Modified: >Originator: KOIE Hidetaka >Release: CURRENT >Organization: surigiken >Environment: FreeBSD guriandgura 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Thu Feb 5 04:32:41 JST 2009 koie@guriandgura:/usr/obj/usr/src/sys/GURIANDGURA amd64 >Description: wait_for_pids() in /etc/rc.subr uses sleep 2 to wait. but, daemons usually exit before within 2 seconds in my environment. I propose short sleep. >How-To-Repeat: >Fix: Patch attached with submission follows: --- /usr/src/etc/rc.subr 2008-11-01 09:21:29.578401768 +0900 +++ /etc/rc.subr 2009-03-10 18:26:12.000000000 +0900 @@ -351,7 +351,9 @@ wait_for_pids() return fi _prefix= + _slp_list=0.5 while true; do + for _slp in $_slp_list; do _nlist=""; for _j in $_list; do if kill -0 $_j 2>/dev/null; then @@ -362,9 +364,14 @@ wait_for_pids() break fi _list=$_nlist + sleep $_slp + done + if [ -z "$_nlist" ]; then + break + fi echo -n ${_prefix:-"Waiting for PIDS: "}$_list _prefix=", " - sleep 2 + _slp_list="0.2 0.4 0.6 0.8" done if [ -n "$_prefix" ]; then echo "." >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903180600.n2I60ct2008504>