[Bug 293871] procctl: add PROC_REAP_STATUS_EX for extended reaper subtree introspection

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 17 Mar 2026 05:18:21 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293871

            Bug ID: 293871
           Summary: procctl: add PROC_REAP_STATUS_EX for extended reaper
                    subtree introspection
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: rikka.goering@outlook.de

Created attachment 268877
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=268877&action=edit
procctl: add extended reaper status query

This patch adds a new procctl(2) operation, PROC_REAP_STATUS_EX, to provide
extended introspection of existing reaper-managed process trees.

The current PROC_REAP_STATUS interface remains unchanged for compatibility.
The new PROC_REAP_STATUS_EX query returns additional information about the
target process, including:

- owning reaper PID
- subtree identifier
- real parent PID
- whether the process is a direct child of its reaper
- whether the process is itself a reaper
- for reaper processes, the number of direct children and tracked descendants

The patch also updates procctl(2) to document the new operation and its
associated structure and flags.

Motivation:
The existing reaper infrastructure already tracks subtree relationships, but
userland has only limited visibility into them. This change provides a small,
opt-in extension for userland tools that need more detailed process-tree
introspection.

Testing:
- Built and booted a kernel containing the change on FreeBSD-CURRENT.
- Verified that ordinary processes report the expected init-rooted reaper
state.
- Verified that a process after PROC_REAP_ACQUIRE reports itself as a reaper.
- Verified that direct children and grandchildren report the expected reaper
and
  subtree values.
- Included a small userland C test program as an attachment for reviewer use.

This is intended as a focused introspection improvement; it does not modify the
behavior of existing reaper operations.

-- 
You are receiving this mail because:
You are the assignee for the bug.