diff options
| author | 2003-08-03 19:25:49 +0000 | |
|---|---|---|
| committer | 2003-08-03 19:25:49 +0000 | |
| commit | 26a45e40c64199e50627b576f136ec38eef723cd (patch) | |
| tree | 51dd2fd4b64ff5568003d355e42a1e3289bcf363 /sys/kern/kern_exit.c | |
| parent | prefer fdc to fdce for cache flushing here (diff) | |
| download | wireguard-openbsd-26a45e40c64199e50627b576f136ec38eef723cd.tar.xz wireguard-openbsd-26a45e40c64199e50627b576f136ec38eef723cd.zip | |
Implement the WCONTINUED flag to the wait(2) family of syscalls and the
associated WIFCONTINUED macro as per 1003.1-2001. Adapted from FreeBSD.
A minor amount of trickiness is involved here. The value for WCONTINUED
is chosen in such a way that _WSTATUS(_WCONTINUED) == _WSTOPPED and the
WIFSTOPPED macro has been modified such that WIFSTOPPED(_WCONTINUED) !=
_WSTOPPED. This means we don't need to add an extra check to the
WIFSIGNALED and WIFSTOPPED macros. deraadt@ OK.
Diffstat (limited to 'sys/kern/kern_exit.c')
| -rw-r--r-- | sys/kern/kern_exit.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index cc8470af1c5..e7c9f385b24 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.46 2003/07/21 22:44:50 tedu Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.47 2003/08/03 19:25:49 millert Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -397,7 +397,7 @@ sys_wait4(q, v, retval) if (SCARG(uap, pid) == 0) SCARG(uap, pid) = -q->p_pgid; - if (SCARG(uap, options) &~ (WUNTRACED|WNOHANG|WALTSIG)) + if (SCARG(uap, options) &~ (WUNTRACED|WNOHANG|WALTSIG|WCONTINUED)) return (EINVAL); loop: @@ -468,6 +468,18 @@ loop: error = 0; return (error); } + if ((SCARG(uap, options) & WCONTINUED) && (p->p_flag & P_CONTINUED)) { + p->p_flag &= ~P_CONTINUED; + retval[0] = p->p_pid; + + if (SCARG(uap, status)) { + status = _WCONTINUED; + error = copyout(&status, SCARG(uap, status), + sizeof(status)); + } else + error = 0; + return (error); + } } if (nfound == 0) return (ECHILD); |
