Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys PR/19837: Stephen Ma: signal(SIGCHLD, SIG_IGN) should no...



details:   https://anonhg.NetBSD.org/src/rev/6bcc257d8e0f
branches:  trunk
changeset: 579885:6bcc257d8e0f
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 30 17:07:50 2005 +0000

description:
PR/19837: Stephen Ma: signal(SIGCHLD, SIG_IGN) should not create zombies.

diffstat:

 sys/kern/kern_exit.c |   6 +++---
 sys/kern/kern_sig.c  |  16 ++++++++++++++--
 sys/sys/proc.h       |   3 ++-
 3 files changed, 19 insertions(+), 6 deletions(-)

diffs (81 lines):

diff -r c7b4d105bf71 -r 6bcc257d8e0f sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c      Wed Mar 30 16:34:54 2005 +0000
+++ b/sys/kern/kern_exit.c      Wed Mar 30 17:07:50 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exit.c,v 1.145 2005/02/26 21:34:55 perry Exp $    */
+/*     $NetBSD: kern_exit.c,v 1.146 2005/03/30 17:07:50 christos Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.145 2005/02/26 21:34:55 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.146 2005/03/30 17:07:50 christos Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_perfctrs.h"
@@ -466,7 +466,7 @@
         * flag set, notify init instead (and hope it will handle
         * this situation).
         */
-       if (q->p_flag & P_NOCLDWAIT) {
+       if (q->p_flag & (P_NOCLDWAIT|P_CLDSIGIGN)) {
                proc_reparent(p, initproc);
 
                /*
diff -r c7b4d105bf71 -r 6bcc257d8e0f sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Wed Mar 30 16:34:54 2005 +0000
+++ b/sys/kern/kern_sig.c       Wed Mar 30 17:07:50 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.202 2005/02/26 21:34:55 perry Exp $     */
+/*     $NetBSD: kern_sig.c,v 1.203 2005/03/30 17:07:51 christos Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.202 2005/02/26 21:34:55 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.203 2005/03/30 17:07:51 christos Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_sunos.h"
@@ -361,6 +361,18 @@
                                        p->p_flag |= P_NOCLDWAIT;
                        } else
                                p->p_flag &= ~P_NOCLDWAIT;
+
+                       if (nsa->sa_handler == SIG_IGN) {
+                               /*
+                                * Paranoia: same as above.
+                                */
+                               if (p->p_pid == 1)
+                                       p->p_flag &= ~P_CLDSIGIGN;
+                               else
+                                       p->p_flag |= P_CLDSIGIGN;
+                       } else
+                               p->p_flag &= ~P_CLDSIGIGN;
+                               
                }
                if ((nsa->sa_flags & SA_NODEFER) == 0)
                        sigaddset(&SIGACTION_PS(ps, signum).sa_mask, signum);
diff -r c7b4d105bf71 -r 6bcc257d8e0f sys/sys/proc.h
--- a/sys/sys/proc.h    Wed Mar 30 16:34:54 2005 +0000
+++ b/sys/sys/proc.h    Wed Mar 30 17:07:50 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: proc.h,v 1.198 2005/03/26 05:12:36 fvdl Exp $  */
+/*     $NetBSD: proc.h,v 1.199 2005/03/30 17:07:51 christos Exp $      */
 
 /*-
  * Copyright (c) 1986, 1989, 1991, 1993
@@ -292,6 +292,7 @@
 #define        P_FSTRACE       0x00010000 /* Debugger process being traced by procfs */
 #define        P_NOCLDWAIT     0x00020000 /* No zombies if child dies */
 #define        P_32            0x00040000 /* 32-bit process (used on 64-bit kernels) */
+#define        P_CLDSIGIGN     0x00080000 /* Process is ignoring SIGCHLD */
 #define        P_INEXEC        0x00100000 /* Process is exec'ing and can't be traced */
 #define        P_SYSTRACE      0x00200000 /* Process system call tracing active */
 #define        P_CHTRACED      0x00400000 /* Child has been traced & reparented */



Home | Main Index | Thread Index | Old Index