diff options
author | mike <mike@FreeBSD.org> | 2002-06-01 18:37:46 +0000 |
---|---|---|
committer | mike <mike@FreeBSD.org> | 2002-06-01 18:37:46 +0000 |
commit | 1b681bdeaabdef171893adfd1d525d5c71ee9416 (patch) | |
tree | b739dc87bdda20993d6e29c623c3bd323718010c /sys/kern/kern_exit.c | |
parent | dee070ee6ebd2cd6a3ee6cbb6a1b2ccbc675c27e (diff) | |
download | FreeBSD-src-1b681bdeaabdef171893adfd1d525d5c71ee9416.zip FreeBSD-src-1b681bdeaabdef171893adfd1d525d5c71ee9416.tar.gz |
Add POSIX.1-2001 WCONTINUED option for waitpid(2). A proc flag
(P_CONTINUED) is set when a stopped process receives a SIGCONT and
cleared after it has notified a parent process that has requested
notification via waitpid(2) with WCONTINUED specified in its options
operand. The status value can be checked with the new WIFCONTINUED()
macro.
Reviewed by: jake
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r-- | sys/kern/kern_exit.c | 18 |
1 files changed, 17 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) { |