]> git.pond.sub.org Git - empserver/commit
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>
Sat, 23 Jan 2021 06:08:03 +0000 (07:08 +0100)
commit2e4793408cd9e743170d781f4d1f9a6492f5daca
treec54937d4fd48e30855bc9cf861bf1b6b91b3eb14
parent460cc9e2ee9a5cb3689914dea8c93766ee61ed6c
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