git: b328975b9d7c - main - procdesc: report NOTE_PDSIGCHLD for traced and stopped process
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Jul 2026 02:00:31 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=b328975b9d7c475cd99107ca407df04366cc38af
commit b328975b9d7c475cd99107ca407df04366cc38af
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-07-18 17:31:31 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-07-20 02:00:02 +0000
procdesc: report NOTE_PDSIGCHLD for traced and stopped process
on attach of the knote. It is same as for NOTE_EXIT when attaching to
the exiting process.
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58327
---
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 fd4b660d6afa..94c2df4b1e69 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;