summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-07-28 14:32:55 +0000
committerjilles <jilles@FreeBSD.org>2012-07-28 14:32:55 +0000
commitd73fbcf11700105c24f4b9ce3fe3cbc2886030f7 (patch)
treebd81fb547a078e8f74ff998e88f20e39d38ec346 /bin
parentfe2cf87e27e5e9c8d1f5e3b134e60e9e70740af4 (diff)
downloadFreeBSD-src-d73fbcf11700105c24f4b9ce3fe3cbc2886030f7.zip
FreeBSD-src-d73fbcf11700105c24f4b9ce3fe3cbc2886030f7.tar.gz
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.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/jobs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index 1dc722f..41bd909 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -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
OpenPOWER on IntegriCloud