dragonfly-SIGCHLD.patch

proposed patch - matthiasr, 04/17/2012 02:42 PM

Download (2.84 KB)

View differences:

sys/kern/kern_exit.c
534 534
	KNOTE(&p->p_klist, NOTE_EXIT);
535 535

  
536 536
	/*
537
	 * Notify parent that we're gone.  If parent has the PS_NOCLDWAIT
538
	 * flag set, notify process 1 instead (and hope it will handle
539
	 * this situation).
537
         * Notify parent that we're gone.  If parent has the PS_NOCLDWAIT
538
         * flag set, or if the handler is set to SIG_IGN, notify process 1
539
         * instead (and hope it will handle this situation).
540 540
	 */
541
	if (p->p_pptr->p_sigacts->ps_flag & PS_NOCLDWAIT) {
541
	if (p->p_pptr->p_sigacts->ps_flag &
542
                (PS_NOCLDWAIT | PS_CLDSIGIGN)) {
542 543
		struct proc *pp = p->p_pptr;
543 544

  
544 545
		PHOLD(pp);
sys/kern/kern_sig.c
321 321
			} else {
322 322
				p->p_sigacts->ps_flag &= ~PS_NOCLDWAIT;
323 323
			}
324
                        if (ps->ps_sigact[_SIG_IDX(SIGCHLD)] == SIG_IGN)
325
                                ps->ps_flag |= PS_CLDSIGIGN;
326
                        else
327
                                ps->ps_flag &= ~PS_CLDSIGIGN;
324 328
		}
325 329
		/*
326 330
		 * Set bit in p_sigignore for signals that are set to SIG_IGN,
......
433 437
	/*
434 438
	 * Reset no zombies if child dies flag as Solaris does.
435 439
	 */
436
	p->p_sigacts->ps_flag &= ~PS_NOCLDWAIT;
440
	p->p_sigacts->ps_flag &= ~(PS_NOCLDWAIT | PS_CLDSIGIGN);
441
        if (ps->ps_sigact[_SIG_IDX(SIGCHLD)] == SIG_IGN)
442
                ps->ps_sigact[_SIG_IDX(SIGCHLD)] = SIG_DFL;
437 443
}
438 444

  
439 445
/*
sys/sys/param.h
90 90
 * 300100 - 3.1 master
91 91
 * 300101 - i4b (ISDN) removal
92 92
 * 300102 - <sys/ata.h> is now just a link of <sys/nata.h>
93
 * 300103 - if SIG_IGN is set on SIGCHLD, do not keep zombie children
93 94
 */
94 95
#undef __DragonFly_version
95
#define __DragonFly_version 300102	/* propagated to newvers */
96
#define __DragonFly_version 300103	/* propagated to newvers */
96 97

  
97 98
#include <sys/_null.h>
98 99

  
sys/sys/proc.h
112 112

  
113 113
#define	PS_NOCLDWAIT	0x0001	/* No zombies if child dies */
114 114
#define	PS_NOCLDSTOP	0x0002	/* No SIGCHLD when children stop. */
115
#define	PS_CLDSIGIGN    0x0004  /* The SIGCHLD handler is SIG_IGN. */
115 116

  
116 117
/*
117 118
 * pargs, used to hold a copy of the command line, if it had a sane