Skip to content

feat(wrap): fallback proc scan for first_child_pid_of#92

Draft
noeljackson wants to merge 1 commit intoedera-dev:mainfrom
noeljackson:feat/child-pid-fallback
Draft

feat(wrap): fallback proc scan for first_child_pid_of#92
noeljackson wants to merge 1 commit intoedera-dev:mainfrom
noeljackson:feat/child-pid-fallback

Conversation

@noeljackson
Copy link

Summary

Add a fallback /proc scan to first_child_pid_of() for kernels without CONFIG_PROC_CHILDREN=y.

Problem

first_child_pid_of() reads /proc/<pid>/task/<pid>/children to find the supervised child process. This file only exists when the kernel is built with CONFIG_PROC_CHILDREN=y, which is not always the case (e.g., some minimal or custom kernel configs for Xen PV guests). When the file is missing, attach operations fail entirely.

Solution

  1. Try the fast path first (/proc/<pid>/task/<pid>/children).
  2. If that file doesn't exist or is empty, fall back to scanning /proc for numeric directories and checking each process's /proc/<pid>/status for a PPid: line matching the parent.
  3. Improved error message includes the parent PID and which methods were tried.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant