feat(libkernel): implement wait through guest waitpid #3715

Merged
Lorkydey merged 1 commit from upstream-pr/3715 into main 2026-10-12 04:35:03 +00:00
Lorkydey commented 2026-10-11 15:55:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-11T15:55:32Z.


What

Add the missing libkernel wait(int*) export by forwarding to guest waitpid(-1, status, 0). This matches the relationship between FreeBSD's wait and waitpid.

AnyPS5 currently cannot create guest child processes, so its existing waitpid returns -1 with guest ECHILD (10). wait shares that behavior, leaves the output status untouched on failure, and accepts a null status pointer. It does not wait on host children or add process-creation support.

PS5MC release 1.2, PPSA99420, imports wait from libkernel.prx: symbol 444, NID ldVb3lc75PE. The import was inspected in the release executable; main has no provider for it. This is static import evidence, not a recorded title startup failure: PS5MC was not launched for this change.

Tested

Windows, WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release, BUILD_TESTING=ON, based on main a11c8f7f70a0ed4e71504a89de69e8cdae687817.

  • Extended guest_waitpid with wait behavior checks: return -1, replace an existing errno with ECHILD, preserve the supplied status, and accept a null status pointer.
  • With the test applied to main alone, the test executable fails to link:
    undefined reference to `wait_nid_postfix'
    
  • With the implementation, the full Windows build succeeds. All seven selected tests pass: guest_waitpid, guest_execvp, guest_errors, guest_parent_process, guest_process_arguments, guest_credentials, and guest_system_command. guest_waitpid takes 0.04 s.
  • Verified the built libkernel provides PS5MC's exact ldVb3lc75PE import.
  • Conventions and test-registration checks pass. No Linux or console run was performed.
  • Checked all 261 open PRs with tools/pr_overlap.py: no overlap. All-state searches for the export, NID, and wait-related PR titles found no existing implementation of this export.
  • tools/progress.py: system libraries 2903/3383 (85.81%) -> 2904/3384 (85.82%).

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4820335656 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3715). Originally posted by [Lorkydey](https://github.com/Lorkydey) on 2026-10-11T15:55:32Z. --- ### What Add the missing libkernel `wait(int*)` export by forwarding to guest `waitpid(-1, status, 0)`. This matches the relationship between FreeBSD's [wait](https://github.com/freebsd/freebsd-src/blob/d43c54ae9f1bc8002297ec035de83fb14d0accb8/lib/libc/gen/wait.c#L41-L48) and [waitpid](https://github.com/freebsd/freebsd-src/blob/d43c54ae9f1bc8002297ec035de83fb14d0accb8/lib/libc/gen/waitpid.c#L40-L47). AnyPS5 currently cannot create guest child processes, so its existing `waitpid` returns -1 with guest ECHILD (10). `wait` shares that behavior, leaves the output status untouched on failure, and accepts a null status pointer. It does not wait on host children or add process-creation support. [PS5MC release 1.2](https://github.com/VivaLaVent/PS5MC/releases/tag/1.2), PPSA99420, imports `wait` from `libkernel.prx`: symbol 444, NID `ldVb3lc75PE`. The import was inspected in the release executable; main has no provider for it. This is static import evidence, not a recorded title startup failure: PS5MC was not launched for this change. ### Tested Windows, WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release, `BUILD_TESTING=ON`, based on main `a11c8f7f70a0ed4e71504a89de69e8cdae687817`. - Extended `guest_waitpid` with `wait` behavior checks: return -1, replace an existing errno with ECHILD, preserve the supplied status, and accept a null status pointer. - With the test applied to main alone, the test executable fails to link: ```text undefined reference to `wait_nid_postfix' ``` - With the implementation, the full Windows build succeeds. All seven selected tests pass: `guest_waitpid`, `guest_execvp`, `guest_errors`, `guest_parent_process`, `guest_process_arguments`, `guest_credentials`, and `guest_system_command`. `guest_waitpid` takes 0.04 s. - Verified the built libkernel provides PS5MC's exact `ldVb3lc75PE` import. - Conventions and test-registration checks pass. No Linux or console run was performed. - Checked all 261 open PRs with `tools/pr_overlap.py`: no overlap. All-state searches for the export, NID, and wait-related PR titles found no existing implementation of this export. - `tools/progress.py`: system libraries 2903/3383 (85.81%) -> 2904/3384 (85.82%). ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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 - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-11 15:55:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T15:55:53Z.


Progress report (a11c8f7 → d71c51c)

📈 System libraries: 85.82% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel wait_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110847620 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3715#issuecomment-6110847620). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T15:55:53Z. --- <!-- progress-report --> ### Progress report (a11c8f7 → d71c51c) 📈 **System libraries**: 85.82% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `wait_nid_postfix` | </details>
MarcZX10 commented 2026-10-11 20:22:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T20:22:35Z.


I independently checked the wait export on Linux x86-64 with GCC 12.2.0, Release, and BUILD_TESTING=ON, based on current main (0a8b1d32). The guest_waitpid_tests target built, and CTest guest_waitpid passed 1/1. This was a focused Linux check, not a full suite or title run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113343902 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3715#issuecomment-6113343902). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T20:22:35Z. --- I independently checked the `wait` export on Linux x86-64 with GCC 12.2.0, Release, and `BUILD_TESTING=ON`, based on current `main` (`0a8b1d32`). The `guest_waitpid_tests` target built, and CTest `guest_waitpid` passed 1/1. This was a focused Linux check, not a full suite or title run.
Lorkydey commented 2026-10-11 20:28:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-11T20:28:27Z.


@MarcZX100 hey thanks for testing this on Linux ! Really appreciate the check alongside my Windows tests :)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113402420 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3715#issuecomment-6113402420). Originally posted by [Lorkydey](https://github.com/Lorkydey) on 2026-10-11T20:28:27Z. --- @MarcZX100 hey thanks for testing this on Linux ! Really appreciate the check alongside my Windows tests :)
MarcZX10 commented 2026-10-11 21:07:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T21:07:38Z.


Independent Linux validation of the same wait_nid_postfix forwarding change on current upstream/main 0a8b1d32 (not a checkout of this PR head): GCC 12.2.0, Release, BUILD_TESTING=ON; built guest_waitpid_tests and ran ctest -R "^guest_waitpid$" --output-on-failure. Result: 1/1 passed. This confirms the focused behavior on current main; it does not validate this PR head’s older base or the Windows build.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113764657 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3715#issuecomment-6113764657). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T21:07:38Z. --- Independent Linux validation of the same `wait_nid_postfix` forwarding change on current `upstream/main` `0a8b1d32` (not a checkout of this PR head): GCC 12.2.0, Release, `BUILD_TESTING=ON`; built `guest_waitpid_tests` and ran `ctest -R "^guest_waitpid$" --output-on-failure`. Result: 1/1 passed. This confirms the focused behavior on current main; it does not validate this PR head’s older base or the Windows build.
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!3715
No description provided.