]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
signal: Add SIG_FOREACH and refactor issignal()
authorMark Johnston <markj@FreeBSD.org>
Sat, 16 Oct 2021 13:44:40 +0000 (09:44 -0400)
committerMark Johnston <markj@FreeBSD.org>
Mon, 18 Oct 2021 13:56:58 +0000 (09:56 -0400)
commit81f2e9063d64cc976b47e7ee1e9c35692cda7cb4
tree16efe47b90be0c2f769556442720a750cec872eb
parentde8554295b47475e758a573ab7418265f21fee7e
signal: Add SIG_FOREACH and refactor issignal()

Add a SIG_FOREACH macro that can be used to iterate over a signal set.
This is a bit cleaner and more efficient than calling sig_ffs() in a
loop.  The implementation is based on BIT_FOREACH_ISSET(), except
that the bitset limbs are always 32 bits wide, and signal sets are
1-indexed rather than 0-indexed like bitset(9) sets.

issignal() cannot really be modified to use SIG_FOREACH() directly.
Take this opportunity to split the function into two explicit loops.
I've always found this function hard to read and think that this change
is an improvement.

Remove sig_ffs(), nothing uses it now.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32473
sys/kern/kern_sig.c
sys/sys/signalvar.h