feat(libkernel): implement pthread_sigmask #2106

Closed
LeandroLP23 wants to merge 1 commit from upstream-pr/2106 into main
LeandroLP23 commented 2026-10-09 08:41:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-09T08:41:26Z.


What

PICO-8 for PS5 (PPSA99808 v0.1.2, RafaelNGP/pico8-ps5, GPL-3.0) stops at start-up on this import once its earlier stops resolve (chain in #1578):

FAIL: unresolved ELF import JZKw5+Wrnaw from libkernel.prx

JZKw5+Wrnaw is pthread_sigmask (tools/nid_names.py). It follows FreeBSD libthr's, which calls sigprocmask and returns the error number instead of setting errno:

  • it goes through the existing _sigprocmask, so it shares that function's process-wide mask; FreeBSD keeps one per thread, recorded in TechnicalDebt;
  • how outside SIG_BLOCK/SIG_UNBLOCK/SIG_SETMASK with a set returns EINVAL, leaves the mask and the old set untouched and does not change errno; with a null set how is ignored, as in FreeBSD's kern_sigprocmask.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, Release, main d70b8998:

  • PICO-8, with the earlier stops' pull requests merged locally, gets past this import and stops at the next one, vhtcIgZG-Lk from libSceLibcInternal.prx (realpath, #1692).
  • guest_signals checks blocking through pthread_sigmask and reading it back through sigprocmask, unblocking, the null-set query, and EINVAL for how 0 and 4 without touching errno.
  • tools/check_conventions.py passes.

Fork CI on this head rebased onto main d70b8998 (with the build workflow from before 0ab2a04d, since the new one needs an upstream pull request number): https://github.com/LeandroLP23/AnyPS5/actions/runs/37921135437, all jobs pass (Windows 507/507, Linux 516/516).

#1916 (sigaction) also appends to GuestSignals.cpp; whichever merges second needs a one-line rebase.

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 (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4798130020 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-09T08:41:26Z. --- ### What PICO-8 for PS5 (PPSA99808 v0.1.2, [RafaelNGP/pico8-ps5](https://github.com/RafaelNGP/pico8-ps5), GPL-3.0) stops at start-up on this import once its earlier stops resolve (chain in [#1578](https://github.com/boykopovar/AnyPS5/issues/1578#issuecomment-6077078296)): ``` FAIL: unresolved ELF import JZKw5+Wrnaw from libkernel.prx ``` `JZKw5+Wrnaw` is `pthread_sigmask` (`tools/nid_names.py`). It follows FreeBSD libthr's, which calls `sigprocmask` and returns the error number instead of setting `errno`: - it goes through the existing `_sigprocmask`, so it shares that function's process-wide mask; FreeBSD keeps one per thread, recorded in TechnicalDebt; - `how` outside `SIG_BLOCK`/`SIG_UNBLOCK`/`SIG_SETMASK` with a set returns `EINVAL`, leaves the mask and the old set untouched and does not change `errno`; with a null set `how` is ignored, as in FreeBSD's `kern_sigprocmask`. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, Release, `main` d70b8998: - PICO-8, with the earlier stops' pull requests merged locally, gets past this import and stops at the next one, `vhtcIgZG-Lk` from `libSceLibcInternal.prx` (`realpath`, #1692). - `guest_signals` checks blocking through `pthread_sigmask` and reading it back through `sigprocmask`, unblocking, the null-set query, and `EINVAL` for `how` 0 and 4 without touching `errno`. - `tools/check_conventions.py` passes. Fork CI on this head rebased onto `main` d70b8998 (with the build workflow from before 0ab2a04d, since the new one needs an upstream pull request number): https://github.com/LeandroLP23/AnyPS5/actions/runs/37921135437, all jobs pass (Windows 507/507, Linux 516/516). #1916 (`sigaction`) also appends to `GuestSignals.cpp`; whichever merges second needs a one-line rebase. ### 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 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 (Claude Code)
github-actions[bot] commented 2026-10-09 08:56:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T08:56:17Z.


Progress report (8b393b6 → 97f6541)

📈 System libraries: 84.7% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel pthread_sigmask_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077727506 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6077727506). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T08:56:17Z. --- <!-- progress-report --> ### Progress report (8b393b6 → 97f6541) 📈 **System libraries**: 84.7% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `pthread_sigmask_nid_postfix` | </details>
adriadam10 commented 2026-10-09 21:50:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:50:49Z.


Closing for now: pthread_sigmask isn't a title's next stop on main. In the PICO-8 (PPSA99808) chain from #1578 it comes after pthread_setcanceltype, lstat, sigaction and other imports that are still unresolved, which is the same situation as #1692 (realpath), closed for that reason. The change itself looks right: it goes through _sigprocmask, EINVAL leaves errno alone, and the TechnicalDebt line records the process-wide mask.

Feel free to reopen, rebased, once a title stops on this import on main, with the log line in the description.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089851068 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6089851068). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-09T21:50:49Z. --- Closing for now: `pthread_sigmask` isn't a title's next stop on `main`. In the PICO-8 (PPSA99808) chain from #1578 it comes after `pthread_setcanceltype`, `lstat`, `sigaction` and other imports that are still unresolved, which is the same situation as #1692 (`realpath`), closed for that reason. The change itself looks right: it goes through `_sigprocmask`, `EINVAL` leaves `errno` alone, and the TechnicalDebt line records the process-wide mask. Feel free to reopen, rebased, once a title stops on this import on `main`, with the log line in the description.
overlordxrz-source commented 2026-10-10 01:38:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-10T01:38:28Z.


@LeandroLP23 @adriadam10 pthread_sigmask is now a title's next stop on main. On our Linux rig, built from plain main at 7a7eb369f359aedbea1f60f148ecbff85b0986c7, both of these stop there:

./app.elf: symbol lookup error: ./app.elf: undefined symbol: JZKw5+Wrnaw
./app.elf: symbol lookup error: ./app.elf: undefined symbol: JZKw5+Wrnaw

Yamagi Quake II (PPSA99007) gets past system() (#1859) and now stops at JZKw5+Wrnaw = pthread_sigmask. Ruffle (PPSA68091) reaches the same import on main + #2028 (ModuleList/ModuleInfo). Could #2106 be reopened? We're happy to retest it on the rig against both titles.

AI-assisted: yes (the analysis; the rig run and logs are real).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6092267088 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6092267088). Originally posted by [overlordxrz-source](https://github.com/overlordxrz-source) on 2026-10-10T01:38:28Z. --- @LeandroLP23 @adriadam10 `pthread_sigmask` is now a title's next stop on `main`. On our Linux rig, built from plain `main` at 7a7eb369f359aedbea1f60f148ecbff85b0986c7, both of these stop there: ``` ./app.elf: symbol lookup error: ./app.elf: undefined symbol: JZKw5+Wrnaw ./app.elf: symbol lookup error: ./app.elf: undefined symbol: JZKw5+Wrnaw ``` Yamagi Quake II (PPSA99007) gets past `system()` (#1859) and now stops at `JZKw5+Wrnaw` = `pthread_sigmask`. Ruffle (PPSA68091) reaches the same import on main + #2028 (ModuleList/ModuleInfo). Could #2106 be reopened? We're happy to retest it on the rig against both titles. AI-assisted: yes (the analysis; the rig run and logs are real).
overlordxrz-source commented 2026-10-10 01:45:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-10T01:45:30Z.


@adriadam10 quick question while I'm here: I've got a Linux rig running the homebrew catalog against main plus my PRs, and I'm looking to point it at whatever helps most. Is there a specific area (titles, subsystems, retests) where you'd appreciate a hand? Happy to take direction.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6092328056 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6092328056). Originally posted by [overlordxrz-source](https://github.com/overlordxrz-source) on 2026-10-10T01:45:30Z. --- @adriadam10 quick question while I'm here: I've got a Linux rig running the homebrew catalog against main plus my PRs, and I'm looking to point it at whatever helps most. Is there a specific area (titles, subsystems, retests) where you'd appreciate a hand? Happy to take direction.
babyhuey commented 2026-10-10 02:24:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T02:24:49Z.


This is now a title's next stop on current main, so here is the log line the close note asked for, plus a check of this branch.

Checked 97f6541b merged onto main c963432d, Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC from WinLibs), Release. The only conflict is in GuestSignals.cpp, where main added the sigaction checks at the end of main(); I kept your pthread_sigmask block right after the sigprocmask lines it builds on, followed by main's block.

  • guest_signals passes 5/5 on both (--repeat until-fail:5); no compiler warnings and no CRT assertion dialog on Windows.
  • Yamagi Quake II (PPSA99007) stops at pthread_sigmask on main:
    • Windows main: FAIL: unresolved ELF import JZKw5+Wrnaw (pthread_sigmask) from libkernel.prx
    • With this branch, Linux: app.elf: symbol lookup error: app.elf: undefined symbol: oxMp8uPqa+U (pthread_set_name_np)
    • With this branch, Windows: FAIL: unresolved ELF import oxMp8uPqa+U (pthread_set_name_np) from libkernel.prx

Four more titles reach pthread_sigmask once the PR before it in their chain is in, on both Linux and Windows: VITA5 (PPSA39410), PS5 OpenGL Showcase (PPSA99005) and Homebrew UI Lab (PPSA99050) after _umtx_op (#1482), and ScreenTester5 (PPSA69420) after pthread_set_name_np (#1872).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6092698668 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6092698668). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-10T02:24:49Z. --- This is now a title's next stop on current `main`, so here is the log line the close note asked for, plus a check of this branch. Checked 97f6541b merged onto `main` c963432d, Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC from WinLibs), Release. The only conflict is in `GuestSignals.cpp`, where `main` added the `sigaction` checks at the end of `main()`; I kept your `pthread_sigmask` block right after the `sigprocmask` lines it builds on, followed by `main`'s block. - `guest_signals` passes 5/5 on both (`--repeat until-fail:5`); no compiler warnings and no CRT assertion dialog on Windows. - Yamagi Quake II (PPSA99007) stops at `pthread_sigmask` on `main`: - Windows `main`: `FAIL: unresolved ELF import JZKw5+Wrnaw (pthread_sigmask) from libkernel.prx` - With this branch, Linux: `app.elf: symbol lookup error: app.elf: undefined symbol: oxMp8uPqa+U` (`pthread_set_name_np`) - With this branch, Windows: `FAIL: unresolved ELF import oxMp8uPqa+U (pthread_set_name_np) from libkernel.prx` Four more titles reach `pthread_sigmask` once the PR before it in their chain is in, on both Linux and Windows: VITA5 (PPSA39410), PS5 OpenGL Showcase (PPSA99005) and Homebrew UI Lab (PPSA99050) after `_umtx_op` (#1482), and ScreenTester5 (PPSA69420) after `pthread_set_name_np` (#1872).
LeandroLP23 commented 2026-10-10 07:19:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-10T07:19:32Z.


I can't reopen this myself (GitHub only lets a maintainer reopen it). Yamagi Quake II (PPSA99007) now stops on pthread_sigmask on main, as @overlordxrz-source and @babyhuey showed above (FAIL: unresolved ELF import JZKw5+Wrnaw (pthread_sigmask) from libkernel.prx). @adriadam10, if you reopen it, I'll push the rebase right away: it's ready on main 04d06f0d, with the GuestSignals.cpp conflict resolved the same way as @babyhuey's check. guest_signals passes 5/5 and the full non-GPU ctest passes on Windows.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095055479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6095055479). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-10T07:19:32Z. --- I can't reopen this myself (GitHub only lets a maintainer reopen it). Yamagi Quake II (PPSA99007) now stops on `pthread_sigmask` on `main`, as @overlordxrz-source and @babyhuey showed above (`FAIL: unresolved ELF import JZKw5+Wrnaw (pthread_sigmask) from libkernel.prx`). @adriadam10, if you reopen it, I'll push the rebase right away: it's ready on `main` 04d06f0d, with the `GuestSignals.cpp` conflict resolved the same way as @babyhuey's check. `guest_signals` passes 5/5 and the full non-GPU ctest passes on Windows.
LeandroLP23 commented 2026-10-10 08:29:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-10T08:29:58Z.


A second title stops here on Windows: ps5-opengl (PPSA99005 v1.0.1). On main 89a1fb4e with #1482 (_umtx_op) merged, its next stop is

FAIL: unresolved ELF import JZKw5+Wrnaw from libkernel.prx

With the rebase of this PR on top it goes on to pthread_set_name_np (oxMp8uPqa+U). Radeon 860M, Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095690908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6095690908). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-10T08:29:58Z. --- A second title stops here on Windows: ps5-opengl (PPSA99005 v1.0.1). On `main` 89a1fb4e with #1482 (`_umtx_op`) merged, its next stop is ``` FAIL: unresolved ELF import JZKw5+Wrnaw from libkernel.prx ``` With the rebase of this PR on top it goes on to `pthread_set_name_np` (`oxMp8uPqa+U`). Radeon 860M, Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release.
LeandroLP23 commented 2026-10-10 13:26:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-10T13:26:09Z.


Update: in @babyhuey's new table on #1578 (comment, Linux main 197ffac9 and Windows main cf8b129e), pthread_sigmask is now the next stop on main for five titles: Ruffle (PPSA68091), Yamagi Quake II (PPSA99007), Prospero Explorer (PPSA99109), Prospero Multi Tools (PPSA99110) and Prospero Vibrate (PPSA99920). The rebase is still ready and still applies cleanly to current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6097973435 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6097973435). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-10T13:26:09Z. --- Update: in @babyhuey's new table on #1578 ([comment](https://github.com/boykopovar/AnyPS5/issues/1578#issuecomment-6097752724), Linux `main` 197ffac9 and Windows `main` cf8b129e), `pthread_sigmask` is now the next stop on `main` for five titles: Ruffle (PPSA68091), Yamagi Quake II (PPSA99007), Prospero Explorer (PPSA99109), Prospero Multi Tools (PPSA99110) and Prospero Vibrate (PPSA99920). The rebase is still ready and still applies cleanly to current `main`.
babyhuey commented 2026-10-10 17:36:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T17:36:51Z.


@LeandroLP23 pthread_sigmask is now the next stop on main for five catalog titles once each title's own libc.prx is loaded (required since #2605): Ruffle (PPSA68091), Yamagi Quake II (PPSA99007), Prospero Explorer (PPSA99109), Prospero Multi Tools (PPSA99110) and Prospero Vibrate (PPSA99920). Linux undefined symbol: JZKw5+Wrnaw, Windows FAIL: unresolved ELF import JZKw5+Wrnaw (pthread_sigmask) from libkernel.prx (table in #1578). That's what the close note asked for, and the intake check now needs 10 merged PRs, so this can go up again as a new PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100329676 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2106#issuecomment-6100329676). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-10T17:36:51Z. --- @LeandroLP23 `pthread_sigmask` is now the next stop on `main` for five catalog titles once each title's own `libc.prx` is loaded (required since #2605): Ruffle (PPSA68091), Yamagi Quake II (PPSA99007), Prospero Explorer (PPSA99109), Prospero Multi Tools (PPSA99110) and Prospero Vibrate (PPSA99920). Linux `undefined symbol: JZKw5+Wrnaw`, Windows `FAIL: unresolved ELF import JZKw5+Wrnaw (pthread_sigmask) from libkernel.prx` (table in #1578). That's what the close note asked for, and the intake check now needs 10 merged PRs, so this can go up again as a new PR.

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