fix(libkernel): answer select on the standard and random device descriptors #3476

Merged
alfalfa-star merged 3 commits from upstream-pr/3476 into main 2026-10-11 11:52:22 +00:00
alfalfa-star commented 2026-10-11 11:13:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-11T11:13:01Z.


Carried for @Silverash-i8, who is under the intake limit (#2811). Their three commits are unchanged, with their authorship, on main 99c1c263, from Silverash-i8/AnyPS5-fork:fix/select-non-socket-descriptors.

What

select hands every descriptor to the libSceNet socket poller and aborts on any it doesn't know:

what():  select on descriptors that are not libSceNet sockets not implemented

Unreal Engine 4 titles poll descriptor 0 (stdin) with select for console commands, so they stop there a few seconds in.

Titles:

  • Minecraft Dungeons II (PPSA16064): Windows, reported by @MisterbALLIN in #2811, who confirmed the fix gets it to its menu.
  • RIDE 4 (PPSA01599): Linux, my run. It aborts at the same line on main. With these commits on current main 0f863c102 (no other changes), it gets past the stop, renders the Unreal Engine logo and the legal screen, and next stops at #2548.

Fix

  • 259b9ca6: /dev/random and /dev/urandom descriptors (File::IsRandomDevice) are always readable and writable, as FreeBSD reports a seeded random device. When one is ready, the socket part of the same call doesn't wait.
  • a670e93a: a descriptor select can't poll still throws, and the message now names it (select on descriptor N (not a libSceNet socket), or (libSceNet is not loaded)).
  • 2ba139df: descriptor 0 is never readable and descriptors 1 and 2 are always writable, as for a console title with no input. Reads from descriptor 0 still go to the host stdin. A TechnicalDebt entry records both assumptions.

Any other non-socket descriptor (a pipe, say) still goes to the poller and throws as before.

Tested

  • @Silverash-i8, on Windows 11 (WinLibs GCC 15.2.0 r7, Release):
    • guest_sce_net, with new cases for the random-device and standard-descriptor answers, and the socket tests pass;
    • the non-GPU suite is 457/458; the one failure, windows_exceptions, fails the same way on main (#3411);
    • conventions pass.
  • Me, on Linux (Arch, GCC, Release, RADV):
    • guest_sce_net aborts on main with the line above and passes with these commits;
    • full ctest 825/825 (4 video-out flip tests skipped as usual);
    • the RIDE 4 run above.

I reviewed the change: it is the same answer I had written independently for RIDE 4, plus the random-device case.

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

Closes #2811.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4818634087 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3476). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-11T11:13:01Z. --- Carried for @Silverash-i8, who is under the intake limit (#2811). Their three commits are unchanged, with their authorship, on `main` 99c1c263, from [`Silverash-i8/AnyPS5-fork:fix/select-non-socket-descriptors`](https://github.com/Silverash-i8/AnyPS5-fork/tree/fix/select-non-socket-descriptors). ### What `select` hands every descriptor to the libSceNet socket poller and aborts on any it doesn't know: ```text what(): select on descriptors that are not libSceNet sockets not implemented ``` Unreal Engine 4 titles poll descriptor 0 (stdin) with `select` for console commands, so they stop there a few seconds in. **Titles:** - **Minecraft Dungeons II (PPSA16064)**: Windows, reported by @MisterbALLIN in #2811, who confirmed the fix gets it to its menu. - **RIDE 4 (PPSA01599)**: Linux, my run. It aborts at the same line on `main`. With these commits on current `main` 0f863c102 (no other changes), it gets past the stop, renders the Unreal Engine logo and the legal screen, and next stops at #2548. ### Fix - `259b9ca6`: `/dev/random` and `/dev/urandom` descriptors (`File::IsRandomDevice`) are always readable and writable, as FreeBSD reports a seeded random device. When one is ready, the socket part of the same call doesn't wait. - `a670e93a`: a descriptor `select` can't poll still throws, and the message now names it (`select on descriptor N (not a libSceNet socket)`, or `(libSceNet is not loaded)`). - `2ba139df`: descriptor 0 is never readable and descriptors 1 and 2 are always writable, as for a console title with no input. Reads from descriptor 0 still go to the host stdin. A TechnicalDebt entry records both assumptions. Any other non-socket descriptor (a pipe, say) still goes to the poller and throws as before. ### Tested - @Silverash-i8, on Windows 11 (WinLibs GCC 15.2.0 r7, Release): - `guest_sce_net`, with new cases for the random-device and standard-descriptor answers, and the socket tests pass; - the non-GPU suite is 457/458; the one failure, `windows_exceptions`, fails the same way on `main` (#3411); - conventions pass. - Me, on Linux (Arch, GCC, Release, RADV): - `guest_sce_net` aborts on `main` with the line above and passes with these commits; - full `ctest` 825/825 (4 video-out flip tests skipped as usual); - the RIDE 4 run above. I reviewed the change: it is the same answer I had written independently for RIDE 4, plus the random-device case. ### 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 Closes #2811. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-11 11:13:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T11:13:23Z.


Progress report (0f863c1 → 2ba139d)

📈 System libraries: 85.77% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel select_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108422793 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3476#issuecomment-6108422793). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T11:13:23Z. --- <!-- progress-report --> ### Progress report (0f863c1 → 2ba139d) 📈 **System libraries**: 85.77% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `select_nid_postfix` | </details>
adriadam10 commented 2026-10-11 11:52:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:52:18Z.


Checked on Linux: PR merged onto current main builds, guest_sce_net passes and fails without the Socket.cpp change; the diff keeps unknown non-socket descriptors throwing and TechnicalDebt records the stdio/random-device assumptions. Consistent with the Windows (@Silverash-i8) and RIDE 4 runs in the description; merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108730374 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3476#issuecomment-6108730374). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T11:52:18Z. --- Checked on Linux: PR merged onto current main builds, `guest_sce_net` passes and fails without the Socket.cpp change; the diff keeps unknown non-socket descriptors throwing and TechnicalDebt records the stdio/random-device assumptions. Consistent with the Windows (@Silverash-i8) and RIDE 4 runs in the description; merging once CI is green.
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!3476
No description provided.