Repository navigation
fix(libkernel): resolve kern.proc.proc by name - #14591
Conversation
sysctl serves {1, 14, 8} since boykopovar#13532, but sysctlbyname and sysctlnametomib still returned ENOENT for kern.proc.proc. Map the name to the same MIB, as FreeBSD's name lookup does.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The name lookup maps to the existing {1, 14, 8} handler, and the added tests cover named/numeric equivalence plus the relevant size, short-buffer, and write cases.
What I ran
Reviewed exact head 00f69414ba3401fa71c394f733d86715fd7334bf against PR base/current main f2d874c1fdccf781c0fa5d86619bb5dd8894b958; the merge preview completed cleanly. Environment: Debian GNU/Linux 12, Python 3.11.2; no build or compiler run.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14591
python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 00f69414ba3401fa71c394f733d86715fd7334bf --title 'fix(libkernel): resolve kern.proc.proc by name' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/pr-body.md
git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...00f69414ba3401fa71c394f733d86715fd7334bf
git merge-tree --write-tree f2d874c1fdccf781c0fa5d86619bb5dd8894b958 00f69414ba3401fa71c394f733d86715fd7334bf
gh pr checks 14591 -R boykopovar/AnyPS5Results
| Check | Result |
|---|---|
| Diff check | Passed; no whitespace errors. |
| Conventions and PR template | Passed. |
| Merge preview | Clean against current main. |
| Test registration | Confirmed: GuestSystemConfiguration.cpp is registered by the libkernel CMake file. |
| Source behavior | FreeBSD 11.4 registers proc under kern.proc as MIB value 8; the existing AnyPS5 handler accepts {1, 14, 8}. |
| PR precheck | Diff, conventions, and dependency/mergeability checks passed. Its ABI and test-quality helper steps could not run because those workspace-local scripts are absent from the PR snapshot. |
| Hosted CI | Still queued when checked. |
| C++ test run | Not run locally. The PR description reports three passing Release runs on Ubuntu 24.04/WSL2; that result is author-reported, not independently reproduced here. |
Unedited selected command output
git diff --check:
[no output; exit status 0]
Conventions:
All conventions checks passed.
Merge preview:
6a094365710ea6d3307ce138d2268e08951e719b
Hosted checks:
conventions pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062421/job/124903164690
eligibility pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062493/job/124903163631
intake pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062391/job/124903164580
labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062394/job/124903164490
library-portability pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062415/job/124903163420
report pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062503/job/124903163877
The precheck reported these unavailable helper scripts in the detached PR snapshot:
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/head-00f69414ba34-24316de3/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/head-00f69414ba34-24316de3/tools/pr_test_quality.py': [Errno 2] No such file or directory
Sources
- The new lookup and MIB entry at the reviewed head
- The existing handler and tests at the reviewed head
- FreeBSD 11.4
kern.proc.procregistration - FreeBSD 11.4
sysctlbynamedispatch through name-to-MIB lookup
Not verified
I did not build or run CTest locally, and hosted checks were pending. No console or title behavior was tested.
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release,
AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
A Windows run with GCC 16: Windows 10.0.22631 (Windows 11), i9-9900K, MSYS2 UCRT64 GCC 16.1.0 (Rev5), Release, this PR (
Looks good on Windows 👍 AI-assisted: yes (Claude Code) |
What
#13532 added
sysctl{1, 14, 8} (kern.proc.proc), but the name paths were never wired up, sosysctlbyname("kern.proc.proc")andsysctlnametomib("kern.proc.proc")still return -1 withENOENT.kern.proc.pathnamealready has both.This maps the name to {1, 14, 8} in both places, the way FreeBSD 11.4 does it:
kern_proc.cregisters the node asprocunderkern.proc, andsysctlbynameis just the name lookup plus a numericsysctl. So the name reaches the existing handler with 3 elements, whichsysctl_kern_procaccepts forKERN_PROC_PROC.No new behaviour in the handler. The open gaps in the
kern.proc.procdebt entry (one process, record size, size estimate) apply the same way to the name, so the entry stays as is. I don't know of a title that asks for this by name; it just closes the name/number mismatch #13532 left.Tested
Ubuntu 24.04 on WSL2, GCC 13.3, Release build.
guest_system_configuration: fails onmainwith the new checks (aborts at the named size query, and at thesysctlnametomibtable row with only thesysctlbynamechange), passes with the fix, 3 runs.ENOMEMon a 100-byte buffer (length kept),EPERMon a write, and thesysctlnametomibMIB {1, 14, 8} with size 3.public_headers: pass.python3 tools/check_conventions.py --base origin/main: pass.Overlap:
tools/pr_overlap.py --branchreports no overlap with the 1,790 open PRs. A paginatedpulls/filesscan lists both files in 14 old PRs (#9588, #9688, #10113, #10226, #10229, #10247, #10317, #10349, #10351, #10469, #10492, #12053, #12299, #12598), but that's main's history showing through their old base: at each head both files have the same blob as at its merge base with main, so none of them changessysctlbyname,sysctlnametomib,CheckProcessListSysctlorCheckNameToMib.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)