Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2012 15:13:48 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238867 - head/bin/sh
Message-ID:  <201207281513.q6SFDm8A038977@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Jul 28 15:13:48 2012
New Revision: 238867
URL: http://svn.freebsd.org/changeset/base/238867

Log:
  sh: Do not ask for stopped/continued processes if we do not need them
  rather than retrying wait3 if they happen.

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==============================================================================
--- head/bin/sh/jobs.c	Sat Jul 28 14:56:50 2012	(r238866)
+++ head/bin/sh/jobs.c	Sat Jul 28 15:13:48 2012	(r238867)
@@ -1025,17 +1025,16 @@ dowait(int block, struct job *job)
 	TRACE(("dowait(%d) called\n", block));
 	do {
 #if JOBS
-		wflags = WUNTRACED | WCONTINUED;
-#else
-		wflags = 0;
+		if (iflag)
+			wflags = WUNTRACED | WCONTINUED;
+		else
 #endif
+			wflags = 0;
 		if (block == 0)
 			wflags |= WNOHANG;
 		pid = wait3(&status, wflags, (struct rusage *)NULL);
 		TRACE(("wait returns %d, status=%d\n", (int)pid, status));
-	} while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) ||
-		 (pid > 0 && (WIFSTOPPED(status) || WIFCONTINUED(status)) &&
-		  !iflag));
+	} while (pid == -1 && errno == EINTR && breakwaitcmd == 0);
 	if (pid == -1 && errno == ECHILD && job != NULL)
 		job->state = JOBDONE;
 	if (breakwaitcmd != 0) {



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