summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-03-17 20:00:00 +0000
committerjhb <jhb@FreeBSD.org>2004-03-17 20:00:00 +0000
commit275240297d2db55c4566d1abd579bbdde2b560d1 (patch)
treee960ffc0a863b368d852fa094d1f4ccb757fe3c7 /sys/i386/ibcs2
parented6ec609726587e3bd4ce137cf123ca5b8c5caf6 (diff)
downloadFreeBSD-src-275240297d2db55c4566d1abd579bbdde2b560d1.zip
FreeBSD-src-275240297d2db55c4566d1abd579bbdde2b560d1.tar.gz
- Replace wait1() with a kern_wait() function that accepts the pid,
options, status pointer and rusage pointer as arguments. It is up to the caller to copyout the status and rusage to userland if needed. This lets us axe the 'compat' argument and hide all that functionality in owait(), by the way. This also cleans up some locking in kern_wait() since it no longer has to drop locks around copyout() since all the copyout()'s are deferred. - Convert owait(), wait4(), and the various ABI compat wait() syscalls to use kern_wait() rather than wait1() or wait4(). This removes a bit more stackgap usage. Tested on: i386 Compiled on: i386, alpha, amd64
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r--sys/i386/ibcs2/ibcs2_misc.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/sys/i386/ibcs2/ibcs2_misc.c b/sys/i386/ibcs2/ibcs2_misc.c
index d4162ea..c3edf15 100644
--- a/sys/i386/ibcs2/ibcs2_misc.c
+++ b/sys/i386/ibcs2/ibcs2_misc.c
@@ -144,36 +144,29 @@ ibcs2_wait(td, uap)
struct thread *td;
struct ibcs2_wait_args *uap;
{
- int error, status;
- struct wait_args w4;
+ int error, options, status;
+ int *statusp;
+ pid_t pid;
struct trapframe *tf = td->td_frame;
- w4.rusage = NULL;
- if ((tf->tf_eflags & (PSL_Z|PSL_PF|PSL_N|PSL_V))
+ if ((tf->tf_eflags & (PSL_Z|PSL_PF|PSL_N|PSL_V))
== (PSL_Z|PSL_PF|PSL_N|PSL_V)) {
/* waitpid */
- w4.pid = uap->a1;
- w4.status = (int *)uap->a2;
- w4.options = uap->a3;
+ pid = uap->a1;
+ statusp = (int *)uap->a2;
+ options = uap->a3;
} else {
/* wait */
- w4.pid = WAIT_ANY;
- w4.status = (int *)uap->a1;
- w4.options = 0;
+ pid = WAIT_ANY;
+ statusp = (int *)uap->a1;
+ options = 0;
}
- if ((error = wait4(td, &w4)) != 0)
+ error = kern_wait(td, pid, &status, options, NULL);
+ if (error)
return error;
- if (w4.status) { /* this is real iBCS brain-damage */
- error = copyin((caddr_t)w4.status, (caddr_t)&status,
- sizeof(w4.status));
- if(error)
- return error;
-
+ if (statusp) {
/*
- * Convert status/signal result. We must validate the
- * signal number stored in the exit status in case
- * the user changed it between wait4()'s copyout()
- * and our copyin().
+ * Convert status/signal result.
*/
if (WIFSTOPPED(status)) {
if (WSTOPSIG(status) <= 0 ||
@@ -191,8 +184,7 @@ ibcs2_wait(td, uap)
/* record result/status */
td->td_retval[1] = status;
- return copyout((caddr_t)&status, (caddr_t)w4.status,
- sizeof(w4.status));
+ return copyout(&status, statusp, sizeof(status));
}
return 0;
OpenPOWER on IntegriCloud