Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2012 14:32:55 +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: r238865 - head/bin/sh
Message-ID:  <201207281432.q6SEWtnq035734@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Jul 28 14:32:55 2012
New Revision: 238865
URL: http://svn.freebsd.org/changeset/base/238865

Log:
  sh: Track continued jobs (even if not continued by bg or fg).
  
  This uses wait3's WCONTINUED flag.
  
  There is no message for this. The change is visible in "jobs" or if the job
  stops again.

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==============================================================================
--- head/bin/sh/jobs.c	Sat Jul 28 13:12:57 2012	(r238864)
+++ head/bin/sh/jobs.c	Sat Jul 28 14:32:55 2012	(r238865)
@@ -1027,7 +1027,8 @@ dowait(int block, struct job *job)
 		pid = waitproc(block, &status);
 		TRACE(("wait returns %d, status=%d\n", (int)pid, status));
 	} while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) ||
-		 (pid > 0 && WIFSTOPPED(status) && !iflag));
+		 (pid > 0 && (WIFSTOPPED(status) || WIFCONTINUED(status)) &&
+		  !iflag));
 	if (pid == -1 && errno == ECHILD && job != NULL)
 		job->state = JOBDONE;
 	if (breakwaitcmd != 0) {
@@ -1050,7 +1051,11 @@ dowait(int block, struct job *job)
 					TRACE(("Changing status of proc %d from 0x%x to 0x%x\n",
 						   (int)pid, sp->status,
 						   status));
-					sp->status = status;
+					if (WIFCONTINUED(status)) {
+						sp->status = -1;
+						jp->state = 0;
+					} else
+						sp->status = status;
 					thisjob = jp;
 				}
 				if (sp->status == -1)
@@ -1118,7 +1123,7 @@ waitproc(int block, int *status)
 	int flags;
 
 #if JOBS
-	flags = WUNTRACED;
+	flags = WUNTRACED | WCONTINUED;
 #else
 	flags = 0;
 #endif



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