path: root/lib/libkvm
diff options
authorKonstantin Belousov <kib@FreeBSD.org>2020-12-29 00:41:56 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-01-10 02:41:20 +0000
commit5844bd058aed6f3d0c8cbbddd6aa95993ece0189 (patch)
tree9b8ba905dde5677029bcd7b9c210fd439b0abf33 /lib/libkvm
parentcf4f802e77a3a438bce5335b67c88ac6f0e21a6e (diff)
jobc: rework detection of orphaned groups.
Instead of trying to maintain pg_jobc counter on each process group update (and sometimes before), just calculate the counter when needed. Still, for the benefit of the signal delivery code, explicitly mark orphaned groups as such with the new process group flag. This way we prevent bugs in the corner cases where updates to the counter were missed due to complicated configuration of p_pptr/p_opptr/real_parent (debugger). Since we need to iterate over all children of the process on exit, this change mostly affects the process group entry and leave, where we need to iterate all process group members to detect orpaned status. (For MFC, keep pg_jobc around but unused). Reported by: jhb Reviewed by: jilles Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27871
Diffstat (limited to 'lib/libkvm')
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 71cfd5f1629b..63f7c2a8a824 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -273,7 +273,7 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p,
return (-1);
kp->ki_pgid = pgrp.pg_id;
- kp->ki_jobc = pgrp.pg_jobc;
+ kp->ki_jobc = -1; /* Or calculate? Arguably not. */
if (KREAD(kd, (u_long)pgrp.pg_session, &sess)) {
_kvm_err(kd, kd->program, "can't read session at %p",