diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index a064e96..6566843 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -692,7 +692,7 @@ kern_wait(pid_t pid, int *status, int options, struct rusage *rusage, int *res) if (pid == 0) pid = -q->p_pgid; - if (options &~ (WUNTRACED|WNOHANG|WLINUXCLONE)) + if (options &~ (WUNTRACED|WNOHANG|WCONTINUED|WLINUXCLONE)) return (EINVAL); loop: /* @@ -835,6 +835,14 @@ loop: bzero(rusage, sizeof(rusage)); return (0); } + if (options & WCONTINUED && (p->p_flag & P_CONTINUED)) { + *res = p->p_pid; + p->p_flag &= ~P_CONTINUED; + + if (status) + *status = SIGCONT; + return (0); + } } if (nfound == 0) return (ECHILD); diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 06c9347..a5be1ba 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1012,6 +1012,7 @@ lwpsignal(struct proc *p, struct lwp *lp, int sig) return; } SIG_CONTSIGMASK(p->p_siglist); + p->p_flag &= ~P_CONTINUED; } crit_enter(); @@ -1056,6 +1057,7 @@ lwpsignal(struct proc *p, struct lwp *lp, int sig) * handle the signal itself. */ /* XXX what if the signal is being held blocked? */ + p->p_flag |= P_CONTINUED; if (action == SIG_DFL) SIGDELSET(p->p_siglist, sig); proc_unstop(p); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 31dc08c..41cbe9c 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -331,6 +331,7 @@ struct proc { #define P_WAITED 0x01000 /* SIGSTOP status was returned by wait3/4 */ #define P_WEXIT 0x02000 /* Working on exiting (master exit) */ #define P_EXEC 0x04000 /* Process called exec. */ +#define P_CONTINUED 0x10000 /* Proc has continued from a stopped state. */ /* Should probably be changed into a hold count. */ /* was P_NOSWAP 0x08000 was: Do not swap upages; p->p_hold */ diff --git a/sys/sys/wait.h b/sys/sys/wait.h index 6234fa4..402c615 100644 --- a/sys/sys/wait.h +++ b/sys/sys/wait.h @@ -62,6 +62,7 @@ #define WTERMSIG(x) (_WSTATUS(x)) #define WIFEXITED(x) (_WSTATUS(x) == 0) #define WEXITSTATUS(x) (_W_INT(x) >> 8) +#define WIFCONTINUED(x) (x == 0x13) /* 0x13 == SIGCONT */ #ifndef _POSIX_SOURCE #define WCOREDUMP(x) (_W_INT(x) & WCOREFLAG) @@ -80,6 +81,7 @@ */ #define WNOHANG 1 /* don't hang in wait */ #define WUNTRACED 2 /* tell about stopped, untraced children */ +#define WCONTINUED 4 /* Report a job control continued process. */ #define WLINUXCLONE 0x80000000 /* wait for kthread spawned from linux_clone */ #ifndef _POSIX_SOURCE