Files
AnyPS5/core/libs/tests/GuestSignalList.cpp
T
screammandClaude Fable 5.1 9849a1db64 feat(libSceLibcInternal): export sys_siglist and sys_nsig
PS5CEMU-HAR (PPSA99360, ps5-payload-dev build, relinks with
--trap-sdk-syscall-stubs) imports the data objects sys_siglist
(yCdGspbNHZ8) and sys_nsig (ZD+Dp+-LsGg) from libSceLibcInternal.prx;
the import audit lists both as absent (registry entries 364 and 378,
after pthread_setaffinity_np at 276). No run has reached them yet; the
predicted stop line is

  FAIL: unresolved ELF import ZD+Dp+-LsGg (sys_nsig) from libSceLibcInternal.prx

or yCdGspbNHZ8 (sys_siglist), whichever the loader resolves first.

The table and count are FreeBSD 11.4 lib/libc/gen/siglist.c (8c639945):
32 descriptions, signal 0 to SIGUSR2 (NSIG 32), and sys_nsig is their
number, 32. ps5-payload-dev declares both as objects exported by
libSceLibcInternal and its strsignal reads them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-14 14:15:55 +13:00

26 lines
1.0 KiB
C++

#include <cstdlib>
#include <cstring>
extern "C" {
extern const char* const sys_siglist_nid_postfix[32];
extern const int sys_nsig_nid_postfix;
}
static constexpr int GUEST_NSIG = 32;
static constexpr int GUEST_SIGHUP = 1;
static constexpr int GUEST_SIGINT = 2;
static constexpr int GUEST_SIGSEGV = 11;
static constexpr int GUEST_SIGUSR2 = 31;
static void Require(bool value) { if (!value) std::abort(); }
int main() {
Require(sys_nsig_nid_postfix == GUEST_NSIG);
Require(std::strcmp(sys_siglist_nid_postfix[0], "Signal 0") == 0);
Require(std::strcmp(sys_siglist_nid_postfix[GUEST_SIGHUP], "Hangup") == 0);
Require(std::strcmp(sys_siglist_nid_postfix[GUEST_SIGINT], "Interrupt") == 0);
Require(std::strcmp(sys_siglist_nid_postfix[GUEST_SIGSEGV], "Segmentation fault") == 0);
Require(std::strcmp(sys_siglist_nid_postfix[GUEST_SIGUSR2], "User defined signal 2") == 0);
for (int signal = 0; signal < sys_nsig_nid_postfix; ++signal) Require(sys_siglist_nid_postfix[signal] != nullptr && sys_siglist_nid_postfix[signal][0] != '\0');
}