Conversation
Wire the wait-for-signal API set and bounded sigqueue payload path that
_POSIX_REALTIME_SIGNALS expects, on top of the existing kill/sigaction
core. SYS_SIGSUSPEND, SYS_SIGTIMEDWAIT, and SYS_SIGQUEUE round out the
PSE51 signal surface; SYS_SIGQUEUE is appended at slot 100 so the rest
of the syscall numbering stays stable across the branch.
Process-directed pending state splits into two distinct sources so that
plain kill() and queued sigqueue() can coexist on the same signo without
silently swallowing each other:
- proc_pending_plain tracks kill-style instances (one bit per signo).
- queued[signo] is a bounded FIFO of sigqueue payloads.
- proc_pending is the OR summary refreshed under sig_lock so the
lockless return-to-user fast path stays coherent.
signal_claim_proc_pending_locked consumes exactly one source per call
(queue first, then plain), so consuming a queued payload never clears a
sibling plain instance.
The per-signo ring is sized SIGQUEUE_MAX_PER_SIGNO + 1. Producers cap
at SIGQUEUE_MAX_PER_SIGNO (EAGAIN behavior unchanged for user space);
the extra slot is reserved for the rollback path. If sys_sigtimedwait
dequeues a payload and copy_to_user later faults, the new
signal_restore_proc_pending_locked helper re-inserts the payload at the
queue head and always succeeds for a single in-flight consumer. The
multi-consumer race past the reserved slot drops the payload but keeps
the signal observable via the plain bit, as defense-in-depth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wire the wait-for-signal API set and bounded sigqueue payload path that _POSIX_REALTIME_SIGNALS expects, on top of the existing kill/sigaction core. SYS_SIGSUSPEND, SYS_SIGTIMEDWAIT, and SYS_SIGQUEUE round out the PSE51 signal surface; SYS_SIGQUEUE is appended at slot 100 so the rest of the syscall numbering stays stable across the branch.
Process-directed pending state splits into two distinct sources so that plain kill() and queued sigqueue() can coexist on the same signo without silently swallowing each other:
signal_claim_proc_pending_locked consumes exactly one source per call (queue first, then plain), so consuming a queued payload never clears a sibling plain instance.
The per-signo ring is sized SIGQUEUE_MAX_PER_SIGNO + 1. Producers cap at SIGQUEUE_MAX_PER_SIGNO (EAGAIN behavior unchanged for user space); the extra slot is reserved for the rollback path. If sys_sigtimedwait dequeues a payload and copy_to_user later faults, the new signal_restore_proc_pending_locked helper re-inserts the payload at the queue head and always succeeds for a single in-flight consumer. The multi-consumer race past the reserved slot drops the payload but keeps the signal observable via the plain bit, as defense-in-depth.
Summary by cubic
Adds PSE51 realtime signals with wait-for-signal APIs and bounded
sigqueuepayloads. IntroducesSYS_SIGQUEUE, wiresSYS_SIGSUSPEND, and extendsSYS_SIGTIMEDWAITto optionally return a queued value.New Features
proc_pending_plain(bitmask) and per-signo FIFOqueued[], withproc_pendingas the OR summary for the fast path.SIGQUEUE_MAX_PER_SIGNO = 4) with an internal+1slot to guarantee lossless rollback aftercopy_to_userfaults; overflow during multi-consumer rollback drops the payload but sets the plain bit to keep the signal observable.signal_claim_proc_pending_lockedconsumes exactly one source (queue first, then plain) sokill()andsigqueue()on the same signal coexist;SYS_SIGTIMEDWAITreturns the signo and, when present, writes the queued value to the optional payload-out pointer; handlers still receive only the signo.Migration
SYS_SIGQUEUEis added at slot 100; all existing syscall numbers remain unchanged._POSIX_REALTIME_SIGNALSstays1; payloads are exposed via a Mazu-specific ABI (not fullsiginfo_t/SA_SIGINFO).SYS_SIGTIMEDWAIT(with payload-out) andSYS_SIGQUEUEto send/receive values.Written for commit 7b872a8. Summary will update on new commits.