Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys do_sys_wait(): fix previous by checking for ru != NULL. ...
details: https://anonhg.NetBSD.org/src/rev/8a2ba397e3a8
branches: trunk
changeset: 748763:8a2ba397e3a8
user: rmind <rmind%NetBSD.org@localhost>
date: Wed Nov 04 21:23:02 2009 +0000
description:
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 ?).
diffstat:
sys/compat/common/kern_exit_43.c | 21 ++++--------
sys/compat/common/kern_time_50.c | 19 +++++------
sys/compat/ibcs2/ibcs2_misc.c | 9 ++---
sys/compat/irix/irix_signal.c | 20 +++++------
sys/compat/linux/common/linux_misc.c | 19 +++++------
sys/compat/linux32/common/linux32_wait.c | 13 +++----
sys/compat/netbsd32/netbsd32_compat_50.c | 16 ++++-----
sys/compat/netbsd32/netbsd32_wait.c | 16 ++++-----
sys/compat/osf1/osf1_misc.c | 10 +++---
sys/compat/svr4/svr4_misc.c | 13 +++----
sys/compat/svr4_32/svr4_32_misc.c | 13 +++----
sys/kern/kern_exit.c | 51 +++++++++++++------------------
sys/sys/proc.h | 4 +-
13 files changed, 99 insertions(+), 125 deletions(-)
diffs (truncated from 606 to 300 lines):
diff -r fc8f201fc163 -r 8a2ba397e3a8 sys/compat/common/kern_exit_43.c
--- a/sys/compat/common/kern_exit_43.c Wed Nov 04 20:38:58 2009 +0000
+++ b/sys/compat/common/kern_exit_43.c Wed Nov 04 21:23:02 2009 +0000
@@ -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;
diff -r fc8f201fc163 -r 8a2ba397e3a8 sys/compat/common/kern_time_50.c
--- a/sys/compat/common/kern_time_50.c Wed Nov 04 20:38:58 2009 +0000
+++ b/sys/compat/common/kern_time_50.c Wed Nov 04 21:23:02 2009 +0000
@@ -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)
diff -r fc8f201fc163 -r 8a2ba397e3a8 sys/compat/ibcs2/ibcs2_misc.c
--- a/sys/compat/ibcs2/ibcs2_misc.c Wed Nov 04 20:38:58 2009 +0000
+++ b/sys/compat/ibcs2/ibcs2_misc.c Wed Nov 04 21:23:02 2009 +0000
@@ -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;
diff -r fc8f201fc163 -r 8a2ba397e3a8 sys/compat/irix/irix_signal.c
--- a/sys/compat/irix/irix_signal.c Wed Nov 04 20:38:58 2009 +0000
+++ b/sys/compat/irix/irix_signal.c Wed Nov 04 21:23:02 2009 +0000
@@ -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;
}
diff -r fc8f201fc163 -r 8a2ba397e3a8 sys/compat/linux/common/linux_misc.c
--- a/sys/compat/linux/common/linux_misc.c Wed Nov 04 20:38:58 2009 +0000
+++ b/sys/compat/linux/common/linux_misc.c Wed Nov 04 21:23:02 2009 +0000
@@ -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;
+ int error, status, options, linux_options, pid = SCARG(uap, pid);
+ struct rusage50 ru50;
struct rusage ru;
- struct rusage50 ru50;
- int pid = SCARG(uap, pid);
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);
diff -r fc8f201fc163 -r 8a2ba397e3a8 sys/compat/linux32/common/linux32_wait.c
--- a/sys/compat/linux32/common/linux32_wait.c Wed Nov 04 20:38:58 2009 +0000
+++ b/sys/compat/linux32/common/linux32_wait.c Wed Nov 04 21:23:02 2009 +0000
@@ -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;
diff -r fc8f201fc163 -r 8a2ba397e3a8 sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c Wed Nov 04 20:38:58 2009 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c Wed Nov 04 21:23:02 2009 +0000
@@ -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 $ */
/*-
Home |
Main Index |
Thread Index |
Old Index