Module Name:    src
Committed By:   rmind
Date:           Wed Nov  4 21:23:03 UTC 2009

Modified Files:
        src/sys/compat/common: kern_exit_43.c kern_time_50.c
        src/sys/compat/ibcs2: ibcs2_misc.c
        src/sys/compat/irix: irix_signal.c
        src/sys/compat/linux/common: linux_misc.c
        src/sys/compat/linux32/common: linux32_wait.c
        src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_wait.c
        src/sys/compat/osf1: osf1_misc.c
        src/sys/compat/svr4: svr4_misc.c
        src/sys/compat/svr4_32: svr4_32_misc.c
        src/sys/kern: kern_exit.c
        src/sys/sys: proc.h

Log Message:
do_sys_wait(): fix previous by checking for ru != NULL.  Noticed by
Onno van der Linden.  Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/common/kern_exit_43.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.108 -r1.109 src/sys/compat/ibcs2/ibcs2_misc.c
cvs rdiff -u -r1.50 -r1.51 src/sys/compat/irix/irix_signal.c
cvs rdiff -u -r1.209 -r1.210 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux32/common/linux32_wait.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.20 -r1.21 src/sys/compat/netbsd32/netbsd32_wait.c
cvs rdiff -u -r1.82 -r1.83 src/sys/compat/osf1/osf1_misc.c
cvs rdiff -u -r1.146 -r1.147 src/sys/compat/svr4/svr4_misc.c
cvs rdiff -u -r1.65 -r1.66 src/sys/compat/svr4_32/svr4_32_misc.c
cvs rdiff -u -r1.224 -r1.225 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.292 -r1.293 src/sys/sys/proc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_exit_43.c
diff -u src/sys/compat/common/kern_exit_43.c:1.21 src/sys/compat/common/kern_exit_43.c:1.22
--- src/sys/compat/common/kern_exit_43.c:1.21	Thu Dec 20 23:02:44 2007
+++ src/sys/compat/common/kern_exit_43.c	Wed Nov  4 21:23:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit_43.c,v 1.21 2007/12/20 23:02:44 dsl Exp $	*/
+/*	$NetBSD: kern_exit_43.c,v 1.22 2009/11/04 21:23:02 rmind Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit_43.c,v 1.21 2007/12/20 23:02:44 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit_43.c,v 1.22 2009/11/04 21:23:02 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -74,24 +74,17 @@
 int
 compat_43_sys_wait(struct lwp *l, const void *v, register_t *retval)
 {
-	int error, status, was_zombie;
-	int child_pid = WAIT_ANY;
-
-
-#ifdef PSL_ALLCC
-#else
-#endif
+	int error, status, child_pid = WAIT_ANY;
 
 #ifdef PSL_ALLCC
 	if ((GETPS(l->l_md.md_regs) & PSL_ALLCC) != PSL_ALLCC) {
-		error = do_sys_wait(l, &child_pid, &status, 0, NULL, &was_zombie);
+		error = do_sys_wait(&child_pid, &status, 0, NULL);
 	} else {
-		error = do_sys_wait(l, &child_pid, &status,
-		    l->l_md.md_regs[R0], (struct rusage *)l->l_md.md_regs[R1],
-		    &was_zombie);
+		error = do_sys_wait(&child_pid, &status,
+		    l->l_md.md_regs[R0], (struct rusage *)l->l_md.md_regs[R1]);
 	}
 #else
-	error = do_sys_wait(l, &child_pid, &status, 0, NULL, &was_zombie);
+	error = do_sys_wait(&child_pid, &status, 0, NULL);
 #endif
 	retval[0] = child_pid;
 	retval[1] = status;

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.10 src/sys/compat/common/kern_time_50.c:1.11
--- src/sys/compat/common/kern_time_50.c:1.10	Mon Oct 12 23:41:51 2009
+++ src/sys/compat/common/kern_time_50.c	Wed Nov  4 21:23:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.10 2009/10/12 23:41:51 yamt Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.11 2009/11/04 21:23:02 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.10 2009/10/12 23:41:51 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.11 2009/11/04 21:23:02 rmind Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -823,7 +823,8 @@
 	return (error);
 }
 int
-compat_50_sys_wait4(struct lwp *l, const struct compat_50_sys_wait4_args *uap, register_t *retval)
+compat_50_sys_wait4(struct lwp *l, const struct compat_50_sys_wait4_args *uap,
+    register_t *retval)
 {
 	/* {
 		syscallarg(int)			pid;
@@ -831,14 +832,12 @@
 		syscallarg(int)			options;
 		syscallarg(struct rusage50 *)	rusage;
 	} */
-	int		status, error;
-	int		was_zombie;
-	struct rusage	ru;
-	struct rusage50	ru50;
-	int pid = SCARG(uap, pid);
+	int status, error, pid = SCARG(uap, pid);
+	struct rusage50 ru50;
+	struct rusage ru;
 
-	error = do_sys_wait(l, &pid, &status, SCARG(uap, options),
-	    SCARG(uap, rusage) != NULL ? &ru : NULL, &was_zombie);
+	error = do_sys_wait(&pid, &status, SCARG(uap, options),
+	    SCARG(uap, rusage) != NULL ? &ru : NULL);
 
 	retval[0] = pid;
 	if (pid == 0)

Index: src/sys/compat/ibcs2/ibcs2_misc.c
diff -u src/sys/compat/ibcs2/ibcs2_misc.c:1.108 src/sys/compat/ibcs2/ibcs2_misc.c:1.109
--- src/sys/compat/ibcs2/ibcs2_misc.c:1.108	Sun Aug  9 22:49:00 2009
+++ src/sys/compat/ibcs2/ibcs2_misc.c	Wed Nov  4 21:23:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ibcs2_misc.c,v 1.108 2009/08/09 22:49:00 haad Exp $	*/
+/*	$NetBSD: ibcs2_misc.c,v 1.109 2009/11/04 21:23:02 rmind Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -95,7 +95,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.108 2009/08/09 22:49:00 haad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.109 2009/11/04 21:23:02 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -215,8 +215,7 @@
 		syscallarg(int) a3;
 	} */
 #endif
-	int error;
-	int pid, options, status, was_zombie;
+	int error, options, status, pid;
 
 #if defined(__i386__)
 #define WAITPID_EFLAGS	0x8c4	/* OF, SF, ZF, PF */
@@ -233,7 +232,7 @@
 	}
 #endif
 
-	error = do_sys_wait(l, &pid, &status, options, NULL, &was_zombie);
+	error = do_sys_wait(&pid, &status, options, NULL);
 	retval[0] = pid;
 	retval[1] = status;
 	return error;

Index: src/sys/compat/irix/irix_signal.c
diff -u src/sys/compat/irix/irix_signal.c:1.50 src/sys/compat/irix/irix_signal.c:1.51
--- src/sys/compat/irix/irix_signal.c:1.50	Wed Mar 18 16:00:16 2009
+++ src/sys/compat/irix/irix_signal.c	Wed Nov  4 21:23:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: irix_signal.c,v 1.50 2009/03/18 16:00:16 cegger Exp $ */
+/*	$NetBSD: irix_signal.c,v 1.51 2009/11/04 21:23:02 rmind Exp $ */
 
 /*-
  * Copyright (c) 1994, 2001-2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.50 2009/03/18 16:00:16 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.51 2009/11/04 21:23:02 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/signal.h>
@@ -800,7 +800,8 @@
  * from svr4_misc.c, or push the irix_irix5_siginfo into svr4_siginfo.h
  */
 int
-irix_sys_waitsys(struct lwp *l, const struct irix_sys_waitsys_args *uap, register_t *retval)
+irix_sys_waitsys(struct lwp *l, const struct irix_sys_waitsys_args *uap,
+    register_t *retval)
 {
 	/* {
 		syscallarg(int) type;
@@ -810,13 +811,12 @@
 		syscallarg(struct rusage *) ru;
 	} */
 	struct proc *parent = l->l_proc;
-	int options, status, error;
-	int was_zombie;
+	int error, status, options, pid;
 	struct rusage ru;
-	int pid = SCARG(uap, pid);
 
 	switch (SCARG(uap, type)) {
 	case SVR4_P_PID:
+		pid = SCARG(uap, pid);
 		break;
 
 	case SVR4_P_PGID:
@@ -848,14 +848,12 @@
 	if (SCARG(uap, options) & (SVR4_WSTOPPED|SVR4_WCONTINUED))
 		options |= WUNTRACED;
 
-	error = do_sys_wait(l, &pid, &status, options, &ru, &was_zombie);
-
+	error = do_sys_wait(&pid, &status, options, &ru);
 	if (error != 0)
 		return error;
 
-	if (was_zombie) {
-		if (SCARG(uap, ru))
-			error = copyout(&ru, SCARG(uap, ru), sizeof(ru));
+	if (SCARG(uap, ru)) {
+		error = copyout(&ru, SCARG(uap, ru), sizeof(ru));
 		if (error != 0)
 			return error;
 	}

Index: src/sys/compat/linux/common/linux_misc.c
diff -u src/sys/compat/linux/common/linux_misc.c:1.209 src/sys/compat/linux/common/linux_misc.c:1.210
--- src/sys/compat/linux/common/linux_misc.c:1.209	Wed Jul 22 15:49:29 2009
+++ src/sys/compat/linux/common/linux_misc.c	Wed Nov  4 21:23:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_misc.c,v 1.209 2009/07/22 15:49:29 njoly Exp $	*/
+/*	$NetBSD: linux_misc.c,v 1.210 2009/11/04 21:23:02 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.209 2009/07/22 15:49:29 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.210 2009/11/04 21:23:02 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -219,10 +219,9 @@
 		syscallarg(int) options;
 		syscallarg(struct rusage50 *) rusage;
 	} */
-	int error, status, options, linux_options, was_zombie;
-	struct rusage ru;
+	int error, status, options, linux_options, pid = SCARG(uap, pid);
 	struct rusage50 ru50;
-	int pid = SCARG(uap, pid);
+	struct rusage ru;
 	proc_t *p;
 
 	linux_options = SCARG(uap, options);
@@ -246,17 +245,17 @@
 
 # endif
 
-	error = do_sys_wait(l, &pid, &status, options,
-	    SCARG(uap, rusage) != NULL ? &ru : NULL, &was_zombie);
+	error = do_sys_wait(&pid, &status, options,
+	    SCARG(uap, rusage) != NULL ? &ru : NULL);
 
 	retval[0] = pid;
 	if (pid == 0)
 		return error;
 
-        p = curproc;
-        mutex_enter(p->p_lock);
+	p = curproc;
+	mutex_enter(p->p_lock);
 	sigdelset(&p->p_sigpend.sp_set, SIGCHLD); /* XXXAD ksiginfo leak */
-        mutex_exit(p->p_lock);
+	mutex_exit(p->p_lock);
 
 	if (SCARG(uap, rusage) != NULL) {
 		rusage_to_rusage50(&ru, &ru50);

Index: src/sys/compat/linux32/common/linux32_wait.c
diff -u src/sys/compat/linux32/common/linux32_wait.c:1.10 src/sys/compat/linux32/common/linux32_wait.c:1.11
--- src/sys/compat/linux32/common/linux32_wait.c:1.10	Sat Jan 17 22:28:53 2009
+++ src/sys/compat/linux32/common/linux32_wait.c	Wed Nov  4 21:23:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_wait.c,v 1.10 2009/01/17 22:28:53 njoly Exp $ */
+/*	$NetBSD: linux32_wait.c,v 1.11 2009/11/04 21:23:03 rmind Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_wait.c,v 1.10 2009/01/17 22:28:53 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_wait.c,v 1.11 2009/11/04 21:23:03 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -99,11 +99,10 @@
 		syscallarg(int) options;
 		syscallarg(netbsd32_rusage50p_t) rusage;
 	} */
-	int error, status, linux_options, options, was_zombie;
-	struct rusage ru;
+	int error, status, linux_options, options, pid;
 	struct netbsd32_rusage50 ru32;
+	struct rusage ru;
 	proc_t *p;
-	int pid;
 
 	linux_options = SCARG(uap, options);
 	options = WOPTSCHECKED;
@@ -120,8 +119,8 @@
 		options |= WALTSIG;
 
 	pid = SCARG(uap, pid);
-	error = do_sys_wait(l, &pid, &status, options,
-	    SCARG_P32(uap, rusage) != NULL ? &ru : NULL, &was_zombie);
+	error = do_sys_wait(&pid, &status, options,
+	    SCARG_P32(uap, rusage) != NULL ? &ru : NULL);
 	retval[0] = pid;
 	if (pid == 0)
 		return error;

Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.5 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.6
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.5	Sun Aug  9 22:49:01 2009
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Wed Nov  4 21:23:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.5 2009/08/09 22:49:01 haad Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.6 2009/11/04 21:23:03 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.5 2009/08/09 22:49:01 haad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.6 2009/11/04 21:23:03 rmind Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -857,14 +857,12 @@
 		syscallarg(int) options;
 		syscallarg(netbsd32_rusage50p_t) rusage;
 	} */
-	int		status, error;
-	int		was_zombie;
-	struct rusage	ru;
-	struct netbsd32_rusage50	ru32;
-	int pid = SCARG(uap, pid);
+	int error, status, pid = SCARG(uap, pid);
+	struct netbsd32_rusage50 ru32;
+	struct rusage ru;
 
-	error = do_sys_wait(l, &pid, &status, SCARG(uap, options),
-	    SCARG_P32(uap, rusage) != NULL ? &ru : NULL, &was_zombie);
+	error = do_sys_wait(&pid, &status, SCARG(uap, options),
+	    SCARG_P32(uap, rusage) != NULL ? &ru : NULL);
 
 	retval[0] = pid;
 	if (pid == 0)

Index: src/sys/compat/netbsd32/netbsd32_wait.c
diff -u src/sys/compat/netbsd32/netbsd32_wait.c:1.20 src/sys/compat/netbsd32/netbsd32_wait.c:1.21
--- src/sys/compat/netbsd32/netbsd32_wait.c:1.20	Sun Jan 11 02:45:49 2009
+++ src/sys/compat/netbsd32/netbsd32_wait.c	Wed Nov  4 21:23:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_wait.c,v 1.20 2009/01/11 02:45:49 christos Exp $	*/
+/*	$NetBSD: netbsd32_wait.c,v 1.21 2009/11/04 21:23:03 rmind Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_wait.c,v 1.20 2009/01/11 02:45:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_wait.c,v 1.21 2009/11/04 21:23:03 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,14 +55,12 @@
 		syscallarg(int) options;
 		syscallarg(netbsd32_rusagep_t) rusage;
 	} */
-	int		status, error;
-	int		was_zombie;
-	struct rusage	ru;
-	struct netbsd32_rusage	ru32;
-	int pid = SCARG(uap, pid);
+	int error, status, pid = SCARG(uap, pid);
+	struct netbsd32_rusage ru32;
+	struct rusage ru;
 
-	error = do_sys_wait(l, &pid, &status, SCARG(uap, options),
-	    SCARG_P32(uap, rusage) != NULL ? &ru : NULL, &was_zombie);
+	error = do_sys_wait(&pid, &status, SCARG(uap, options),
+	    SCARG_P32(uap, rusage) != NULL ? &ru : NULL);
 
 	retval[0] = pid;
 	if (pid == 0)

Index: src/sys/compat/osf1/osf1_misc.c
diff -u src/sys/compat/osf1/osf1_misc.c:1.82 src/sys/compat/osf1/osf1_misc.c:1.83
--- src/sys/compat/osf1/osf1_misc.c:1.82	Tue Apr 22 21:29:21 2008
+++ src/sys/compat/osf1/osf1_misc.c	Wed Nov  4 21:23:03 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_misc.c,v 1.82 2008/04/22 21:29:21 ad Exp $ */
+/* $NetBSD: osf1_misc.c,v 1.83 2009/11/04 21:23:03 rmind Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.82 2008/04/22 21:29:21 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.83 2009/11/04 21:23:03 rmind Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -402,7 +402,7 @@
 	struct osf1_rusage osf1_rusage;
 	struct rusage netbsd_rusage;
 	unsigned long leftovers;
-	int error, status, was_zombie;
+	int error, status;
 	int options = SCARG(uap, options);
 	int pid = SCARG(uap, pid);
 
@@ -412,8 +412,8 @@
 	if (leftovers != 0)
 		return (EINVAL);
 
-	error = do_sys_wait(l, & pid, &status, options | WOPTSCHECKED,
-	    SCARG(uap, rusage) != NULL ? &netbsd_rusage : NULL, &was_zombie);
+	error = do_sys_wait(&pid, &status, options | WOPTSCHECKED,
+	    SCARG(uap, rusage) != NULL ? &netbsd_rusage : NULL);
 
 	retval[0] = pid;
 	if (pid == 0)

Index: src/sys/compat/svr4/svr4_misc.c
diff -u src/sys/compat/svr4/svr4_misc.c:1.146 src/sys/compat/svr4/svr4_misc.c:1.147
--- src/sys/compat/svr4/svr4_misc.c:1.146	Sun Aug  9 22:49:01 2009
+++ src/sys/compat/svr4/svr4_misc.c	Wed Nov  4 21:23:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_misc.c,v 1.146 2009/08/09 22:49:01 haad Exp $	 */
+/*	$NetBSD: svr4_misc.c,v 1.147 2009/11/04 21:23:03 rmind Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.146 2009/08/09 22:49:01 haad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.147 2009/11/04 21:23:03 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -109,13 +109,12 @@
     svr4_mode_t, svr4_dev_t);
 
 int
-svr4_sys_wait(struct lwp *l, const struct svr4_sys_wait_args *uap, register_t *retval)
+svr4_sys_wait(struct lwp *l, const struct svr4_sys_wait_args *uap,
+    register_t *retval)
 {
-	int error, was_zombie;
-	int st, sig;
-	int pid = WAIT_ANY;
+	int error, st, sig, pid = WAIT_ANY;
 
-	error = do_sys_wait(l, &pid, &st, 0, NULL, &was_zombie);
+	error = do_sys_wait(&pid, &st, 0, NULL);
 
 	retval[0] = pid;
 	if (pid == 0)

Index: src/sys/compat/svr4_32/svr4_32_misc.c
diff -u src/sys/compat/svr4_32/svr4_32_misc.c:1.65 src/sys/compat/svr4_32/svr4_32_misc.c:1.66
--- src/sys/compat/svr4_32/svr4_32_misc.c:1.65	Mon Aug 10 17:36:00 2009
+++ src/sys/compat/svr4_32/svr4_32_misc.c	Wed Nov  4 21:23:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_misc.c,v 1.65 2009/08/10 17:36:00 rjs Exp $	 */
+/*	$NetBSD: svr4_32_misc.c,v 1.66 2009/11/04 21:23:03 rmind Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.65 2009/08/10 17:36:00 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.66 2009/11/04 21:23:03 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -107,13 +107,12 @@
     svr4_32_mode_t, svr4_32_dev_t);
 
 int
-svr4_32_sys_wait(struct lwp *l, const struct svr4_32_sys_wait_args *uap, register_t *retval)
+svr4_32_sys_wait(struct lwp *l, const struct svr4_32_sys_wait_args *uap,
+    register_t *retval)
 {
-	int error, was_zombie;
-	int pid = WAIT_ANY;
-	int st, sig;
+	int error, st, sig, pid = WAIT_ANY;
 
-	error = do_sys_wait(l, &pid, &st, 0, NULL, &was_zombie);
+	error = do_sys_wait(&pid, &st, 0, NULL);
 
 	retval[0] = pid;
 	if (pid == 0)

Index: src/sys/kern/kern_exit.c
diff -u src/sys/kern/kern_exit.c:1.224 src/sys/kern/kern_exit.c:1.225
--- src/sys/kern/kern_exit.c:1.224	Sun Nov  1 21:05:30 2009
+++ src/sys/kern/kern_exit.c	Wed Nov  4 21:23:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.224 2009/11/01 21:05:30 rmind Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.225 2009/11/04 21:23:02 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.224 2009/11/01 21:05:30 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.225 2009/11/04 21:23:02 rmind Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_perfctrs.h"
@@ -665,46 +665,41 @@
 }
 
 int
-do_sys_wait(struct lwp *l, int *pid, int *status, int options,
-    struct rusage *ru, int *was_zombie)
+do_sys_wait(int *pid, int *status, int options, struct rusage *ru)
 {
-	struct proc	*child;
-	int		error;
+	proc_t *child;
+	int error;
 
+	if (ru != NULL) {
+		memset(ru, 0, sizeof(*ru));
+	}
 	mutex_enter(proc_lock);
-	error = find_stopped_child(l->l_proc, *pid, options, &child, status);
-
+	error = find_stopped_child(curproc, *pid, options, &child, status);
 	if (child == NULL) {
 		mutex_exit(proc_lock);
 		*pid = 0;
 		return error;
 	}
-
 	*pid = child->p_pid;
 
 	if (child->p_stat == SZOMB) {
 		/* proc_free() will release the proc_lock. */
 		if (options & WNOWAIT) {
 			mutex_exit(proc_lock);
-			memset(ru, 0, sizeof(*ru));
 		} else {
 			proc_free(child, ru);
 		}
-		*was_zombie = 1;
 	} else {
 		/* Child state must have been SSTOP. */
 		mutex_exit(proc_lock);
-
-		*was_zombie = 0;
 		*status = W_STOPCODE(*status);
-		memset(ru, 0, sizeof(*ru));
 	}
-
 	return 0;
 }
 
 int
-sys___wait450(struct lwp *l, const struct sys___wait450_args *uap, register_t *retval)
+sys___wait450(struct lwp *l, const struct sys___wait450_args *uap,
+    register_t *retval)
 {
 	/* {
 		syscallarg(int)			pid;
@@ -712,24 +707,22 @@
 		syscallarg(int)			options;
 		syscallarg(struct rusage *)	rusage;
 	} */
-	int		status, error;
-	int		was_zombie;
-	struct rusage	ru;
-	int pid = SCARG(uap, pid);
+	int error, status, pid = SCARG(uap, pid);
+	struct rusage ru;
 
-	error = do_sys_wait(l, &pid, &status, SCARG(uap, options),
-	    SCARG(uap, rusage) != NULL ? &ru : NULL, &was_zombie);
+	error = do_sys_wait(&pid, &status, SCARG(uap, options),
+	    SCARG(uap, rusage) != NULL ? &ru : NULL);
 
 	retval[0] = pid;
-	if (pid == 0)
+	if (pid == 0) {
 		return error;
-
-	if (SCARG(uap, rusage))
-		error = copyout(&ru, SCARG(uap, rusage), sizeof(ru));
-
-	if (error == 0 && SCARG(uap, status))
+	}
+	if (SCARG(uap, status)) {
 		error = copyout(&status, SCARG(uap, status), sizeof(status));
-
+	}
+	if (SCARG(uap, rusage) && error == 0) {
+		error = copyout(&ru, SCARG(uap, rusage), sizeof(ru));
+	}
 	return error;
 }
 

Index: src/sys/sys/proc.h
diff -u src/sys/sys/proc.h:1.292 src/sys/sys/proc.h:1.293
--- src/sys/sys/proc.h:1.292	Thu Oct 22 22:28:57 2009
+++ src/sys/sys/proc.h	Wed Nov  4 21:23:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.292 2009/10/22 22:28:57 rmind Exp $	*/
+/*	$NetBSD: proc.h,v 1.293 2009/11/04 21:23:02 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -484,7 +484,7 @@
 void	wakeup_one(wchan_t);
 int	kpause(const char *, bool, int, kmutex_t *);
 void	exit1(struct lwp *, int) __dead;
-int	do_sys_wait(struct lwp *, int *, int *, int, struct rusage *, int *);
+int	do_sys_wait(int *, int *, int, struct rusage *);
 struct proc *proc_alloc(void);
 void	proc0_init(void);
 void	proc_free_pid(struct proc *);

Reply via email to