git: 404eeb14f957 - stable/15 - procdesc: report NOTE_PDSIGCHLD for traced and stopped process
Konstantin Belousov <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.devel.stable.scm |
|---|---|
| Message-ID | <[email protected]> |
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=404eeb14f95788b1cf3d1bbac2cb50b30dfcc622 commit 404eeb14f95788b1cf3d1bbac2cb50b30dfcc622 Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-07-18 17:31:31 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-08-16 02:41:33 +0000 procdesc: report NOTE_PDSIGCHLD for traced and stopped process (cherry picked from commit b328975b9d7c475cd99107ca407df04366cc38af) --- sys/kern/sys_procdesc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 610423f49fe9..6eed8c7f0267 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -493,16 +493,25 @@ static int procdesc_kqops_event(struct knote *kn, long hint) { struct procdesc *pd; + struct proc *p; u_int event; pd = kn->kn_fp->f_data; if (hint == 0) { /* * Initial test after registration. Generate notes in - * case the process already terminated before registration. + * case the process already terminated before + * registration, or is stopped, or traced, with an event + * pending. */ - event = (pd->pd_flags & PDF_EXITED) != 0 ? (NOTE_EXIT | - NOTE_PDSIGCHLD) : 0; + p = pd->pd_proc; + if ((pd->pd_flags & PDF_EXITED) != 0) + event = NOTE_EXIT | NOTE_PDSIGCHLD; + else if ((atomic_load_int(&p->p_flag) & (P_STOPPED_SIG | + P_STOPPED_TRACE)) != 0) + event = NOTE_PDSIGCHLD; + else + event = 0; } else { /* Mask off extra data. */ event = (u_int)hint & NOTE_PCTRLMASK;