feat(libSceNpUtility): implement lookup async requests, waits and timeouts #10640

Merged
rocklouis055 merged 4 commits from upstream-pr/10640 into main 2026-10-26 02:43:04 +00:00
rocklouis055 commented 2026-10-24 14:13:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rocklouis055 on 2026-10-24T14:13:42Z.


What

Implements seven libSceNpUtility exports on the existing offline request model: sceNpLookupAbortRequest, sceNpLookupCreateAsyncRequest, sceNpLookupPollAsync, sceNpLookupWaitAsync, sceNpLookupSetTimeout, sceNpWordFilterSetTimeout and sceNpWordFilterWaitAsync.

  • Abort, poll and wait are shared helpers for both services; sceNpWordFilterAbortRequest and sceNpWordFilterPollAsync now use them, with unchanged results.
  • A wait blocks on a per-service condition variable that a request's completion, abort and deletion signal, so it does not poll. A wait on a request deleted meanwhile returns INVALID_ID.
  • sceNpLookupCreateAsyncRequest takes the same 0x18-byte parameter as sceNpWordFilterCreateAsyncRequest.
  • The timeout setters check their arguments and the id (a title context or a request of that service) and then have no effect, since no request reaches a server.
  • Checks and results follow shadPS4's calls at cc4dbd45, offline and not measured on a console; recorded in docs/dev/debt/libSceNpUtility.md. The seven names leave the unknown-signature entries.

Tested

Linux x86-64 (Ubuntu 26.04, GCC 15), Release: guest_np_utility_offline extended with the lookup async path (argument and size checks, poll before and after, a wait woken by the lookup starting, by an abort and by a deletion, a wait on a finished synchronous request), the word filter wait and both timeout setters (each bound, the no-effect combination, unknown and cross-service ids). Passes, also 30 times with ctest --repeat until-fail:30 and 50 direct runs. Windows 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 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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4996131877 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10640). Originally posted by [rocklouis055](https://github.com/rocklouis055) on 2026-10-24T14:13:42Z. --- ### What Implements seven libSceNpUtility exports on the existing offline request model: `sceNpLookupAbortRequest`, `sceNpLookupCreateAsyncRequest`, `sceNpLookupPollAsync`, `sceNpLookupWaitAsync`, `sceNpLookupSetTimeout`, `sceNpWordFilterSetTimeout` and `sceNpWordFilterWaitAsync`. - Abort, poll and wait are shared helpers for both services; `sceNpWordFilterAbortRequest` and `sceNpWordFilterPollAsync` now use them, with unchanged results. - A wait blocks on a per-service condition variable that a request's completion, abort and deletion signal, so it does not poll. A wait on a request deleted meanwhile returns `INVALID_ID`. - `sceNpLookupCreateAsyncRequest` takes the same 0x18-byte parameter as `sceNpWordFilterCreateAsyncRequest`. - The timeout setters check their arguments and the id (a title context or a request of that service) and then have no effect, since no request reaches a server. - Checks and results follow shadPS4's calls at `cc4dbd45`, offline and not measured on a console; recorded in `docs/dev/debt/libSceNpUtility.md`. The seven names leave the unknown-signature entries. ### Tested Linux x86-64 (Ubuntu 26.04, GCC 15), Release: `guest_np_utility_offline` extended with the lookup async path (argument and size checks, poll before and after, a wait woken by the lookup starting, by an abort and by a deletion, a wait on a finished synchronous request), the word filter wait and both timeout setters (each bound, the no-effect combination, unknown and cross-service ids). Passes, also 30 times with `ctest --repeat until-fail:30` and 50 direct runs. Windows not tested. ### 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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-24 14:19:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T14:19:24Z.

Review: COMMENTED


Reviewed exact head d7bee0e8a7a8137ee2cc02f87c7262910d56c614. The shared wait helper re-finds the request under the service mutex in its predicate, and completion, abort, and deletion notify the condition variable; I did not find a concrete defect in that state handling. One test-quality point: WaitInThread sleeps for 20 ms before invoking the completion/abort/deletion callback, but that delay does not prove the waiter has entered the blocked wait. If the test process is descheduled, the callback may happen first and the test can pass without exercising the wakeup path. A deterministic handshake or an observable waiter-ready condition would make the reported wakeup coverage stronger. Hosted eligibility, conventions, intake, labels and report checks pass; Linux/Windows product jobs were skipped. I have not independently run the reported 30-repeat test suite.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638571172 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10640#pullrequestreview-5638571172). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T14:19:24Z. **Review:** COMMENTED --- Reviewed exact head d7bee0e8a7a8137ee2cc02f87c7262910d56c614. The shared wait helper re-finds the request under the service mutex in its predicate, and completion, abort, and deletion notify the condition variable; I did not find a concrete defect in that state handling. One test-quality point: `WaitInThread` sleeps for 20 ms before invoking the completion/abort/deletion callback, but that delay does not prove the waiter has entered the blocked wait. If the test process is descheduled, the callback may happen first and the test can pass without exercising the wakeup path. A deterministic handshake or an observable waiter-ready condition would make the reported wakeup coverage stronger. Hosted eligibility, conventions, intake, labels and report checks pass; Linux/Windows product jobs were skipped. I have not independently run the reported 30-repeat test suite.
MarcZX10 commented 2026-10-24 14:49:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T14:49:02Z.

Review: COMMENTED


Follow-up review of exact head 4a45a249ad46b1d7cc07c9828a295d04fca529e5. The new returned check before the callback is a useful improvement: it makes a wait implementation that returns immediately fail, and the author reports that mutation was caught along with repeated successful runs. One residual timing gap remains, as the author also notes: entered is set immediately before the wait call, so a waiter descheduled there for the whole delay could let the callback run before the blocking path is reached. This is a nonblocking test-quality observation; I have not independently run the reported repeated suite.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638656003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10640#pullrequestreview-5638656003). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T14:49:02Z. **Review:** COMMENTED --- Follow-up review of exact head `4a45a249ad46b1d7cc07c9828a295d04fca529e5`. The new `returned` check before the callback is a useful improvement: it makes a wait implementation that returns immediately fail, and the author reports that mutation was caught along with repeated successful runs. One residual timing gap remains, as the author also notes: `entered` is set immediately before the wait call, so a waiter descheduled there for the whole delay could let the callback run before the blocking path is reached. This is a nonblocking test-quality observation; I have not independently run the reported repeated suite.
MarcZX10 commented 2026-10-24 15:26:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T15:26:05Z.

Review: APPROVED


Reviewed exact head 4a45a249ad46b1d7cc07c9828a295d04fca529e5. The shared request helpers keep all map and status access under each service mutex; waits re-find the request in the condition-variable predicate, and completion, abort and deletion notify waiters. Timeout bounds and offline no-effect semantics are recorded in the debt entry, and the tests cover lookup/word-filter paths, wrong IDs/services, null results, synchronous completion and wakeup by completion/abort/deletion. The author strengthened the wait test so an immediate-return implementation fails; the remaining scheduling caveat is acknowledged and does not block this review. Exact-head git diff --check, conventions and merge-tree pass; hosted eligibility, conventions, labels and report pass, with product jobs skipped. The repeated Linux test run is author-reported; I did not independently execute it.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638776935 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10640#pullrequestreview-5638776935). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T15:26:05Z. **Review:** APPROVED --- Reviewed exact head `4a45a249ad46b1d7cc07c9828a295d04fca529e5`. The shared request helpers keep all map and status access under each service mutex; waits re-find the request in the condition-variable predicate, and completion, abort and deletion notify waiters. Timeout bounds and offline no-effect semantics are recorded in the debt entry, and the tests cover lookup/word-filter paths, wrong IDs/services, null results, synchronous completion and wakeup by completion/abort/deletion. The author strengthened the wait test so an immediate-return implementation fails; the remaining scheduling caveat is acknowledged and does not block this review. Exact-head `git diff --check`, conventions and merge-tree pass; hosted eligibility, conventions, labels and report pass, with product jobs skipped. The repeated Linux test run is author-reported; I did not independently execute it.
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!10640
No description provided.