Skip to content

feat(libkernel): implement pthread_sigmask - #2106

Closed
LeandroLP23 wants to merge 1 commit into
boykopovar:mainfrom
LeandroLP23:feat/libkernel-pthread-sigmask
Closed

LeandroLP23 wants to merge 1 commit into
boykopovar:mainfrom
LeandroLP23:feat/libkernel-pthread-sigmask

Conversation

@LeandroLP23

@LeandroLP23 LeandroLP23 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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 d70b899:

  • 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, feat(libc): implement 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 d70b899 (with the build workflow from before 0ab2a04, 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)

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Progress report (8b393b6 → 97f6541)

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

✅ 1 implemented
Library Name
libkernel pthread_sigmask_nid_postfix

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LeandroLP23
LeandroLP23 force-pushed the feat/libkernel-pthread-sigmask branch from e663325 to 97f6541 Compare October 9, 2026 19:47
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 9, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

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.

@adriadam10 adriadam10 closed this Oct 9, 2026
@overlordxrz-source

Copy link
Copy Markdown
Contributor

@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

Copy link
Copy Markdown
Contributor

@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

Copy link
Copy Markdown
Contributor

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 97f6541 merged onto main c963432, 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

Copy link
Copy Markdown
Contributor Author

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 04d06f0, 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

Copy link
Copy Markdown
Contributor Author

A second title stops here on Windows: ps5-opengl (PPSA99005 v1.0.1). On main 89a1fb4 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

Copy link
Copy Markdown
Contributor Author

Update: in @babyhuey's new table on #1578 (comment, Linux main 197ffac and Windows main cf8b129), 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

Copy link
Copy Markdown
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants