summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_misc.c
diff options
context:
space:
mode:
authorerh <erh@NetBSD.org>2004-10-07 19:30:28 +0000
committererh <erh@NetBSD.org>2004-10-07 19:30:28 +0000
commitf747989e34ae5dcad60eaddc617f20b598e95338 (patch)
treedda83dcd58ecd508ceea0961abb173deca243867 /sys/compat/linux/common/linux_misc.c
parent8f36adaafb52592d86744385b035c230842b6308 (diff)
PR kern/27184: Have linux_sys_waitpid() call linux_sys_wait4() so the
supported options can't get out of sync. This add support for the linux __WCLONE and __WALL options (NetBSD version: WALTSIG and WALLSIG) Add a diagnostic check to see if the one unhandled option (__WNOTHREAD) is specified. This should prevent linux processes from losing their children and creating tons of zombie processes.
Diffstat (limited to 'sys/compat/linux/common/linux_misc.c')
-rw-r--r--sys/compat/linux/common/linux_misc.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c
index d5a34260f55..792a07e459e 100644
--- a/sys/compat/linux/common/linux_misc.c
+++ b/sys/compat/linux/common/linux_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.132 2004/09/20 18:41:07 jdolecek Exp $ */
+/* $NetBSD: linux_misc.c,v 1.133 2004/10/07 19:30:28 erh Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.132 2004/09/20 18:41:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.133 2004/10/07 19:30:28 erh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -199,7 +199,9 @@ bsd_to_linux_wstat(st)
}
/*
- * This is very much the same as waitpid()
+ * wait4(2). Passed on to the NetBSD call, surrounded by code to
+ * reserve some space for a NetBSD-style wait status, and converting
+ * it to what Linux wants.
*/
int
linux_sys_wait4(l, v, retval)
@@ -226,9 +228,7 @@ linux_sys_wait4(l, v, retval)
linux_options = SCARG(uap, options);
options = 0;
- if (linux_options &
- ~(LINUX_WAIT4_WNOHANG|LINUX_WAIT4_WUNTRACED|LINUX_WAIT4_WALL|
- LINUX_WAIT4_WCLONE))
+ if (linux_options & ~(LINUX_WAIT4_KNOWNFLAGS))
return (EINVAL);
if (linux_options & LINUX_WAIT4_WNOHANG)
@@ -239,6 +239,13 @@ linux_sys_wait4(l, v, retval)
options |= WALLSIG;
if (linux_options & LINUX_WAIT4_WCLONE)
options |= WALTSIG;
+#ifdef DIAGNOSTIC
+ if (linux_options & LINUX_WAIT4_WNOTHREAD)
+ printf("WARNING: %s: linux process %d.%d called "
+ "waitpid with __WNOTHREAD set!",
+ __FILE__, p->p_pid, l->l_lid);
+
+#endif
SCARG(&w4a, pid) = SCARG(uap, pid);
SCARG(&w4a, status) = status;