Repository navigation
feat(libkernel): report no child processes from waitpid - #2123
Conversation
|
I reviewed the full diff and checked the behavior against the cited FreeBSD implementation. The full diff has useful option, pid-form and untouched-status coverage, and no duplicate open PR implements |
|
Thanks for checking it against
|
|
Two things before this can go in:
|
|
Checked on current
|
|
I rebuilt the PR changes on current upstream I also shortened the Tested on Linux / WSL2 Ubuntu 24.04:
AI-assisted: yes. (Codex) Clean branch: Feel free to cherry-pick or reuse the branch if useful. I can keep it rebased on current |
|
Rebased onto Checked on the rebased head: build + ctest of libkernel/libs green, including |
72a9ca4 to
de10146
Compare
waitpid returns -1 with ECHILD, or EINVAL for an option FreeBSD does not know, and leaves the status unwritten: AnyPS5 runs the title as one process and exports nothing that creates a child. VLC PPSA85300 stops on main at this import.
…d without a status Unknown options are now checked for every pid, with 0x80 and 0x80000040 added, and so are valid combinations such as WNOHANG | WUNTRACED. Each call is repeated with a null status. The TechnicalDebt entry cites kern_wait, which adds WEXITED and WTRAPPED, and lists pdfork.
…om lines open pull requests change waitpid now sits between exit and _exit, and its TechnicalDebt entry follows the packed horizontal gathers entry, so the open system and getuid pull requests and the thread cancellation test pull request no longer touch the same lines.
Requested by @oneandonlydean in review.
de10146 to
8de5e70
Compare
What
Exports
waitpid(NIDdTnYqqLIQ6c) from libkernel. AnyPS5 runs the title as one host process and exports nothing that creates a child (fork,vfork,rfork,posix_spawn), sowaitpidanswers the way FreeBSD 11's kernel does for a process without children:WNOHANG,WUNTRACED,WCONTINUED,WNOWAIT,WEXITED,WTRAPPEDandWLINUXCLONEreturn -1 witherrnoEINVAL(kern_wait6, L1206-L1209).ECHILD, whatever the pid and with or withoutWNOHANG. The kernel finds no child or orphan before it looks atWNOHANG(L1307-L1314).waitpidaddsWEXITED | WTRAPPED(L1146), so the "no events to wait for"EINVALcannot happen.wait4copies it out only when a child was reaped (L771-L772).wait4a cancellation point. No cancel request is ever pending here (Thread cancellation in TechnicalDebt), so returning at once matches.waitpid.VLC (PPSA85300) is a port of VLC 3.0.24 and never has a child on the console either. Its compat layer makes
forkandvforkfail withENOSYSas "Features the PS5 doesn't have" (libc_missing.c L290-L292). Its netconf patch drops VLC's libproxy helper because "a title can't start programs (posix_spawnp crashed the app ...)" (0006-netconf-ps5-no-proxy-helper.patch L8-L11).Other titles that import
waitpid:tcgetattr(feat(libkernel): implement tcgetattr and tcsetattr #1738).dup(feat(libkernel): implement dup #1855).VLC 0.2, from its GitHub release (its listing in the homebrew catalog is pending), relinked with
--windowsand run on Windows 10:maind70b899:FAIL: unresolved ELF import dTnYqqLIQ6c from libkernel.prx(waitpid)main+ this PR:FAIL: unresolved ELF import 0NJDcQ2B8vE from libkernel.prx(execvp, left for its own PR)VLC 0.1 stops at the same two imports.
Tested
guest_waitpidtest, registered in ctest with a 20 s timeout. Every case is run twice, once with a status pointer and once with a null one.errnois cleared before each call, and every call must return -1 and leave the status untouched.WNOHANG | WUNTRACEDandWNOHANG | WLINUXCLONE, and all known bits. Every call must giveerrno10 (ECHILD).EINVAL).15.2.0posix-14.0.0-ucrt-r7), Release, merged withmaind70b899: passes (--repeat until-fail:3), and so does the full suite. The NID-patchedlibkernel.prxexports the NID.ANYPS5_ENABLE_SPIRV_TOOLS=ON, merged withmaind70b899: passes (--repeat until-fail:3), and so does the full suite. The NID-patchedlibkernel.prxexports the NID.WNOHANG;EINVAL;WNOHANG,WNOWAIT,WTRAPPEDorWLINUXCLONE, or accepting 0x40, 0x80 or 0x40000000;EINVALchecked only for pid -1, orWNOHANG | WUNTRACEDrejected;errnoalone, or returning 0 forWNOHANG;ESRCHfor a positive pid, orEINVALfor a process group;errnovalues off by one.tools/check_conventions.pyandtools/check_test_registration.pypass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)