History log of /dragonfly/lib/libc/upmap/ukp_blocksigs.c (Results 1 – 1 of 1)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.2.1, v6.2.0, v6.3.0, v6.0.1, v6.0.0, v6.0.0rc1, v6.1.0, v5.8.3, v5.8.2, v5.8.1, v5.8.0, v5.9.0, v5.8.0rc1, v5.6.3
# 721505de 12-Nov-2019 Matthew Dillon <dillon@apollo.backplane.com>

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
te

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
teaching tens of thousands of programmers about signal safety, and
just making it work in libc and pthreads, only one of these two
possibilities is actually realizable.

In particular, high-level languages have become so complex, and some
applications (chrome, firefox, etc) have become so complex, that the
code is regularly tripping over signal safety issues.

However, implementing signal safety with current mechanisms is extremely
expensive due to the need for multiple system calls. To whit,
DragonFlyBSD now has a mechanism that does not require system calls
in the critical path.

* Implement sigblockall() and sigunblockall(). These functions
leverage the new /dev/lpmap per-thread shared page mechanism
to provide a way to temporary block the dispatch of all maskable
signals without having to make any system calls.

These are extremely fast routines.

- Reentrant / Recursable

- Temporarily blocks any dispatch of a maskable asynchronous signal
to the calling thread. Other threads are not affected... this is
a per-thread mechanism.

- The last sigunblockall() will immediately dispatch any blocked
signals.

- The normal signal mask is not affected by these routines.

- Does not block signals caused by synchronous traps.

- The current recursion count is retained on [v]fork() to ease
coding and to also allow signals to be temporarily blocked across a
fork until the child process is ready to deal with them, if desired.

* Implement signal safety for most of pthreads. All temporary internal
mutexes are now wrapped with sigblockall() and sigunblockall().

* Implement signal safety for the malloc subsystem. All functions
are wrawpped with sigblockall() and sigunblockall().

These implementations make lang/mono and lang/rust far more reliable
than they were before. Where 9 out of 10 builds used to fail, now
they succeed.

show more ...