NOTE_TRACK, EVFILT_PROC, kqueue, and subreapers
Konstantin Belousov
kostikbel at gmail.com
Sun Dec 11 17:54:57 UTC 2016
On Sun, Dec 11, 2016 at 01:46:38PM +0100, Jilles Tjoelker wrote:
> As reported in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213928
> reapers do not receive SIGCHLD when inheriting zombies, although they do
> receive SIGCHLD when an inherited descendant process later terminates
> and are awakened when in a wait call for a matching process. This should
> probably be fixed.
I agree, in principle. Could you update your tests/sys/kern/reaper.c to
include this scenario ?
Untested change to the kernel side is below.
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index f4f453c3556..92899740eef 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -455,6 +455,12 @@ exit1(struct thread *td, int rval, int signo)
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);
+ wakeup(q->p_reaper);
+ PROC_UNLOCK(q->p_reaper);
+ }
} else {
/*
* Traced processes are killed since their existence
More information about the freebsd-hackers
mailing list