Commit Graph

11 Commits

Author SHA1 Message Date
Hussein Kadhim 1100d41a36 fix(kernel): accept the default handler for SIGKILL and SIGSTOP in signal
FreeBSD's kernel_sigaction rejects SIGKILL and SIGSTOP only for a handler other than SIG_DFL, so signal(9, SIG_DFL) and signal(17, SIG_DFL) succeed. Drop the SIG_ERR rejection, which has no kernel basis and which sigaction does not apply.
2026-10-11 10:54:27 +02:00
Hussein Kadhim a8cc561f82 fix(libkernel): accept signal() for every valid signal number
signal() returned SIG_ERR with EINVAL for any signal without a host
equivalent, such as SIGHUP, SIGPIPE and SIGUSR1, while sigaction()
accepted them. FreeBSD's signal() is sigaction() with SA_RESTART and fails
only for numbers outside 1..128 and for SIGKILL and SIGSTOP.
2026-10-11 10:53:09 +02:00
Hannah Lyons 0e88f3014d fix(libkernel): name pthread_kill's errors and test the signal range edge 2026-10-10 21:11:29 -04:00
Hannah Lyons d8af71c0ca feat(libkernel): implement pthread_kill 2026-10-10 21:11:29 -04:00
Scott Schuster 383bffd8c7 feat(libc): implement alarm
RetroArch (PPSA99169) stops at alarm on main: `FAIL: unresolved ELF import DQXJraCc1rA from libSceLibcInternal.prx`.

alarm(seconds) arms one process-wide real-time alarm and returns the seconds left on the previous one, rounded up like FreeBSD's alarm.c (any partial second counts); alarm(0) cancels it. When it expires, SIGALRM's disposition as recorded by sigaction or signal applies: ignored, nothing happens; default, the process terminates as on FreeBSD (exit status 128 + 14); a guest handler throws, because asynchronous delivery to a guest handler is not implemented.

The timer lives in libkernel next to the signal dispositions (GuestAlarm_nid_no_patch); libSceLibcInternal, which the titles import alarm from, forwards to it.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 17:59:58 -05:00
LeandroLP23 df415ff1fd feat(libkernel): implement pthread_sigmask
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 19:45:28 +02:00
Jan Šlégl c26c1cae5b fix(libkernel): block guest signals by FreeBSD's bit n - 1
sigprocmask keeps the first word of the title's set as it is, where
FreeBSD keeps signal n at bit n - 1 (_SIG_BIT), but Dispatch tested bit
n. A title that blocked SIGTERM with a FreeBSD-built set (bit 14) was
not protected, and a set with bit 15 blocked SIGTERM instead of SIGURG.
Dispatch now tests bit n - 1; the stored mask and the set returned by
sigprocmask are unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 01:30:55 +02:00
john.maia cfe4a277c4 feat(libkernel): implement sigaction
EVO-PLAYER (PPSA99039) v0.11.0 stops at sigaction once its earlier
imports resolve: it installs a crash handler for SIGSEGV, SIGBUS and
SIGABRT and a quit handler for SIGTERM, SIGINT and SIGHUP at start-up.

sigaction records the handler, flags and mask of signals 1 to 128 and
reports them back, with FreeBSD's EINVAL cases. signal shares the table
and records SA_RESTART, as FreeBSD's libc does. Plain handlers on the
signals signal already delivers run as signal handlers do; SA_SIGINFO
handlers and other signals are recorded only, and raise of such a
signal throws.

Assisted by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DwFnKjMxmwGDWiuYYf1v4D
2026-10-09 23:42:43 +01:00
Adrià Franch 3a81905dd3 feat(libkernel): implement _is_signal_return
Guest signal handlers are called from a host dispatcher, so no guest PC is
a signal trampoline: return 0 for every address, as KytyPS5 and prosper do.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-06 01:09:00 +02:00
asimplestray c6d098d487 feat(kernel): implement Sleep, sigprocmask and pthread finalize 2026-09-29 23:40:48 +00:00
SamG-Coder 56c7a589db feat(kernel): bridge guest signal registration and delivery 2026-09-25 06:27:11 +10:00