Thorsten Glaser <[email protected]> wrote:
 |Steffen Daode Nurpmeso dixit:
 |
 |>?1[steffen@sherwood]$ kill -STOP %1
 |
 |Why STOP and not TSTP? (Not related, but curious.)

yeah, sorry – NetBSD bin/48138 and FreeBSD bin/181435 do mention
TSTP…

 |>?0[steffen@sherwood]$ kill -CONT %1
 |
 |The kernel does not communicate this to the shell,
 |so it assumes the job is still stopped and thus
 |out of job control. If you “bg”, it should™ work.

I wonder wether the simple patch below (beside its uglyness) would
be sufficient to deal with the problem?  It fixes the particular
problem, but that's all i can say for sure…

 |bye,
 |//mirabilos

Ciao,

--steffen
Date:   2013-08-21 14:07:40 +0200

    Dumb try to add WCONTINUED support
---
 jobs.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/jobs.c b/jobs.c
index 3277c78..55b9000 100644
--- a/jobs.c
+++ b/jobs.c
@@ -1281,7 +1281,11 @@ j_sigchld(int sig MKSH_A_UNUSED)
 	getrusage(RUSAGE_CHILDREN, &ru0);
 	do {
 #ifndef MKSH_NOPROSPECTOFWORK
-		pid = waitpid(-1, &status, (WNOHANG|WUNTRACED));
+		pid = waitpid(-1, &status, (WNOHANG|WUNTRACED
+# ifdef WCONTINUED
+			|WCONTINUED
+# endif
+		));
 #else
 		pid = wait(&status);
 #endif
@@ -1317,7 +1321,14 @@ j_sigchld(int sig MKSH_A_UNUSED)
 		ru0 = ru1;
 		p->status = status;
 #ifndef MKSH_UNEMPLOYED
-		if (WIFSTOPPED(status))
+# ifdef WCONTINUED
+		if (WIFCONTINUED(status)) {
+			p->state = j->state = PRUNNING;
+			/* skip check_job(), no-op in this case */
+			continue;
+		} else
+# endif
+		  if (WIFSTOPPED(status))
 			p->state = PSTOPPED;
 		else
 #endif

Reply via email to