Skip to content

feat(libkernel): export _sigintr and let signal honour it - #8866

Open
ycbuzi wants to merge 2 commits into
boykopovar:mainfrom
ycbuzi:feat/libkernel-sigintr
Open

ycbuzi wants to merge 2 commits into
boykopovar:mainfrom
ycbuzi:feat/libkernel-sigintr

Conversation

@ycbuzi

@ycbuzi ycbuzi commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

What

libkernel.prx exports _sigintr (nQVWJEGHObc), the sigset_t that FreeBSD's libc shares between signal and siginterrupt: signal gives a handler SA_RESTART unless its signal is in the set (lib/libc/gen/signal.c, 11.4). The public SDK's libkernel, libkernel_sys and libkernel_web stub tables declare the object, and no built library provided it, so a registry importing it was reported absent (#8846). The object is 16 bytes (four uint32, the SDK's sys/_sigset.h), zero at start, and signal now reads it under the registration lock when it records a handler.

Not included: siginterrupt, which fills the set. On the console it is a libSceLibcInternal export (the SDK's libSceLibcInternal.c declares it; the three kernel tables do not), which AnyPS5 serves from libc.prx, and libc.prx does not link libkernel.prx (the dependency runs the other way), so it cannot reach the dispositions. A guest that writes the set itself gets FreeBSD's behaviour from signal; the function needs a decision on how libc reaches libkernel's signal state and is left for a follow-up. A debt entry for signal says so. Whether the two kernel variants should provide the object as well is the policy question of #8853.

Tested

Windows 11, MinGW GCC 15.2.0, Release, BUILD_TESTING=ON, on main 05f9995:

  • guest_signals, extended: the set starts zero; signal records SA_RESTART; with bit 29 set (signal 30) it records flags 0 and keeps the handler; signal 31 still gets SA_RESTART; bit 127 (signal 128) clears it the same way; with the bits cleared SA_RESTART comes back. guest_signals passes (1 of 1).
  • Revert check: with the signal change alone restored to main (object and test kept) the test fails at the first flags-0 check; restored, it passes. It exits with 0xc0000409 (the Require abort) on the reverted build and passes again on the restored one.
  • tools/import_audit.py on libkernel: public SDK _sigintr data object has no built provider #8846's one-line registry against the built libraries: implemented 1, absent 0, exit 0 (the issue measured absent 1).
  • python tools/check_conventions.py --base origin/main --head HEAD passes.
  • Not run: Linux.
  • Overlap: fix(libkernel): reject undefined sa_flags in sigaction with EINVAL #8411 adds a line in sigaction, a few lines below the changed line in signal, and feat(libkernel): export the underscore entry points of the socket, directory and signal calls #8700 adds entry points after sigaction and sigsuspend; whichever merges second rebases a few lines. Neither touches _sigintr.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none (covers the _sigintr import of libkernel: public SDK _sigintr data object has no built provider #8846; siginterrupt stays open there)
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

The public SDK's libkernel, libkernel_sys and libkernel_web stub tables declare _sigintr, the
sigset_t that FreeBSD's libc shares between signal and siginterrupt, and no built library
provided it (boykopovar#8846). libkernel now exports the 16-byte object, zero at start, and signal records
a handler with SA_RESTART unless its signal is in the set, as lib/libc/gen/signal.c does.

siginterrupt, which fills the set, is a libSceLibcInternal export; libc does not link libkernel
and cannot reach the dispositions, so it stays out and a debt entry for signal says so.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

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
PR 9123 core/libs/tests/GuestSignals.cpp L367

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 3986 core/libs/prx/libkernel/System/src/Signals.cpp
core/libs/tests/GuestSignals.cpp
PR 4630 docs/dev/debt/libkernel.md
PR 5021 docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestSignals.cpp
PR 6149 docs/dev/debt/libkernel.md
PR 6469 docs/dev/debt/libkernel.md
PR 6740 docs/dev/debt/libkernel.md
PR 6879 docs/dev/debt/libkernel.md
PR 6936 docs/dev/debt/libkernel.md
PR 6977 docs/dev/debt/libkernel.md
PR 7049 docs/dev/debt/libkernel.md
PR 7088 docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7121 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 docs/dev/debt/libkernel.md
PR 7201 core/libs/prx/libkernel/System/src/Signals.cpp
PR 7447 docs/dev/debt/libkernel.md
PR 7509 docs/dev/debt/libkernel.md
PR 7653 docs/dev/debt/libkernel.md
PR 8520 docs/dev/debt/libkernel.md
PR 8547 docs/dev/debt/libkernel.md
PR 8725 docs/dev/debt/libkernel.md
PR 8726 docs/dev/debt/libkernel.md
PR 9099 docs/dev/debt/libkernel.md
PR 9137 docs/dev/debt/libkernel.md

@MarcZX10

Copy link
Copy Markdown
Contributor

Manual review of the overlap warning: #3986 changes the signal masks, raise, and early portions of GuestSignals.cpp; this PR’s production change is in signal_nid_postfix, and its test block is appended at the end, so those hunks are separate. #7201 only changes macOS alarm exception handling in Signals.cpp; #7622 only changes alarm-thread startup. The debt-file warnings are separate entries. I found no conflicting edits in those overlaps. #8872 is correctly listed as depending on this PR.

@ycbuzi

ycbuzi commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for checking the overlaps by hand. Agreed on the hunks: this PR's production change is the one line in signal plus the object, and the test block only appends; the debt entry stays separate from the others on a rebase.

This branch has not been deployed

No deployments
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.

2 participants