]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
jobc: rework detection of orphaned groups.
authorKonstantin Belousov <kib@FreeBSD.org>
Tue, 29 Dec 2020 00:41:56 +0000 (02:41 +0200)
committerKonstantin Belousov <kib@FreeBSD.org>
Sun, 10 Jan 2021 02:41:20 +0000 (04:41 +0200)
commit5844bd058aed6f3d0c8cbbddd6aa95993ece0189
tree9b8ba905dde5677029bcd7b9c210fd439b0abf33
parentcf4f802e77a3a438bce5335b67c88ac6f0e21a6e
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
lib/libkvm/kvm_proc.c
sys/kern/kern_proc.c
sys/kern/kern_sig.c
sys/kern/tty.c
sys/sys/proc.h