diff options
author | Zandra <[email protected]> | 2015-12-04 10:22:39 +0100 |
---|---|---|
committer | Zandra <[email protected]> | 2015-12-04 10:22:39 +0100 |
commit | 4685febaa7d4c1b5fc161c2910f6e7ec5993b88c (patch) | |
tree | 3313c90e2dda6cb0c2c0359b96b482b5422f73d8 | |
parent | 5a6b1342478196ca1ca8c8de6536ee7c01c454f8 (diff) | |
parent | fc571c1a5d505902c15742e7c0db60288d63fcdb (diff) | |
download | otp-4685febaa7d4c1b5fc161c2910f6e7ec5993b88c.tar.gz otp-4685febaa7d4c1b5fc161c2910f6e7ec5993b88c.tar.bz2 otp-4685febaa7d4c1b5fc161c2910f6e7ec5993b88c.zip |
Merge branch 'maint'
-rw-r--r-- | erts/emulator/hipe/hipe_x86_signal.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/erts/emulator/hipe/hipe_x86_signal.c b/erts/emulator/hipe/hipe_x86_signal.c index bb8a3f041f..69d4ea10c2 100644 --- a/erts/emulator/hipe/hipe_x86_signal.c +++ b/erts/emulator/hipe/hipe_x86_signal.c @@ -198,7 +198,7 @@ static void do_init(void) #define INIT() do { if (!init_done()) do_init(); } while (0) #endif /* __DARWIN__ */ -#if !defined(__GLIBC__) && !defined(__DARWIN__) && !defined(__NetBSD__) +#if defined(__sun__) /* * Assume Solaris/x86 2.8. * There is a number of sigaction() procedures in libc: @@ -232,7 +232,34 @@ static void do_init(void) } #define _NSIG NSIG #define INIT() do { if (!init_done()) do_init(); } while (0) -#endif /* not glibc or darwin */ +#endif /* __sun__ */ + +#if !(defined(__GLIBC__) || defined(__DARWIN__) || defined(__NetBSD__) || defined(__sun__)) +/* + * Unknown libc -- assume musl. Note: musl deliberately does not provide a musl-specific + * feature test macro, so we cannot check for it. + * + * sigaction is a weak alias for __sigaction, which is a wrapper for __libc_sigaction. + * There are libc-internal calls to __libc_sigaction which install handlers, so we must + * override __libc_sigaction rather than __sigaction. + */ +#include <dlfcn.h> +static int (*__next_sigaction)(int, const struct sigaction*, struct sigaction*); +#define init_done() (__next_sigaction != 0) +#define __SIGACTION __libc_sigaction +static void do_init(void) +{ + __next_sigaction = dlsym(RTLD_NEXT, "__libc_sigaction"); + if (__next_sigaction != 0) + return; + perror("dlsym"); + abort(); +} +#ifndef _NSIG +#define _NSIG NSIG +#endif +#define INIT() do { if (!init_done()) do_init(); } while (0) +#endif /* !(__GLIBC__ || __DARWIN__ || __NetBSD__ || __sun__) */ #if !defined(__NetBSD__) /* |