feat(libkernel): implement sceKernelAioPollRequests #2120

Closed
StarMrGamer wants to merge 1 commit from upstream-pr/2120 into main
StarMrGamer commented 2026-10-09 09:23:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by StarMrGamer on 2026-10-09T09:23:47Z.


What

sceKernelAioPollRequests was the one export in Aio.cpp that still called NotImplemented_nid_no_patch, while every sibling in the same file is implemented. It reports the state of every listed request, the batch form of sceKernelAioPollRequest, which already exists.

Validation follows the other batch exports in the file (sceKernelAioWaitRequests, sceKernelAioDeleteRequests, sceKernelAioCancelRequests): null pointers return EFAULT, a negative count returns EINVAL, and an out-of-range id returns EINVAL, all before any state is written.

The behaviour matches shadPS4's sceKernelAioPollRequests (state[i] = id_state[id[i]] for each entry), the same reference the sibling exports in this file already follow and that the TechnicalDebt entry records.

Tested

Linux (CachyOS, GCC 16.2.1, Release, full build):

  • ninja -C build libkernel guest_aio_tests builds.
  • ctest --test-dir build -R ^guest_aio$ --output-on-failure passes. GuestAio.cpp now covers the batch poll of completed and aborted requests and its null-pointer, negative-count and invalid-id errors, plus the zero-count no-op.
  • python3 tools/check_conventions.py --base origin/main passes.

Windows and PS5 hardware not tested.

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:4798548851 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2120). Originally posted by [StarMrGamer](https://github.com/StarMrGamer) on 2026-10-09T09:23:47Z. --- ### What `sceKernelAioPollRequests` was the one export in [Aio.cpp](../../core/libs/prx/libkernel/Aio/src/Aio.cpp) that still called `NotImplemented_nid_no_patch`, while every sibling in the same file is implemented. It reports the state of every listed request, the batch form of `sceKernelAioPollRequest`, which already exists. Validation follows the other batch exports in the file (`sceKernelAioWaitRequests`, `sceKernelAioDeleteRequests`, `sceKernelAioCancelRequests`): null pointers return `EFAULT`, a negative count returns `EINVAL`, and an out-of-range id returns `EINVAL`, all before any state is written. The behaviour matches [shadPS4's `sceKernelAioPollRequests`](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/kernel/aio.cpp) (`state[i] = id_state[id[i]]` for each entry), the same reference the sibling exports in this file already follow and that the TechnicalDebt entry records. ### Tested Linux (CachyOS, GCC 16.2.1, Release, full build): - `ninja -C build libkernel guest_aio_tests` builds. - `ctest --test-dir build -R ^guest_aio$ --output-on-failure` passes. `GuestAio.cpp` now covers the batch poll of completed and aborted requests and its null-pointer, negative-count and invalid-id errors, plus the zero-count no-op. - `python3 tools/check_conventions.py --base origin/main` passes. Windows and PS5 hardware not tested. ### 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-09 09:36:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T09:36:59Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#2051 docs/dev/TechnicalDebt.md L125-126
#2118 core/libs/tests/GuestAio.cpp L147
docs/dev/TechnicalDebt.md L126
sceKernelAioPollRequests
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078335846 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2120#issuecomment-6078335846). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T09:36:59Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #2051 | `docs/dev/TechnicalDebt.md` [L125-126](https://github.com/boykopovar/AnyPS5/blob/d70b89989473ba1f6ae13e44e079e67f1f8a44b0/docs/dev/TechnicalDebt.md#L125-L126) | | | | #2118 | `core/libs/tests/GuestAio.cpp` [L147](https://github.com/boykopovar/AnyPS5/blob/d70b89989473ba1f6ae13e44e079e67f1f8a44b0/core/libs/tests/GuestAio.cpp#L147)<br>`docs/dev/TechnicalDebt.md` [L126](https://github.com/boykopovar/AnyPS5/blob/d70b89989473ba1f6ae13e44e079e67f1f8a44b0/docs/dev/TechnicalDebt.md#L126) | `sceKernelAioPollRequests` | |
MarcZX10 commented 2026-10-09 09:50:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T09:50:35Z.


I compared the full diff with #2118. They implement the same export and behavior; #2118 also tests the 129-ID boundary. #2120 adds no distinct behavior, so I recommend closing it as duplicate and retaining #2118 as canonical. Both heads still target d9484c71; current main is 745b775e2d883c68560b2d87f4ab96a01e221ccf. If this PR is retained instead, please carry over the over-limit regression and rebase on current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078534325 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2120#issuecomment-6078534325). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T09:50:35Z. --- I compared the full diff with #2118. They implement the same export and behavior; #2118 also tests the 129-ID boundary. #2120 adds no distinct behavior, so I recommend closing it as duplicate and retaining #2118 as canonical. Both heads still target `d9484c71`; current `main` is `745b775e2d883c68560b2d87f4ab96a01e221ccf`. If this PR is retained instead, please carry over the over-limit regression and rebase on current `main`.
StarMrGamer commented 2026-10-09 11:17:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by StarMrGamer on 2026-10-09T11:17:27Z.


Thanks — I checked this independently and you're right.

  • #2118 opened 09:16:41Z, #2120 at 09:23:47Z, so #2118 is the earlier implementation.
  • Both add the same sceKernelAioPollRequests body in Aio.cpp (ValidateIds, then the locked loop over g_states).
  • #2118's regression is a superset: the same states and error paths (EFAULT for null pointers, EINVAL for a negative count and an invalid id with the output left untouched, zero count), plus the 129-id over-limit throw that #2120 omits.
  • #2120 adds no distinct behaviour.

Closing #2120 as a duplicate; #2118 is the canonical one. Note that #2118's head still targets d9484c71 while main is now d70b8998, so it needs a rebase before the manual full-build run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6079798011 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2120#issuecomment-6079798011). Originally posted by [StarMrGamer](https://github.com/StarMrGamer) on 2026-10-09T11:17:27Z. --- Thanks — I checked this independently and you're right. - #2118 opened 09:16:41Z, #2120 at 09:23:47Z, so #2118 is the earlier implementation. - Both add the same `sceKernelAioPollRequests` body in Aio.cpp (`ValidateIds`, then the locked loop over `g_states`). - #2118's regression is a superset: the same states and error paths (EFAULT for null pointers, EINVAL for a negative count and an invalid id with the output left untouched, zero count), plus the 129-id over-limit throw that #2120 omits. - #2120 adds no distinct behaviour. Closing #2120 as a duplicate; #2118 is the canonical one. Note that #2118's head still targets `d9484c71` while `main` is now `d70b8998`, so it needs a rebase before the manual full-build run.

Pull request closed

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!2120
No description provided.