feat(libkernel_sys): implement wait3 and wait4 #9162

Merged
yabanana merged 16 commits from upstream-pr/9162 into main 2026-11-11 22:06:11 +00:00
yabanana commented 2026-10-21 14:05:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by yabanana on 2026-10-21T14:05:00Z.


What

Replace the wait3/wait4 discovery stubs with typed public declarations and one shared wait backend. wait3 selects any child; wait4 passes the selection through. The integration with main's new posix_spawn support retains option validation, guest child-status translation and no-child/WNOHANG output preservation.

Linux wait4 collects the actual child's resource usage and converts it through the same field conversion as getrusage. Status and resource outputs use the existing checked guest writes. Windows reaps supported children when usage is null; resource accounting for a completed child is unimplemented and throws before closing its handle or removing it from the registry. The child remains recoverable by a later supported wait. This limitation is recorded in technical debt; no successful accounting result is fabricated.

The prior single-process description no longer applies after main added child creation. The updated fixture covers real child exit, WNOHANG, returned resources and invalid output pointers, in addition to no-child and option precedence. Linux INT_MIN follows the shared provider's host ESRCH case, documented by Linux wait(2); this is not a PS5 selector-error claim.

Export/NID presence: PS5 SDK stub table. Signatures and wait3/wait4 relationship: FreeBSD 11.4 wait(2). Console behaviour is unverified.

Tested

11 November update at 289b8c3cd55c86588f55266cda63e5e9834b0e14. Merged main bf8094d980 and retained the wait accounting entry alongside upstream's revised debt notes. The integration preview is clean against 54c20307dc. All 12 focused Linux executions pass, including both wait3/wait4 library modes and the process suites. Tested with SHA256-verified binaries built with GCC 13.3 and run in a full Alpine 6.12.110 x86_64 kernel under QEMU TCG with SMAP off. All 39 web tests, conventions and whitespace checks pass. Hosted checks are pending for this head.

9 November refresh at c5f45829697e7f0c22d063232789a42bf612b461 with main 67092e70b5211ed86d7a15e22cd10bca651901f5 merged. The merge retains upstream’s macOS thread accounting and uses the shared ResourceUsage conversion for getrusage and wait4. The four prior relinker jobs failed on web_library_assets. I reproduced the missing mimalloc fixture on their base 5299939 without the PR. The refreshed branch includes upstream fix 0c4dc6db47.

12 focused Linux full-kernel executions pass, including both wait modes, posix_spawn and getrusage. The macOS x86_64 syntax check of Process.cpp passes with the existing C-linkage warnings. All 39 web packaging tests, conventions, whitespace and the public-header audit (407 libraries and 33,818 exports) pass. Linux results use GCC 13.3 and a full Alpine 6.12.110 kernel under QEMU TCG with SMAP off, with fresh SHA256-verified binaries. macOS checks use macOS 27.3 and Apple clang 21 on ARM64 with an x86_64 target. New hosted checks are pending.

6 November: head 75950dc455113913a6913c363547176964fe2ad1 resolves the sole current-main conflict by adopting upstream maintainer commit df959bf14b with its authorship. MulxLoweringTests.cpp now exactly matches main e64c194c43. The wait provider is unchanged. Fresh macOS27.2/Appleclang21 Release x86_64 build through Rosetta passes MULX10 consecutive times (5.15s total), retaining all flag checks, cases, generated instructions and timeouts. Current-main merge preview, conventions and whitespace pass. This resolves the diagnostic conflict; the historical runner mismatch still has no demonstrated cause. New hosted CI is pending.

4 November update: head 350fa008de66b026ff5593f219c7a8923b72310c, main b11c7bf84f integrated without history rewrite. The write-watch CMake conflict keeps the new fault-ahead-off registration and exactly one execute-fault/read-fault loop. 12/12 focused Linux full-kernel executions pass, including patched/unpatched wait3/wait4 and posix_spawn/getrusage. Native ARM64 macOS27.2/Apple clang21 standalone write-watch configure/build passes; all25 tests pass three times:75 executions, zero skips. Public-header ownership audit406 libraries/28,350 exports, conventions and whitespace pass.

Linux qualification: GCC13.3 cross on ARM64 Ubuntu24.04, Alpine6.12.110/QEMU8.2.2TCG cpu=max,smap=off,2vCPUs1536MiB, SHA256-verified binaries. Newly required libSceNet/NetCtl are included in the final VM run; initial packaging loader failures remain excluded. Windows child accounting and previous SMAP/MULX limitations are unchanged. New hosted results remain required for this head. The separate _wait4 exports in libkernel_sys/libkernel_web remain future work; the contributor's firmware wrapper observations do not qualify their full semantics.

Write-watch CI configuration fix: head b2ec092c244ff8d0b1849287c0dfc75ad2073c8a removes the second identical execute-fault/read-fault registration loop from core/libs/tests/write_watch/CMakeLists.txt (five deleted lines). The failed hosted job stopped during CMake configuration with duplicate test-name errors; build and execution were skipped. The same duplicate was present on main b1b5353cfc. Local pre-fix configuration reproduces both errors. After the fix, configure/build pass and all 18 tests pass three times:54 successful executions, zero skips, including both fault cases. macOS27.2, Apple clang21, native arm64 Release; same --repeat until-fail:3 command as CI. Test bodies, assertions and 30-second timeouts are unchanged. Conventions and whitespace pass. Fresh hosted CI on this head is still pending.

30 October head f95d08cc1252a7a5e64c6920f06e2ac09e88816e, tested main e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed, integrated by normal merge. The debt conflict retains both the Windows child-accounting refusal and upstream sceKernelGetUpdVersion limitations. 12/12 focused Linux full-kernel executions pass, with 8 common suites also passing on the separately built main; main's four wait3/wait4 fixture cases still terminate with their named NotImplemented exception (expected baseline non-passes). Full public-header compilation passes: 374 libraries / 14,864 exports. 519/519 local macOS x86_64 relinker tests pass (macOS 27.2, Apple clang 21, ARM64 host/Rosetta, Release, parallel 4). Conventions and whitespace pass.

The previously queued diagnostic-head hosted job completed successfully on f2349e7cd0:489/489, MULX2.11s. This removes that red result on the diagnostic head but does not establish the cause of the original flag mismatch. Operand/flag diagnostics remain intact; no flag assertion was weakened. This new merged head still needs its own hosted/full maintainer CI.

Linux runtime qualification remains GCC 13.3, Alpine 6.12.110/QEMU system 8.2.2 TCG cpu=max,smap=off,2 vCPUs, 1536 MiB, SHA256-verified fresh binaries. Windows resource accounting and earlier SMAP-on limitations remain. Earlier evidence below retains its original revisions.

29 October refresh: head 71b26b9ff0aa77f70c539c02b006cff6168cc314, integrated main f7e84c4cf1609cc10bac95a44cd431805e5ebc8a, preserving published ancestry. Main's Apple guard around host-to-guest wait-signal translation is retained inside the shared backend.

The exact current-base comparison uses separately built main and candidate libraries. Eight common kernel/process suites pass on each (including posix_spawn/getrusage). The same wait3/wait4 executable is additionally run against each revision, in both patched/unpatched modes: all four candidate cases pass; all four base cases terminate with the named wait3/wait4 NotImplemented exception (exit 134), because main does not implement these APIs. These base runs are expected non-passes, not a claim that main passes the new suite. Candidate total: 12/12 successful executions.

Complete public-header audit/compilation passes: 373 libraries / 13,451 exports; conventions and whitespace pass. GCC 13.3, Alpine 6.12.110, QEMU system 8.2.2 TCG, cpu=max,smap=off, two vCPUs, 1536 MiB; SHA256-verified binaries. No new macOS/native Windows execution; Windows child-accounting refusal and the previously observed SMAP-on laboratory fault remain limitations. Earlier reports below retain their original revisions.

28 October refresh: head 0b4e1fff09cddf4672dd628e1723e80eca1f3b84, main c02d287bd0eb9fe0718940b2735811e97c2eb509 integrated by normal merge, preserving published ancestry. 12/12 focused Linux full-kernel executions pass on SHA256-verified binaries (GCC 13.3, Alpine 6.12.110, QEMU system 8.2.2 TCG, two vCPUs, 1536 MiB, cpu=max,smap=off). Tests/assertions were not changed. With SMAP enabled, the general kernel test hits a kernel fault at the new upstream context-restore IRET and times out; this CPU profile is not qualified by this refresh. No blanket native-hardware or zero-failure claim is made. Public-header ownership audit passes (368 libraries / 13,051 exports), as does full header compilation; conventions and whitespace checks pass. Fresh supported Windows runtime/full maintainer CI remains required. Earlier results below retain their original revisions.

27 October head 827eadb438b3d1162effed513dac8041657b2f32, main 0d62324ce25ebe4087984b9da143779ce99e7a88 merged with published ancestry retained. The CMake conflict keeps both Wait.cpp and main's new Uuid.cpp; no wait implementation or assertion was changed in this update.

13/13 Linux full-kernel executions pass: wait3/wait4 in both library modes, six common kernel/filesystem regressions, posix_spawn, getrusage and main's UUID regression. This covers real child exit/resource output, WNOHANG preservation and inaccessible status/resource destinations, plus UUID behavior after the source-list merge. Copied binary SHA256s verified. The first VM packaging attempts lacked the libSceAmpr dependency newly required by the general kernel test; that environment failure is retained, and the complete dependency closure passes.

Linux x86-64 build with cross GCC 13.3 hosted on ARM64 / Ubuntu 24.04; runtime Alpine 6.12.110-0-virt under QEMU system 8.2.2 TCG cpu=max, two vCPUs, 1536 MiB. CPU execution is emulated; syscalls execute in the real guest kernel.

Public-header audit and all-library standalone/combined compilation pass: 368 libraries, 12,811 exports, using native ARM64 Python with the x86-64 cross compiler and unchanged ABI guards. Wait.cpp, Uuid.cpp and the fixture pass MinGW 13.2 UCRT syntax checks. Conventions and whitespace checks against current main pass. No unverified Windows counter mapping was introduced.

Prior negative-control and narrow Wine child-registry results remain tied to 25ebeca78e: the old wrapper loses resource output, while the Windows refusal leaves the child recoverable. They are not a new native/full-DLL run of this head. Harry's native Windows report likewise remains tied to its original integration.

Please dispatch fresh full Linux/Windows CI for this head, including wait, posix_spawn, getrusage and UUID. Completed-child resource accounting on Windows remains an explicit refusal before consumption. No new native Windows, macOS, title or console claim.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4952906326 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9162). Originally posted by [yabanana](https://github.com/yabanana) on 2026-10-21T14:05:00Z. --- ### What Replace the wait3/wait4 discovery stubs with typed public declarations and one shared wait backend. wait3 selects any child; wait4 passes the selection through. The integration with main's new posix_spawn support retains option validation, guest child-status translation and no-child/WNOHANG output preservation. Linux wait4 collects the actual child's resource usage and converts it through the same field conversion as getrusage. Status and resource outputs use the existing checked guest writes. Windows reaps supported children when usage is null; resource accounting for a completed child is unimplemented and throws **before closing its handle or removing it from the registry**. The child remains recoverable by a later supported wait. This limitation is recorded in technical debt; no successful accounting result is fabricated. The prior single-process description no longer applies after main added child creation. The updated fixture covers real child exit, WNOHANG, returned resources and invalid output pointers, in addition to no-child and option precedence. Linux INT_MIN follows the shared provider's host ESRCH case, documented by [Linux wait(2)](https://man7.org/linux/man-pages/man2/waitpid.2.html); this is not a PS5 selector-error claim. Export/NID presence: [PS5 SDK stub table](https://github.com/ps5-payload-dev/sdk/blob/a7685ce8e97ce1f8a4f38253a41d54241c9124f1/sce_stubs/libkernel_sys.c). Signatures and wait3/wait4 relationship: [FreeBSD 11.4 wait(2)](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/libc/sys/wait.2). Console behaviour is unverified. ### Tested 11 November update at `289b8c3cd55c86588f55266cda63e5e9834b0e14`. Merged main `bf8094d980` and retained the wait accounting entry alongside upstream's revised debt notes. The integration preview is clean against `54c20307dc`. All 12 focused Linux executions pass, including both wait3/wait4 library modes and the process suites. Tested with SHA256-verified binaries built with GCC 13.3 and run in a full Alpine 6.12.110 x86_64 kernel under QEMU TCG with SMAP off. All 39 web tests, conventions and whitespace checks pass. Hosted checks are pending for this head. 9 November refresh at `c5f45829697e7f0c22d063232789a42bf612b461` with `main` `67092e70b5211ed86d7a15e22cd10bca651901f5` merged. The merge retains upstream’s macOS thread accounting and uses the shared ResourceUsage conversion for getrusage and wait4. The four prior relinker jobs failed on web_library_assets. I reproduced the missing mimalloc fixture on their base 5299939 without the PR. The refreshed branch includes upstream fix 0c4dc6db47. 12 focused Linux full-kernel executions pass, including both wait modes, posix_spawn and getrusage. The macOS x86_64 syntax check of Process.cpp passes with the existing C-linkage warnings. All 39 web packaging tests, conventions, whitespace and the public-header audit (407 libraries and 33,818 exports) pass. Linux results use GCC 13.3 and a full Alpine 6.12.110 kernel under QEMU TCG with SMAP off, with fresh SHA256-verified binaries. macOS checks use macOS 27.3 and Apple clang 21 on ARM64 with an x86_64 target. New hosted checks are pending. 6 November: head `75950dc455113913a6913c363547176964fe2ad1` resolves the sole current-main conflict by adopting upstream maintainer commit df959bf14b with its authorship. MulxLoweringTests.cpp now exactly matches main e64c194c43. The wait provider is unchanged. Fresh macOS27.2/Appleclang21 Release x86_64 build through Rosetta passes MULX10 consecutive times (5.15s total), retaining all flag checks, cases, generated instructions and timeouts. Current-main merge preview, conventions and whitespace pass. This resolves the diagnostic conflict; the historical runner mismatch still has no demonstrated cause. New hosted CI is pending. 4 November update: head `350fa008de66b026ff5593f219c7a8923b72310c`, main `b11c7bf84f` integrated without history rewrite. The write-watch CMake conflict keeps the new fault-ahead-off registration and exactly one execute-fault/read-fault loop. 12/12 focused Linux full-kernel executions pass, including patched/unpatched wait3/wait4 and posix_spawn/getrusage. Native ARM64 macOS27.2/Apple clang21 standalone write-watch configure/build passes; all25 tests pass three times:75 executions, zero skips. Public-header ownership audit406 libraries/28,350 exports, conventions and whitespace pass. Linux qualification: GCC13.3 cross on ARM64 Ubuntu24.04, Alpine6.12.110/QEMU8.2.2TCG cpu=max,smap=off,2vCPUs1536MiB, SHA256-verified binaries. Newly required libSceNet/NetCtl are included in the final VM run; initial packaging loader failures remain excluded. Windows child accounting and previous SMAP/MULX limitations are unchanged. New hosted results remain required for this head. The separate `_wait4` exports in libkernel_sys/libkernel_web remain future work; the contributor's firmware wrapper observations do not qualify their full semantics. Write-watch CI configuration fix: head `b2ec092c244ff8d0b1849287c0dfc75ad2073c8a` removes the second identical execute-fault/read-fault registration loop from core/libs/tests/write_watch/CMakeLists.txt (five deleted lines). [The failed hosted job](https://github.com/boykopovar/AnyPS5/actions/runs/41050507218/job/124047435036) stopped during CMake configuration with duplicate test-name errors; build and execution were skipped. The same duplicate was present on main b1b5353cfc. Local pre-fix configuration reproduces both errors. After the fix, configure/build pass and all 18 tests pass three times:54 successful executions, zero skips, including both fault cases. macOS27.2, Apple clang21, native arm64 Release; same --repeat until-fail:3 command as CI. Test bodies, assertions and 30-second timeouts are unchanged. Conventions and whitespace pass. Fresh hosted CI on this head is still pending. 30 October head `f95d08cc1252a7a5e64c6920f06e2ac09e88816e`, tested main `e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed`, integrated by normal merge. The debt conflict retains both the Windows child-accounting refusal and upstream sceKernelGetUpdVersion limitations. **12/12 focused Linux full-kernel executions pass**, with 8 common suites also passing on the separately built main; main's four wait3/wait4 fixture cases still terminate with their named NotImplemented exception (expected baseline non-passes). Full public-header compilation passes: 374 libraries / 14,864 exports. **519/519 local macOS x86_64 relinker tests pass** (macOS 27.2, Apple clang 21, ARM64 host/Rosetta, Release, parallel 4). Conventions and whitespace pass. The previously queued [diagnostic-head hosted job](https://github.com/boykopovar/AnyPS5/actions/runs/40868905162/job/123430826214) completed successfully on `f2349e7cd0`:489/489, MULX2.11s. This removes that red result on the diagnostic head but does not establish the cause of the original flag mismatch. Operand/flag diagnostics remain intact; no flag assertion was weakened. This new merged head still needs its own hosted/full maintainer CI. Linux runtime qualification remains GCC 13.3, Alpine 6.12.110/QEMU system 8.2.2 TCG cpu=max,smap=off,2 vCPUs, 1536 MiB, SHA256-verified fresh binaries. Windows resource accounting and earlier SMAP-on limitations remain. Earlier evidence below retains its original revisions. 29 October refresh: head `71b26b9ff0aa77f70c539c02b006cff6168cc314`, integrated main `f7e84c4cf1609cc10bac95a44cd431805e5ebc8a`, preserving published ancestry. Main's Apple guard around host-to-guest wait-signal translation is retained inside the shared backend. The exact current-base comparison uses separately built main and candidate libraries. Eight common kernel/process suites pass on each (including posix_spawn/getrusage). The same wait3/wait4 executable is additionally run against each revision, in both patched/unpatched modes: all four candidate cases pass; all four base cases terminate with the named wait3/wait4 NotImplemented exception (exit 134), because main does not implement these APIs. These base runs are expected non-passes, not a claim that main passes the new suite. Candidate total: 12/12 successful executions. Complete public-header audit/compilation passes: 373 libraries / 13,451 exports; conventions and whitespace pass. GCC 13.3, Alpine 6.12.110, QEMU system 8.2.2 TCG, cpu=max,smap=off, two vCPUs, 1536 MiB; SHA256-verified binaries. No new macOS/native Windows execution; Windows child-accounting refusal and the previously observed SMAP-on laboratory fault remain limitations. Earlier reports below retain their original revisions. 28 October refresh: head `0b4e1fff09cddf4672dd628e1723e80eca1f3b84`, main `c02d287bd0eb9fe0718940b2735811e97c2eb509` integrated by normal merge, preserving published ancestry. 12/12 focused Linux full-kernel executions pass on SHA256-verified binaries (GCC 13.3, Alpine 6.12.110, QEMU system 8.2.2 TCG, two vCPUs, 1536 MiB, **cpu=max,smap=off**). Tests/assertions were not changed. With SMAP enabled, the general kernel test hits a kernel fault at the new upstream context-restore IRET and times out; this CPU profile is not qualified by this refresh. No blanket native-hardware or zero-failure claim is made. Public-header ownership audit passes (368 libraries / 13,051 exports), as does full header compilation; conventions and whitespace checks pass. Fresh supported Windows runtime/full maintainer CI remains required. Earlier results below retain their original revisions. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> 27 October head `827eadb438b3d1162effed513dac8041657b2f32`, main `0d62324ce25ebe4087984b9da143779ce99e7a88` merged with published ancestry retained. The CMake conflict keeps both Wait.cpp and main's new Uuid.cpp; no wait implementation or assertion was changed in this update. **13/13 Linux full-kernel executions pass:** wait3/wait4 in both library modes, six common kernel/filesystem regressions, posix_spawn, getrusage and main's UUID regression. This covers real child exit/resource output, WNOHANG preservation and inaccessible status/resource destinations, plus UUID behavior after the source-list merge. Copied binary SHA256s verified. The first VM packaging attempts lacked the libSceAmpr dependency newly required by the general kernel test; that environment failure is retained, and the complete dependency closure passes. Linux x86-64 build with cross GCC 13.3 hosted on ARM64 / Ubuntu 24.04; runtime Alpine 6.12.110-0-virt under QEMU system 8.2.2 TCG cpu=max, two vCPUs, 1536 MiB. CPU execution is emulated; syscalls execute in the real guest kernel. Public-header audit and all-library standalone/combined compilation pass: 368 libraries, 12,811 exports, using native ARM64 Python with the x86-64 cross compiler and unchanged ABI guards. Wait.cpp, Uuid.cpp and the fixture pass MinGW 13.2 UCRT syntax checks. Conventions and whitespace checks against current main pass. No unverified Windows counter mapping was introduced. Prior negative-control and narrow Wine child-registry results remain tied to `25ebeca78e`: the old wrapper loses resource output, while the Windows refusal leaves the child recoverable. They are not a new native/full-DLL run of this head. [Harry's native Windows report](https://github.com/boykopovar/AnyPS5/pull/9162#issuecomment-6365820443) likewise remains tied to its original integration. Please dispatch fresh full Linux/Windows CI for this head, including wait, posix_spawn, getrusage and UUID. Completed-child resource accounting on Windows remains an explicit refusal before consumption. No new native Windows, macOS, title or console claim. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
harisibrar1 commented 2026-10-22 04:12:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-22T04:12:22Z.

Review: COMMENTED


Verified on Windows 11, WinLibs GCC 15.2.0 r7, full build (BUILD_TESTING=ON) of this PR merged onto main 6ef5a1c4c:

  • The new guest_kernel_sys_wait_tests fails to link with MinGW: undefined reference to '__gxx_personality_v0' from NidCompute.cpp.obj, Sha1.cpp.obj and GuestKernelSysWait.cpp.obj. core/libs/CMakeLists.txt:44 compiles everything with -fno-asynchronous-unwind-tables, and this target links the static SEH runtime (-static -static-libstdc++) without turning the tables back on. The other targets that link statically, e.g. patched_libraries_tests (core/libs/CMakeLists.txt:281-282), add target_compile_options(... PRIVATE -fasynchronous-unwind-tables) for that reason.
  • Adding target_compile_options(guest_kernel_sys_wait_tests PRIVATE -fasynchronous-unwind-tables) next to the target_link_options line in the if(MINGW) block makes it link here. The other nine changed files build cleanly; CI doesn't run the full Windows build for PRs, so this wouldn't show up there.
  • The behaviour itself matches FreeBSD 11.4 sys_wait4/kern_wait/kern_wait6: with no child process ECHILD is the only answer for valid options (guest fork/posix_spawn still throw on main, so nothing is faked), the unknown-option mask 0x8000003F matches kern_wait6 and libkernel's waitpid, and status/rusage stay untouched on error as in sys_wait4 (checked byte by byte on the 144-byte amd64 struct rusage).
  • Small correction to the description: the cited PS5-3.20 libkernel_sys.c lists only _wait4; the PS5 SDK's sce_stubs/libkernel_sys.c is the source that lists wait3 and wait4. Nit: removing the stubs leaves three blank lines at the end of Export.Discovery.cpp.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609167852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9162#pullrequestreview-5609167852). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-22T04:12:22Z. **Review:** COMMENTED --- Verified on Windows 11, WinLibs GCC 15.2.0 r7, full build (`BUILD_TESTING=ON`) of this PR merged onto main 6ef5a1c4c: - The new `guest_kernel_sys_wait_tests` fails to link with MinGW: `undefined reference to '__gxx_personality_v0'` from `NidCompute.cpp.obj`, `Sha1.cpp.obj` and `GuestKernelSysWait.cpp.obj`. `core/libs/CMakeLists.txt:44` compiles everything with `-fno-asynchronous-unwind-tables`, and this target links the static SEH runtime (`-static -static-libstdc++`) without turning the tables back on. The other targets that link statically, e.g. `patched_libraries_tests` (`core/libs/CMakeLists.txt:281-282`), add `target_compile_options(... PRIVATE -fasynchronous-unwind-tables)` for that reason. - Adding `target_compile_options(guest_kernel_sys_wait_tests PRIVATE -fasynchronous-unwind-tables)` next to the `target_link_options` line in the `if(MINGW)` block makes it link here. The other nine changed files build cleanly; CI doesn't run the full Windows build for PRs, so this wouldn't show up there. - The behaviour itself matches FreeBSD 11.4 `sys_wait4`/`kern_wait`/`kern_wait6`: with no child process ECHILD is the only answer for valid options (guest `fork`/`posix_spawn` still throw on main, so nothing is faked), the unknown-option mask 0x8000003F matches `kern_wait6` and libkernel's `waitpid`, and status/rusage stay untouched on error as in `sys_wait4` (checked byte by byte on the 144-byte amd64 `struct rusage`). - Small correction to the description: the cited PS5-3.20 `libkernel_sys.c` lists only `_wait4`; the PS5 SDK's `sce_stubs/libkernel_sys.c` is the source that lists `wait3` and `wait4`. Nit: removing the stubs leaves three blank lines at the end of `Export.Discovery.cpp`. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
MarcZX10 commented 2026-10-22 11:50:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:50:18Z.

Review: DISMISSED


The implementation delegates to the existing waitpid model cleanly, but I found Windows test-harness blockers that should be fixed before this is mergeable:

  1. guest_kernel_sys_wait_tests does not receive -fasynchronous-unwind-tables in its MinGW block. This target compiles NidCompute.cpp and Sha1.cpp and links statically; the existing MinGW Windows review reports that it fails to link with undefined __gxx_personality_v0, and that adding the compile option fixes it. Several neighboring static test targets add this option explicitly.
  2. The fixture resolves __error from libkernel.prx (LoadFunction(...)(kernel, "__error", patched)). Issue #9616 and Windows testing on related PR #9019 report that GetProcAddress does not search dependencies and __error is exported by libc. Please load/resolve it from the correct module and run both patched and unpatched fixtures on Windows.

This head is also 644 commits behind current main; please rebase/update it and rerun the focused Linux/Windows checks and overlap/convention checks against the resulting head. CI currently marks the platform jobs skipped, so the Linux guest/VM evidence in the PR body does not establish that the Windows target builds. The current queue is over the repository's generic intake pause threshold, so keep this PR tied to its existing scoped work and do not open a generic follow-up without a title-specific current-main reproduction or maintainer exception.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5613675992 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9162#pullrequestreview-5613675992). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:50:18Z. **Review:** DISMISSED --- The implementation delegates to the existing `waitpid` model cleanly, but I found Windows test-harness blockers that should be fixed before this is mergeable: 1. `guest_kernel_sys_wait_tests` does not receive `-fasynchronous-unwind-tables` in its MinGW block. This target compiles `NidCompute.cpp` and `Sha1.cpp` and links statically; the existing MinGW Windows review reports that it fails to link with undefined `__gxx_personality_v0`, and that adding the compile option fixes it. Several neighboring static test targets add this option explicitly. 2. The fixture resolves `__error` from `libkernel.prx` (`LoadFunction(...)(kernel, "__error", patched)`). Issue #9616 and Windows testing on related PR #9019 report that `GetProcAddress` does not search dependencies and `__error` is exported by libc. Please load/resolve it from the correct module and run both patched and unpatched fixtures on Windows. This head is also 644 commits behind current `main`; please rebase/update it and rerun the focused Linux/Windows checks and overlap/convention checks against the resulting head. CI currently marks the platform jobs skipped, so the Linux guest/VM evidence in the PR body does not establish that the Windows target builds. The current queue is over the repository's generic intake pause threshold, so keep this PR tied to its existing scoped work and do not open a generic follow-up without a title-specific current-main reproduction or maintainer exception.
MarcZX10 commented 2026-10-23 05:08:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:08:50Z.

Review: COMMENTED


The latest head 3802fb6 still has both Windows fixture blockers described above: __error is queried from libkernel.prx even though the common export is provided by libc.prx, and the statically linked MinGW fixture target lacks asynchronous unwind tables. Could you update the fixture to load the actual libc.prx provider and enable the MinGW unwind option, then run both patched and unpatched cases on Windows? I verified this against the current diff; these are test harness setup issues and do not challenge the proposed wait3/wait4 behavior.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624143101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9162#pullrequestreview-5624143101). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T05:08:50Z. **Review:** COMMENTED --- The latest head `3802fb6` still has both Windows fixture blockers described above: `__error` is queried from `libkernel.prx` even though the common export is provided by `libc.prx`, and the statically linked MinGW fixture target lacks asynchronous unwind tables. Could you update the fixture to load the actual `libc.prx` provider and enable the MinGW unwind option, then run both patched and unpatched cases on Windows? I verified this against the current diff; these are test harness setup issues and do not challenge the proposed `wait3`/`wait4` behavior.
MarcZX10 commented 2026-10-29 07:11:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T07:11:48Z.

Review: DISMISSED


Re-checked — new head, changes still requested

The author’s 12/12 Linux wait-suite run and public-header audit are useful, but they use main c02d287bd0; current main has since changed shared process and wait-export code.

What I ran

  • Reviewed exact head 0b4e1fff09cddf4672dd628e1723e80eca1f3b84 against current main edf6804cf52c62eacafc592dd6142cb4efe5bd05.
  • Ran git merge-base, git merge-tree --write-tree, git diff --check, and compared current-main changes on the PR’s touched paths.
  • Checked hosted CI. I did not run the focused tests locally.

Results

Check Result
PR base / current main c02d287bd0 / edf6804cf5
Merge preview Clean; tree d0a53bc5c5561e69d54b2eaba4ee574b5089c840
Current main changed shared paths Process wait handling, libkernel_sys export declarations, APIs, build registration, and debt documentation
Diff check Passed; no output
Hosted Windows, conventions, eligibility, labels, report, relinker, ASan, register-context and write-watch Passed
Hosted Linux product job Skipped
Author-reported focused execution 12/12 Linux full-kernel executions pass on head 0b4e1fff09 with base c02d287bd0
Unedited available command output
$ git merge-base upstream/main refs/review/upstream-9162
c02d287bd0
$ git merge-tree --write-tree upstream/main refs/review/upstream-9162
d0a53bc5c5561e69d54b2eaba4ee574b5089c840
$ git diff --check upstream/main...refs/review/upstream-9162

$ gh pr checks 9162 -R boykopovar/AnyPS5
conventions	pass	19s
eligibility	pass	6s
labels	pass	8s
register-context (macos-15-intel, Debug)	pass	1m1s
register-context (macos-15-intel, Release)	pass	1m14s
register-context (ubuntu-latest, Debug)	pass	35s
register-context (ubuntu-latest, Release)	pass	32s
relinker (macos-latest, clang++)	pass	3m13s
relinker (macos-latest, clang++, x86_64)	pass	4m35s
relinker (ubuntu-latest, g++)	pass	2m30s
relinker (windows-latest, g++)	pass	6m25s
relinker-asan	pass	2m24s
report	pass	31s
windows	pass	19m25s
write-watch (macos-15)	pass	40s
linux	skipping	0
write-watch (macos-15-intel)	pass	1m4s

Negative control

Check Result
Implementation mutation No negative-control run was performed in this recheck; the author’s reported 12/12 runs are on the older base listed above

Findings

Blocking

  • Please rebase onto current main and rerun guest_kernel_sys_wait on both the current base and refreshed head. Current main changed waitpid signal translation and the libkernel_sys export/API set that this PR integrates with, so the old-base results do not validate this integration.

Non-blocking

  • None found in the current integration preview.

Sources

Not verified

  • wait3/wait4 behavior after integration with current main.

To get this to a good state

  • Refresh the branch, run the focused wait suite on the exact current base and change, and report the resulting commits and outputs.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5694069457 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9162#pullrequestreview-5694069457). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T07:11:48Z. **Review:** DISMISSED --- # Re-checked — new head, changes still requested The author’s 12/12 Linux wait-suite run and public-header audit are useful, but they use `main` `c02d287bd0`; current `main` has since changed shared process and wait-export code. ## What I ran - Reviewed exact head `0b4e1fff09cddf4672dd628e1723e80eca1f3b84` against current `main` `edf6804cf52c62eacafc592dd6142cb4efe5bd05`. - Ran `git merge-base`, `git merge-tree --write-tree`, `git diff --check`, and compared current-main changes on the PR’s touched paths. - Checked hosted CI. I did not run the focused tests locally. ## Results | Check | Result | |---|---| | PR base / current main | `c02d287bd0` / `edf6804cf5` | | Merge preview | Clean; tree `d0a53bc5c5561e69d54b2eaba4ee574b5089c840` | | Current main changed shared paths | Process wait handling, libkernel_sys export declarations, APIs, build registration, and debt documentation | | Diff check | Passed; no output | | Hosted Windows, conventions, eligibility, labels, report, relinker, ASan, register-context and write-watch | Passed | | Hosted Linux product job | Skipped | | Author-reported focused execution | 12/12 Linux full-kernel executions pass on head `0b4e1fff09` with base `c02d287bd0` | <details><summary>Unedited available command output</summary> ```text $ git merge-base upstream/main refs/review/upstream-9162 c02d287bd0 $ git merge-tree --write-tree upstream/main refs/review/upstream-9162 d0a53bc5c5561e69d54b2eaba4ee574b5089c840 $ git diff --check upstream/main...refs/review/upstream-9162 $ gh pr checks 9162 -R boykopovar/AnyPS5 conventions pass 19s eligibility pass 6s labels pass 8s register-context (macos-15-intel, Debug) pass 1m1s register-context (macos-15-intel, Release) pass 1m14s register-context (ubuntu-latest, Debug) pass 35s register-context (ubuntu-latest, Release) pass 32s relinker (macos-latest, clang++) pass 3m13s relinker (macos-latest, clang++, x86_64) pass 4m35s relinker (ubuntu-latest, g++) pass 2m30s relinker (windows-latest, g++) pass 6m25s relinker-asan pass 2m24s report pass 31s windows pass 19m25s write-watch (macos-15) pass 40s linux skipping 0 write-watch (macos-15-intel) pass 1m4s ``` </details> ## Negative control | Check | Result | |---|---| | Implementation mutation | No negative-control run was performed in this recheck; the author’s reported 12/12 runs are on the older base listed above | ## Findings ### Blocking - Please rebase onto current `main` and rerun `guest_kernel_sys_wait` on both the current base and refreshed head. Current main changed `waitpid` signal translation and the libkernel_sys export/API set that this PR integrates with, so the old-base results do not validate this integration. ### Non-blocking - None found in the current integration preview. ## Sources - [Author’s refreshed-head test report](https://github.com/boykopovar/AnyPS5/pull/9162#issuecomment-6465839001) - [Current-main process wait handling](https://github.com/boykopovar/AnyPS5/blob/edf6804cf52c62eacafc592dd6142cb4efe5bd05/core/libs/prx/libkernel/System/src/Process.cpp) - [PR-head wait3/wait4 implementation](https://github.com/boykopovar/AnyPS5/blob/0b4e1fff09cddf4672dd628e1723e80eca1f3b84/core/libs/prx/libkernel_sys/Wait.cpp) ## Not verified - `wait3`/`wait4` behavior after integration with current `main`. ## To get this to a good state - Refresh the branch, run the focused wait suite on the exact current base and change, and report the resulting commits and outputs.
MarcZX10 commented 2026-10-29 10:31:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T10:31:43Z.

Review: DISMISSED


Re-reviewed — changes still requested

The new report addresses the integration and execution request from my previous review. Exact head 71b26b9ff0aa77f70c539c02b006cff6168cc314 includes main f7e84c4cf1609cc10bac95a44cd431805e5ebc8a; the author reports the eight shared kernel/process suites passing on both separately built trees and all four candidate wait3/wait4 cases passing, with the base cases reaching the expected NotImplemented exception. The public-header audit, conventions and whitespace checks are also reported clean.

I compared the exact head with current main bc3e33f4e334996ab9ba5cbf8544942465be18f3:

  • The merge preview is clean (aad6a290dbf155ae8f16924de00447ab7b71a72b).
  • git diff --check passes and current-main conventions pass.
  • Changes on main since the reported merge commit do not touch the wait implementation, wait tests, or this PR's libkernel_sys debt entry.
  • Hosted Windows, Ubuntu relinker/ASan, Ubuntu register-context, and conventions pass. Linux product tests are skipped by the workflow. The macOS relinker, register-context, write-watch and labels jobs are still pending.
  • I did not run a local build or tests.

The remaining gate is the requested maintainer CI result on this exact head. The relevant macOS jobs and labels are still pending, so I am keeping the review changes-requested until those checks complete. The published Linux evidence uses QEMU TCG rather than native console or macOS/Windows wait behavior; the documented Windows resource-accounting limitation remains appropriately scoped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696263126 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9162#pullrequestreview-5696263126). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T10:31:43Z. **Review:** DISMISSED --- # Re-reviewed — changes still requested The new report addresses the integration and execution request from my previous review. Exact head `71b26b9ff0aa77f70c539c02b006cff6168cc314` includes `main` `f7e84c4cf1609cc10bac95a44cd431805e5ebc8a`; the author reports the eight shared kernel/process suites passing on both separately built trees and all four candidate wait3/wait4 cases passing, with the base cases reaching the expected NotImplemented exception. The public-header audit, conventions and whitespace checks are also reported clean. I compared the exact head with current `main` `bc3e33f4e334996ab9ba5cbf8544942465be18f3`: - The merge preview is clean (`aad6a290dbf155ae8f16924de00447ab7b71a72b`). - `git diff --check` passes and current-main conventions pass. - Changes on `main` since the reported merge commit do not touch the wait implementation, wait tests, or this PR's `libkernel_sys` debt entry. - Hosted Windows, Ubuntu relinker/ASan, Ubuntu register-context, and conventions pass. Linux product tests are skipped by the workflow. The macOS relinker, register-context, write-watch and labels jobs are still pending. - I did not run a local build or tests. The remaining gate is the requested maintainer CI result on this exact head. The relevant macOS jobs and labels are still pending, so I am keeping the review changes-requested until those checks complete. The published Linux evidence uses QEMU TCG rather than native console or macOS/Windows wait behavior; the documented Windows resource-accounting limitation remains appropriately scoped.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9162
No description provided.