lwp: Rewrite signal wait code for portability and safety
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 27 Dec 2020 08:36:54 +0000 (09:36 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 17 Jan 2021 20:24:28 +0000 (21:24 +0100)
commit8a1d9fbb4bcaa073b65f41fc70768db6a2ac726b
tree935537e27810e99ffb8833fc29fc0373c1fe064c
parentbfb558dee35875037fdea18a6c7ae2c4a97bec13
lwp: Rewrite signal wait code for portability and safety

LWP's use of sigset_t is problematic.

To iterate over a sigset_t, it uses NSIG, which is not portable: BSD
and System V provide it, but it's not POSIX.

To record signals caught, it updates a sigset_t variable from a signal
handler.  The variable isn't volatile, because we'd have to cast away
volatile for sigaddset().

Replace sigset_t by an array of signal numbers terminated with 0.

Since lwpInitSigWait() needs to store the signal set for
lwpCatchAwaitedSig() anyway, there is no need to pass it to
lwpSigWait().  Drop its parameter.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
include/lwp.h
src/lib/empthread/lwp.c
src/lib/lwp/lwp.c
src/lib/lwp/lwpint.h
src/lib/lwp/sig.c