path: root/sys/sys/proc.h
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 /sys/sys/proc.h
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 'sys/sys/proc.h')
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 2a7f0740a0c3..99257878c2e0 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -111,10 +111,12 @@ struct pgrp {
struct session *pg_session; /* (c) Pointer to session. */
struct sigiolst pg_sigiolst; /* (m) List of sigio sources. */
pid_t pg_id; /* (c) Process group id. */
- int pg_jobc; /* (m) Job control process count. */
struct mtx pg_mtx; /* Mutex to protect members */
+ int pg_flags; /* (m) PGRP_ flags */
+#define PGRP_ORPHANED 0x00000001 /* Group is orphaned */
* pargs, used to hold a copy of the command line, if it had a sane length.