Re: Official Linux system wrapper library?
From: Joseph Myers
Date: Mon Nov 12 2018 - 17:51:12 EST
On Mon, 12 Nov 2018, Daniel Colascione wrote:
> The two features *are* unrelated. The design I've proposed works
> equally well for synchronous and asynchronous signals, and limiting it
Whatever the design, I see no obvious reason why a kernel-provided
library, with all the problems that entails, should need to be involved,
rather than putting new APIs either in libc or in a completely separate
libsignal for libraries wanting to use such a system for cooperative
signal use.
(I can imagine *other* parts of the toolchain being involved, if e.g. you
want to have a good way of checking "is the address of the instruction
causing this signal in this library?" that works with static as well as
dynamic linking - for dynamic linking, I expect something could be done
using libc_nonshared and __dso_handle to identify code in the library
calling some registering function. And indeed there might also be new
kernel interfaces that help improve signal handling.)
In the absence of consensus for adding such a new API for signals to
glibc, it's unlikely one would get consensus for glibc to depend on some
other library providing such an API either. But you can always write a
library (which I think would most naturally be a completely separate
libsignal, not part of the kernel source tree) and seek to persuade
libraries they should be using it rather than interfering with global
state by registering normal signal handlers directly.
--
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx