feat(libkernel_sys): implement _dup2 export #13253

Merged
iAbdulrrahman merged 4 commits from upstream-pr/13253 into main 2026-11-04 23:18:08 +00:00
iAbdulrrahman commented 2026-10-30 08:09:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by iAbdulrrahman on 2026-10-30T08:09:07Z.


What

Implement _dup2 (W8f1adVl+48) in libkernel_sys by forwarding to libkernel's dup2_nid_postfix as defined in FreeBSD 11.4 libc lib/libc/sys/dup2.c and POSIX.1-2008. Add unit tests in GuestKernelSysDup.cpp covering invalid descriptors, identity descriptor duplication, and pipe duplication.

Tested

Windows 11, ctest --test-dir build -R guest_kernel_sys_dup --repeat until-fail:3 -V (passed 3/3 iterations).

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: #13129
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5081391711 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13253). Originally posted by [iAbdulrrahman](https://github.com/iAbdulrrahman) on 2026-10-30T08:09:07Z. --- ### What Implement `_dup2` (`W8f1adVl+48`) in `libkernel_sys` by forwarding to `libkernel`'s `dup2_nid_postfix` as defined in FreeBSD 11.4 libc `lib/libc/sys/dup2.c` and POSIX.1-2008. Add unit tests in `GuestKernelSysDup.cpp` covering invalid descriptors, identity descriptor duplication, and pipe duplication. ### 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. --> Windows 11, `ctest --test-dir build -R guest_kernel_sys_dup --repeat until-fail:3 -V` (passed 3/3 iterations). ### 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: #13129 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
CnRJay commented 2026-11-01 19:50:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:50:14Z.

Review: COMMENTED


Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (Unblocks: none is allowed), and it contained no code review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729924822 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13253#pullrequestreview-5729924822). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:50:14Z. **Review:** COMMENTED --- Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (`Unblocks: none` is allowed), and it contained no code review.
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!13253
No description provided.