feat(libkernel): export sigtimedwait #3430

Merged
reyani-dev merged 1 commit from upstream-pr/3430 into main 2026-10-11 10:36:53 +00:00
reyani-dev commented 2026-10-11 10:25:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T10:25:12Z.


What

Exports sigtimedwait (D2-dIoJ0ZtE) from libkernel; it throws sigtimedwait: waiting for a pending signal not implemented.

VLC (PPSA85300) imports it and fails to load without it. @babyhuey's run in #1578 shows it as VLC's next stop once the rand48 exports (#3424, merged) are in, so it is the stop on current main, on Linux with a catalog build (sce_module/libc.prx unwrapped as #2605 requires):

app.elf: symbol lookup error: app.elf: undefined symbol: D2-dIoJ0ZtE

Why a throw is enough for VLC. The relinker's registry for VLC's executable lists one call site for the import (0x3DF955). The surrounding code (0x3DF8C0–0x3DF9CD) is VLC's vlc_write → vlc_writev from src/posix/filesystem.c, instruction for instruction:

  • sigaddset(&set, 13), then pthread_sigmask(SIG_BLOCK, ...), then writev;
  • only when that returns < 0 with errno == 32 (EPIPE): while (sigtimedwait(&set, &info, &ts{0, 0}) >= 0 || errno != 35);;
  • then sigismember(&oset, 13) and the mask restore.

So VLC reaches sigtimedwait only after a write to a broken pipe or socket, to drain the SIGPIPE. AnyPS5 never leaves a guest signal pending: raise delivers at once and does not consult the blocked mask, so there is nothing to wait for or take. A real implementation needs a pending-signal model, which doesn't exist yet; until then the call throws instead of guessing.

guest_sigtimedwait checks the throw for a zero timeout, a one-second timeout and a null timeout. TechnicalDebt.md records the call site, next to the daemon entry for the same title.

Tested

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

  • guest_sigtimedwait and guest_signals pass 3/3. Without the export, guest_sigtimedwait doesn't link.
  • ctest -E "^agc_|video_out": 445/447. windows_exceptions (#3411) and guest_ampr_markers fail on main here too.
  • check_conventions.py passes. No open PR touches Signals.cpp or the new test, and in libkernel/CMakeLists.txt, the only file shared with an open PR (#2054), the two merge without a conflict. I checked through the API, since pr_overlap.py currently fails on #3418 (#3427).

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:4818376545 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3430). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T10:25:12Z. --- ### What Exports `sigtimedwait` (`D2-dIoJ0ZtE`) from libkernel; it throws `sigtimedwait: waiting for a pending signal not implemented`. VLC (PPSA85300) imports it and fails to load without it. @babyhuey's run in #1578 shows it as VLC's next stop once the `rand48` exports (#3424, merged) are in, so it is the stop on current `main`, on Linux with a catalog build (`sce_module/libc.prx` unwrapped as #2605 requires): ``` app.elf: symbol lookup error: app.elf: undefined symbol: D2-dIoJ0ZtE ``` **Why a throw is enough for VLC.** The relinker's registry for VLC's executable lists one call site for the import (`0x3DF955`). The surrounding code (`0x3DF8C0`–`0x3DF9CD`) is VLC's `vlc_write` → `vlc_writev` from [`src/posix/filesystem.c`](https://github.com/videolan/vlc/blob/6de05adcbaf2e8b85fe86aad4169393098628119/src/posix/filesystem.c#L243-L278), instruction for instruction: - `sigaddset(&set, 13)`, then `pthread_sigmask(SIG_BLOCK, ...)`, then `writev`; - only when that returns < 0 with `errno == 32` (`EPIPE`): `while (sigtimedwait(&set, &info, &ts{0, 0}) >= 0 || errno != 35);`; - then `sigismember(&oset, 13)` and the mask restore. So VLC reaches `sigtimedwait` only after a write to a broken pipe or socket, to drain the `SIGPIPE`. AnyPS5 never leaves a guest signal pending: `raise` delivers at once and does not consult the blocked mask, so there is nothing to wait for or take. A real implementation needs a pending-signal model, which doesn't exist yet; until then the call throws instead of guessing. `guest_sigtimedwait` checks the throw for a zero timeout, a one-second timeout and a null timeout. `TechnicalDebt.md` records the call site, next to the `daemon` entry for the same title. ### Tested Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, on `main` `68ae2a89`: - `guest_sigtimedwait` and `guest_signals` pass 3/3. Without the export, `guest_sigtimedwait` doesn't link. - `ctest -E "^agc_|video_out"`: 445/447. `windows_exceptions` (#3411) and `guest_ampr_markers` fail on `main` here too. - `check_conventions.py` passes. No open PR touches `Signals.cpp` or the new test, and in `libkernel/CMakeLists.txt`, the only file shared with an open PR (#2054), the two merge without a conflict. I checked through the API, since `pr_overlap.py` currently fails on #3418 (#3427). ### 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 10:25:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T10:25:32Z.


Progress report (99c1c26 → 2a2696b)

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

🆕 1 declared as stubs
Library Name
libkernel sigtimedwait_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108054863 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3430#issuecomment-6108054863). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T10:25:32Z. --- <!-- progress-report --> ### Progress report (99c1c26 → 2a2696b) 📉 **System libraries**: 85.73% (-0.03%, +1 declared functions) <details> <summary>🆕 1 declared as stubs</summary> | Library | Name | | - | - | | libkernel | `sigtimedwait_nid_postfix` | </details>
adriadam10 commented 2026-10-11 10:36:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:36:50Z.


Checked the build and guest_sigtimedwait / guest_signals on Linux; the NID D2-dIoJ0ZtE matches sigtimedwait, the test is registered in ctest and the TechnicalDebt line is in place. Throwing is right while guest signals are never left pending; merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108140747 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3430#issuecomment-6108140747). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T10:36:50Z. --- Checked the build and `guest_sigtimedwait` / `guest_signals` on Linux; the NID `D2-dIoJ0ZtE` matches `sigtimedwait`, the test is registered in ctest and the TechnicalDebt line is in place. Throwing is right while guest signals are never left pending; 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!3430
No description provided.