diff options
-rw-r--r-- | sys/kern/kern_exit.c | 18 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 2 | ||||
-rw-r--r-- | sys/sys/proc.h | 1 | ||||
-rw-r--r-- | sys/sys/wait.h | 2 |
4 files changed, 22 insertions, 1 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 3e359bb..d44209a 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -505,7 +505,7 @@ wait1(td, uap, compat) uap->pid = -q->p_pgid; PROC_UNLOCK(q); } - if (uap->options &~ (WUNTRACED|WNOHANG|WLINUXCLONE)) + if (uap->options &~ (WUNTRACED|WNOHANG|WCONTINUED|WLINUXCLONE)) return (EINVAL); mtx_lock(&Giant); loop: @@ -688,6 +688,22 @@ loop: mtx_unlock(&Giant); return (error); } + if (uap->options & WCONTINUED && (p->p_flag & P_CONTINUED)) { + sx_xunlock(&proctree_lock); + td->td_retval[0] = p->p_pid; + p->p_flag &= ~P_CONTINUED; + PROC_UNLOCK(p); + + if (uap->status) { + status = SIGCONT; + error = copyout((caddr_t)&status, + (caddr_t)uap->status, sizeof(status)); + } else + error = 0; + + mtx_unlock(&Giant); + return (error); + } PROC_UNLOCK(p); } if (nfound == 0) { diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index e98eb73..988478d 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1436,6 +1436,8 @@ psignal(p, sig) } } } else { + p->p_flag |= P_CONTINUED; + wakeup((caddr_t)p->p_pptr); if (td->td_wchan == NULL) goto run; p->p_stat = SSLEEP; diff --git a/sys/sys/proc.h b/sys/sys/proc.h index e440c40..280c914 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -486,6 +486,7 @@ struct proc { #define P_WEXIT 0x02000 /* Working on exiting. */ #define P_EXEC 0x04000 /* Process called exec. */ #define P_KSES 0x08000 /* Process is using KSEs. */ +#define P_CONTINUED 0x10000 /* Proc has continued from a stopped state. */ /* Should be moved to machine-dependent areas. */ #define P_UNUSED100000 0x100000 diff --git a/sys/sys/wait.h b/sys/sys/wait.h index bb44198..e589759 100644 --- a/sys/sys/wait.h +++ b/sys/sys/wait.h @@ -61,6 +61,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) @@ -79,6 +80,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 |