libkernel: synchronous signal waits (pause, sigsuspend, sigwait) throw unconditionally #4561

Closed
opened 2026-10-12 15:39:55 +00:00 by jagrat04 · 2 comments
jagrat04 commented 2026-10-12 15:39:55 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-12T15:39:55Z.


Summary

In libkernel (core/libs/prx/libkernel/System/src/Signals.cpp), all synchronous signal waiting calls currently throw NotImplemented_nid_no_patch:

  • pause()
  • sigsuspend() (#3253)
  • sigwait()
  • sigwaitinfo()
  • sigtimedwait()

Context

While asynchronous signal handlers via sigaction and thread masking via pthread_sigmask / _sigprocmask are modeled, signals raised while blocked are not held in a pending signal queue. Consequently:

  • sigpending zeroes the pending mask (as no pending signals queue is maintained).
  • Calls waiting for signal delivery (pause, sigsuspend, sigwait) throw NotImplemented_nid_no_patch, ending the process.

POSIX-oriented homebrew and ports (e.g. VLC, RetroArch, PS5MC) that rely on signal-based synchronization cannot wait on signal delivery.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5816421611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4561). Originally posted by [jagrat04](https://github.com/jagrat04) on 2026-10-12T15:39:55Z. --- ### Summary In `libkernel` ([core/libs/prx/libkernel/System/src/Signals.cpp](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libkernel/System/src/Signals.cpp)), all synchronous signal waiting calls currently throw `NotImplemented_nid_no_patch`: - `pause()` - `sigsuspend()` (#3253) - `sigwait()` - `sigwaitinfo()` - `sigtimedwait()` ### Context While asynchronous signal handlers via `sigaction` and thread masking via `pthread_sigmask` / `_sigprocmask` are modeled, signals raised while blocked are not held in a pending signal queue. Consequently: - `sigpending` zeroes the pending mask (as no pending signals queue is maintained). - Calls waiting for signal delivery (`pause`, `sigsuspend`, `sigwait`) throw `NotImplemented_nid_no_patch`, ending the process. POSIX-oriented homebrew and ports (e.g. VLC, RetroArch, PS5MC) that rely on signal-based synchronization cannot wait on signal delivery. AI-assisted: yes
VitzS7 commented 2026-10-12 21:30:48 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by VitzS7 on 2026-10-12T21:30:48Z.


Status update, since this issue predates the merge: pause, sigwait, sigwaitinfo and sigtimedwait no longer throw. #4138 landed on main and all four wait on the pending set: a signal raised while blocked stays pending and is taken by sigwait, sigwaitinfo or sigtimedwait, delivered to the handler when _sigprocmask unblocks it, or consumed by pause. sigtimedwait returns the number, EAGAIN on a zero timeout, and blocks on a null timeout; the set covers signals 1 to 128 and the lowest pending number wins.

Still open from the list: sigsuspend, which is #4383.

One thing that has not changed: the pending set is process-wide, not per thread. #3986 replaces the process-wide mask with a per-thread one, and the pending set has to follow it (a signal raised while blocked on one thread belongs to that thread); that work is only worth doing on top of #3986.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132976402 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4561#issuecomment-6132976402). Originally posted by [VitzS7](https://github.com/VitzS7) on 2026-10-12T21:30:48Z. --- Status update, since this issue predates the merge: `pause`, `sigwait`, `sigwaitinfo` and `sigtimedwait` no longer throw. #4138 landed on `main` and all four wait on the pending set: a signal raised while blocked stays pending and is taken by `sigwait`, `sigwaitinfo` or `sigtimedwait`, delivered to the handler when `_sigprocmask` unblocks it, or consumed by `pause`. `sigtimedwait` returns the number, `EAGAIN` on a zero timeout, and blocks on a null timeout; the set covers signals 1 to 128 and the lowest pending number wins. Still open from the list: `sigsuspend`, which is #4383. One thing that has not changed: the pending set is process-wide, not per thread. #3986 replaces the process-wide mask with a per-thread one, and the pending set has to follow it (a signal raised while blocked on one thread belongs to that thread); that work is only worth doing on top of #3986.
oneandonlydean commented 2026-10-13 02:08:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:08:18Z.


Closing: #4138 implements pause, sigwait, sigwaitinfo and sigtimedwait on a pending set. sigsuspend is the one left; it is tracked in #3253 (PR #4383).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136624437 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4561#issuecomment-6136624437). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T02:08:18Z. --- Closing: #4138 implements `pause`, `sigwait`, `sigwaitinfo` and `sigtimedwait` on a pending set. `sigsuspend` is the one left; it is tracked in #3253 (PR #4383).
Sign in to join this conversation.
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#4561
No description provided.