summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1997-09-13 19:42:29 +0000
committerjoerg <joerg@FreeBSD.org>1997-09-13 19:42:29 +0000
commitb3004b96f00018abb27dfa6435afa6c1364781a4 (patch)
treebe70b05473d1f2b81f048889bba4ac06515bd98e /sys/kern/kern_sig.c
parent1fe98f376a10db06be4e190a5a72e8667af43b4b (diff)
downloadFreeBSD-src-b3004b96f00018abb27dfa6435afa6c1364781a4.zip
FreeBSD-src-b3004b96f00018abb27dfa6435afa6c1364781a4.tar.gz
Implement SA_NOCLDWAIT.
The implementation is done (unlike what i've originally been contemplating) by reparenting kids of processes that have the appropriate bit set to PID 1, and let PID 1 handle the zombie. This is far less problematical than what would seem to be ``doing it right'', for a number of reasons. Of our currently shipping PID-1-intended programs, 50 % fail the above assumption. ;-) (Read this: sysinstall doesn't do it right. This is no problem as long as no program called by sysinstall actually uses SA_NOCLDWAIT.) ToDo: . clarify the correct SA_* flag inheritance, compared to other systems, . decide whether the compat cruft (osigvec(9)) should deal with new system additions or not, . merge OpenBSD's SA_SIGINFO implementation. ;) Reviewed by: bde
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index b73503e..fb78d3e 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
- * $Id: kern_sig.c,v 1.32 1997/08/26 00:31:04 bde Exp $
+ * $Id: kern_sig.c,v 1.33 1997/09/02 20:05:41 bde Exp $
*/
#include "opt_ktrace.h"
@@ -123,6 +123,8 @@ sigaction(p, uap, retval)
sa->sa_flags |= SA_NODEFER;
if (signum == SIGCHLD && p->p_flag & P_NOCLDSTOP)
sa->sa_flags |= SA_NOCLDSTOP;
+ if (signum == SIGCHLD && p->p_flag & P_NOCLDWAIT)
+ sa->sa_flags |= SA_NOCLDWAIT;
if ((error = copyout((caddr_t)sa, (caddr_t)uap->osa,
sizeof (vec))))
return (error);
@@ -182,6 +184,19 @@ setsigvec(p, signum, sa)
p->p_flag |= P_NOCLDSTOP;
else
p->p_flag &= ~P_NOCLDSTOP;
+ if (sa->sa_flags & SA_NOCLDWAIT) {
+ /*
+ * Paranoia: since SA_NOCLDWAIT is implemented by
+ * reparenting the dying child to PID 1 (and
+ * trust it to reap the zombie), PID 1 itself is
+ * forbidden to set SA_NOCLDWAIT.
+ */
+ if (p->p_pid == 1)
+ p->p_flag &= ~P_NOCLDWAIT;
+ else
+ p->p_flag |= P_NOCLDWAIT;
+ } else
+ p->p_flag &= ~P_NOCLDWAIT;
}
/*
* Set bit in p_sigignore for signals that are set to SIG_IGN,
OpenPOWER on IntegriCloud