feat(libkernel): export _ioctl and getsid #3493

Merged
reyani-dev merged 2 commits from upstream-pr/3493 into main 2026-10-11 21:35:54 +00:00
reyani-dev commented 2026-10-11 11:35:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T11:35:54Z.


What

Exports _ioctl (wW+k21cmbwQ) and getsid (gokWod7GAH4) from libkernel. Both throw: _ioctl names the request it got (_ioctl: request 0x402c7413 not implemented), and getsid reports getsid: process sessions not implemented. No device-control requests or POSIX sessions are modelled, and Windows has no POSIX session to report.

Stremio Plus (PPSA74126) fails to load without them. On Windows, main 03a84d02, catalog build (eboot.bin and sce_module/libc.prx unwrapped), 60 s run:

FAIL: unresolved ELF import wW+k21cmbwQ from libkernel.prx

After _ioctl, the next load stop is gokWod7GAH4 (getsid), the title's last absent import (tools/import_audit.py). With both exported, Stremio Plus loads, runs, and reaches its renderer, where it stops on a graphics state AnyPS5 doesn't support yet:

what():  AGC graphics: last provoking vertex with explicit per-vertex flat interpolation is unsupported

It made no call to either export in that run. The executable's _ioctl call sites (from --registry) are the SDK libc's termios wrappers linked into it:

  • TIOCGETA 0x402c7413 and TIOCSETA/W/F (tcgetattr/tcsetattr);
  • TIOCGPGRP/TIOCSPGRP;
  • TIOCDRAIN, TIOCFLUSH, TIOCSTART/TIOCSTOP, and the like.

They're one per wrapper, which is why the two are needed to load.

guest_ioctl_getsid checks both throws (two requests, two getsid arguments). TechnicalDebt.md records them next to the sigtimedwait entry.

Tested

Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, on main 0f863c10:

  • guest_ioctl_getsid passes 3/3. With Open.cpp and Process.cpp reverted to main it doesn't link.
  • ctest -E "^agc_|video_out": 452/453. The one failure, windows_exceptions, fails on main too (#3411).
  • Stremio Plus run as above (RTX 4070, VK_LOADER_DRIVERS_DISABLE=*dzn* for #3255).
  • check_conventions.py passes. Open PRs that also touch Open.cpp or Process.cpp:
    • #3485, #3465, #3452 and #3428 implement neither function and merge with this one without conflicts;
    • #2144 already conflicts with main on its own.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4818758173 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T11:35:54Z. --- ### What Exports `_ioctl` (`wW+k21cmbwQ`) and `getsid` (`gokWod7GAH4`) from libkernel. Both throw: `_ioctl` names the request it got (`_ioctl: request 0x402c7413 not implemented`), and `getsid` reports `getsid: process sessions not implemented`. No device-control requests or POSIX sessions are modelled, and Windows has no POSIX session to report. Stremio Plus (PPSA74126) fails to load without them. On Windows, `main` `03a84d02`, catalog build (`eboot.bin` and `sce_module/libc.prx` unwrapped), 60 s run: ``` FAIL: unresolved ELF import wW+k21cmbwQ from libkernel.prx ``` After `_ioctl`, the next load stop is `gokWod7GAH4` (`getsid`), the title's last absent import (`tools/import_audit.py`). With both exported, Stremio Plus loads, runs, and reaches its renderer, where it stops on a graphics state AnyPS5 doesn't support yet: ``` what(): AGC graphics: last provoking vertex with explicit per-vertex flat interpolation is unsupported ``` It made no call to either export in that run. The executable's `_ioctl` call sites (from `--registry`) are the SDK libc's `termios` wrappers linked into it: - `TIOCGETA` `0x402c7413` and `TIOCSETA`/`W`/`F` (`tcgetattr`/`tcsetattr`); - `TIOCGPGRP`/`TIOCSPGRP`; - `TIOCDRAIN`, `TIOCFLUSH`, `TIOCSTART`/`TIOCSTOP`, and the like. They're one per wrapper, which is why the two are needed to load. `guest_ioctl_getsid` checks both throws (two requests, two `getsid` arguments). `TechnicalDebt.md` records them next to the `sigtimedwait` entry. ### Tested Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, on `main` `0f863c10`: - `guest_ioctl_getsid` passes 3/3. With `Open.cpp` and `Process.cpp` reverted to `main` it doesn't link. - `ctest -E "^agc_|video_out"`: 452/453. The one failure, `windows_exceptions`, fails on `main` too (#3411). - Stremio Plus run as above (RTX 4070, `VK_LOADER_DRIVERS_DISABLE=*dzn*` for #3255). - `check_conventions.py` passes. Open PRs that also touch `Open.cpp` or `Process.cpp`: - #3485, #3465, #3452 and #3428 implement neither function and merge with this one without conflicts; - #2144 already conflicts with `main` on its own. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-11 11:36:17 +00:00 (Migrated from github.com)

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


Progress report (a9a34e9 → 76d43c5)

📉 System libraries: 85.96% (-0.03%, +1 declared functions)

🆕 1 declared as stubs
Library Name
libkernel getsid_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108604428 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493#issuecomment-6108604428). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T11:36:17Z. --- <!-- progress-report --> ### Progress report (a9a34e9 → 76d43c5) 📉 **System libraries**: 85.96% (-0.03%, +1 declared functions) <details> <summary>🆕 1 declared as stubs</summary> | Library | Name | | - | - | | libkernel | `getsid_nid_postfix` | </details>
MarcZX10 commented 2026-10-11 11:50:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T11:50:29Z.


The overlap check now reports #3487, which also changes _ioctl_nid_postfix in Open.cpp but forwards to the existing ioctl implementation and has coverage for the supported socket requests. This PR adds a throwing _ioctl stub for the same export, so the two heads cannot both be applied as written and the behaviors differ.

Could you coordinate the getsid addition with #3487's author or make this depend on #3487 and limit this branch to getsid? That would preserve the implemented _ioctl behavior while retaining the separate load fix here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108716118 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493#issuecomment-6108716118). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T11:50:29Z. --- The overlap check now reports #3487, which also changes `_ioctl_nid_postfix` in `Open.cpp` but forwards to the existing `ioctl` implementation and has coverage for the supported socket requests. This PR adds a throwing `_ioctl` stub for the same export, so the two heads cannot both be applied as written and the behaviors differ. Could you coordinate the `getsid` addition with #3487's author or make this depend on #3487 and limit this branch to `getsid`? That would preserve the implemented `_ioctl` behavior while retaining the separate load fix here.
adriadam10 commented 2026-10-11 12:02:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T12:02:25Z.


Thanks. #3487 merged _ioctl (forwarding to the existing ioctl) while this was open, so both heads together define _ioctl_nid_postfix twice. I pushed a commit that keeps only getsid:

  • Removed _ioctl from Open.cpp and its two rows from GuestIoctlGetsid.cpp.
  • Rewrote the TechnicalDebt entry for getsid alone.

Checked on current main + this branch: guest_ioctl_getsid, guest_udp, guest_sigtimedwait pass, and the getsid test doesn't link without the change. getsid throwing is exact-or-throw (no sessions modelled). Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108810330 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493#issuecomment-6108810330). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T12:02:25Z. --- Thanks. #3487 merged `_ioctl` (forwarding to the existing `ioctl`) while this was open, so both heads together define `_ioctl_nid_postfix` twice. I pushed a commit that keeps only `getsid`: - Removed `_ioctl` from `Open.cpp` and its two rows from `GuestIoctlGetsid.cpp`. - Rewrote the TechnicalDebt entry for `getsid` alone. Checked on current `main` + this branch: `guest_ioctl_getsid`, `guest_udp`, `guest_sigtimedwait` pass, and the `getsid` test doesn't link without the change. `getsid` throwing is exact-or-throw (no sessions modelled). Merging once CI is green.
adriadam10 commented 2026-10-11 12:07:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T12:07:27Z.


Thanks. #3487 merged _ioctl (forwarding to the existing ioctl) while this was open, so both heads together define _ioctl_nid_postfix twice. I pushed a commit that keeps only getsid:

  • Removed _ioctl from Open.cpp and its two rows from GuestIoctlGetsid.cpp.
  • Rewrote the TechnicalDebt entry for getsid alone.

Checked on current main + this branch: guest_ioctl_getsid, guest_udp, guest_sigtimedwait pass, and the getsid test doesn't link without the change. getsid throwing is exact-or-throw (no sessions modelled). Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108851351 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493#issuecomment-6108851351). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T12:07:27Z. --- Thanks. #3487 merged `_ioctl` (forwarding to the existing `ioctl`) while this was open, so both heads together define `_ioctl_nid_postfix` twice. I pushed a commit that keeps only `getsid`: - Removed `_ioctl` from `Open.cpp` and its two rows from `GuestIoctlGetsid.cpp`. - Rewrote the TechnicalDebt entry for `getsid` alone. Checked on current `main` + this branch: `guest_ioctl_getsid`, `guest_udp`, `guest_sigtimedwait` pass, and the `getsid` test doesn't link without the change. `getsid` throwing is exact-or-throw (no sessions modelled). Merging once CI is green.
reyani-dev commented 2026-10-11 13:01:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T13:01:38Z.


Thanks @adriadam10 for trimming it to getsid. #3487's forwarding _ioctl is the better export; Stremio Plus only needs it to exist.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109295256 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493#issuecomment-6109295256). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T13:01:38Z. --- Thanks @adriadam10 for trimming it to `getsid`. #3487's forwarding `_ioctl` is the better export; Stremio Plus only needs it to exist.
github-actions[bot] commented 2026-10-11 14:28:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T14:28:39Z.


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
#3580 docs/dev/TechnicalDebt.md L602
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110055812 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493#issuecomment-6110055812). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T14:28:39Z. --- <!-- 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 | |---|---|---|---| | #3580 | `docs/dev/TechnicalDebt.md` [L602](https://github.com/boykopovar/AnyPS5/blob/41f013f664f6ec36a8111f2c6f9772b76e562288/docs/dev/TechnicalDebt.md#L602) | | |
babyhuey commented 2026-10-11 20:32:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T20:32:35Z.


I checked this PR on both OSes with Stremio Plus (PPSA74126, catalog build), merged onto main 0a8b1d32 (test merge aa75c723).

  • main, Windows: FAIL: unresolved ELF import gokWod7GAH4 (getsid) from libkernel.prx
  • With this PR, Linux: every import loads, and it runs until the headless DisplayWindow (the runner has no display).
  • With this PR, Windows 11 (MinGW GCC 15.2): it gets past the entry point, opens a 1920x1080 Vulkan window, compiles shaders and uploads textures. It then stops at the separate AGC gap last provoking vertex with explicit per-vertex flat interpolation is unsupported (#3581). getsid is not called before that point.
  • guest_ioctl_getsid passes 5/5 (--repeat until-fail:5) on both. No warnings in Process.cpp or GuestIoctlGetsid.cpp.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113441173 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493#issuecomment-6113441173). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T20:32:35Z. --- I checked this PR on both OSes with Stremio Plus (PPSA74126, catalog build), merged onto `main` 0a8b1d32 (test merge aa75c723). - `main`, Windows: `FAIL: unresolved ELF import gokWod7GAH4 (getsid) from libkernel.prx` - With this PR, Linux: every import loads, and it runs until the headless `DisplayWindow` (the runner has no display). - With this PR, Windows 11 (MinGW GCC 15.2): it gets past the entry point, opens a 1920x1080 Vulkan window, compiles shaders and uploads textures. It then stops at the separate AGC gap `last provoking vertex with explicit per-vertex flat interpolation is unsupported` (#3581). `getsid` is not called before that point. - `guest_ioctl_getsid` passes 5/5 (`--repeat until-fail:5`) on both. No warnings in `Process.cpp` or `GuestIoctlGetsid.cpp`.
adriadam10 commented 2026-10-11 21:28:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:28:51Z.


The red checks were not caused by this PR: conventions and relinker failed at checkout (No url found for submodule path '3rdparty/imgui'), a stray gitlink that was on main and is now removed (fab9f576a). A rerun reused the old merge commit, so I rebased the branch onto current main (no conflicts, no logic change) to get fresh CI. guest_ioctl_getsid and the scoped ctest (113 tests) pass on the rebased head. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113975070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3493#issuecomment-6113975070). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T21:28:51Z. --- The red checks were not caused by this PR: `conventions` and `relinker` failed at checkout (`No url found for submodule path '3rdparty/imgui'`), a stray gitlink that was on `main` and is now removed (fab9f576a). A rerun reused the old merge commit, so I rebased the branch onto current `main` (no conflicts, no logic change) to get fresh CI. `guest_ioctl_getsid` and the scoped ctest (113 tests) pass on the rebased head. 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!3493
No description provided.