Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Dec 2009 22:48:46 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        freebsd-rc@freebsd.org
Subject:   Re: [PATCH] use pwait in wait_for_pids
Message-ID:  <20091220214846.GA66977@stack.nl>
In-Reply-To: <20091220143623.GC46060@stack.nl>
References:  <20091220143623.GC46060@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 20, 2009 at 03:36:23PM +0100, Jilles Tjoelker wrote:
> Here is a patch to use the new pwait utility in wait_for_pids.

> This patch still works if pwait is not available, using the old sleep
> method.

> The redirection on the pwait command serves to squelch "No such process"
> and "pwait: not found" errors. The braces are necessary to redirect the
> "not found" error even for sh(1) that doesn't have the fix in r197820
> (which has not been MFC'ed).

It seems the mailing list ate the patch (strange, text/x-diff
attachments used to work), so I will put it inline here:

Index: etc/rc.subr
===================================================================
--- etc/rc.subr	(revision 200442)
+++ etc/rc.subr	(working copy)
@@ -390,7 +390,11 @@
 		_list=$_nlist
 		echo -n ${_prefix:-"Waiting for PIDS: "}$_list
 		_prefix=", "
-		sleep 2
+		if { pwait $_list; } 2>/dev/null; then
+			break
+		else
+			sleep 2
+		fi
 	done
 	if [ -n "$_prefix" ]; then
 		echo "."

-- 
Jilles Tjoelker



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