HomeFreeBSD

jobc: rework detection of orphaned groups.

Description

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

Details

Provenance
kibAuthored on Dec 29 2020, 12:41 AM
Reviewer
jilles
Differential Revision
D27871: Rework jobc handling.
Parents
rGcf4f802e77a3: kinfo_proc: move job-control related data collection into a new helper.
Branches
Unknown
Tags
Unknown