feat(libkernel_sys): implement _wait4 #18659

Merged
alvaroelpob merged 5 commits from upstream-pr/18659 into main 2026-11-12 14:45:04 +00:00
alvaroelpob commented 2026-11-12 00:15:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alvaroelpob on 2026-11-12T00:15:53Z.


What

_wait4 threw NotImplemented. In FreeBSD 11.4 libc it is the wait4 system call under its underscore name (lib/libc/sys, __weak_reference(__sys_wait4, _wait4)), with the same prototype, so it now takes (pid, status, options, rusage) and forwards to libkernel_sys wait4, as _dup2 does for dup2.

Tested

Linux (WSL2, Ubuntu): full build and suite on b135a386b0, 4947/4947 tests pass; check_conventions passes. guest_kernel_sys_wait gains a _wait4 case, unpatched and patched (by NID), that runs every wait4 check through _wait4: EINVAL and ECHILD across pids and option masks without touching status or rusage, null and bad pointers, WNOHANG on a running child, reaping a forked child with its exit status and rusage, and EFAULT for bad rusage and status pointers. Against the previous stub both _wait4 cases abort on the NotImplemented throw.

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: #13730
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5268866066 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18659). Originally posted by [alvaroelpob](https://github.com/alvaroelpob) on 2026-11-12T00:15:53Z. --- ### What _wait4 threw NotImplemented. In FreeBSD 11.4 libc it is the wait4 system call under its underscore name (lib/libc/sys, __weak_reference(__sys_wait4, _wait4)), with the same prototype, so it now takes (pid, status, options, rusage) and forwards to libkernel_sys wait4, as _dup2 does for dup2. ### Tested <!-- 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. --> Linux (WSL2, Ubuntu): full build and suite on b135a386b0, 4947/4947 tests pass; check_conventions passes. guest_kernel_sys_wait gains a _wait4 case, unpatched and patched (by NID), that runs every wait4 check through _wait4: EINVAL and ECHILD across pids and option masks without touching status or rusage, null and bad pointers, WNOHANG on a running child, reaping a forked child with its exit status and rusage, and EFAULT for bad rusage and status pointers. Against the previous stub both _wait4 cases abort on the NotImplemented throw. ### 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: #13730 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!18659
No description provided.