svn commit: r309886 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Mon Dec 12 11:11:51 UTC 2016
Author: kib
Date: Mon Dec 12 11:11:50 2016
New Revision: 309886
URL: https://svnweb.freebsd.org/changeset/base/309886
Log:
When a zombie gets reparented due to the parent exit, send SIGCHLD to
the reaper.
The traditional reaper init(8) is aware of zombies silently reparented
to it after the parents exit, it loops around waitpid(2) to collect
them. For other reapers, the silent reparenting is surprising and
collecting zombies requires a thread blocking in waitpid(2) just for
that purpose. It seems that sending second SIGCHLD is a better
workaround than forcing all reapers to obey the setup.
Reported by: Michael Zuo <muh.muhten at gmail.com>, jilles
PR: 213928
Reviewed by: jilles (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Modified:
head/sys/kern/kern_exit.c
Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c Mon Dec 12 11:04:22 2016 (r309885)
+++ head/sys/kern/kern_exit.c Mon Dec 12 11:11:50 2016 (r309886)
@@ -455,6 +455,11 @@ exit1(struct thread *td, int rval, int s
if (!(q->p_flag & P_TRACED)) {
proc_reparent(q, q->p_reaper);
+ if (q->p_state == PRS_ZOMBIE) {
+ PROC_LOCK(q->p_reaper);
+ pksignal(q->p_reaper, SIGCHLD, q->p_ksi);
+ PROC_UNLOCK(q->p_reaper);
+ }
} else {
/*
* Traced processes are killed since their existence
More information about the svn-src-head
mailing list