aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2015-12-17 14:52:56 +0100
committerErlang/OTP <[email protected]>2015-12-17 14:52:56 +0100
commite91dfce2a6195ed65af37ba44c780db70db51d75 (patch)
treee5c5edec7f3a3323cfd1abbb49bde3aa53619209
parent41d5b82499b1e76e9c143361a34967c0cbfe5573 (diff)
parente616e04d55b28bff5f0660eb8e3a32fffe398a13 (diff)
downloadotp-e91dfce2a6195ed65af37ba44c780db70db51d75.tar.gz
otp-e91dfce2a6195ed65af37ba44c780db70db51d75.tar.bz2
otp-e91dfce2a6195ed65af37ba44c780db70db51d75.zip
Merge branch 'jj1bdx/jj1bdx-18.2-freebsd-hipe-fix-2' into maint
* jj1bdx/jj1bdx-18.2-freebsd-hipe-fix-2: hipe_x86_signal.c: add FreeBSD sigaction code
-rw-r--r--erts/emulator/hipe/hipe_x86_signal.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/erts/emulator/hipe/hipe_x86_signal.c b/erts/emulator/hipe/hipe_x86_signal.c
index 69d4ea10c2..b7dae88417 100644
--- a/erts/emulator/hipe/hipe_x86_signal.c
+++ b/erts/emulator/hipe/hipe_x86_signal.c
@@ -234,7 +234,29 @@ static void do_init(void)
#define INIT() do { if (!init_done()) do_init(); } while (0)
#endif /* __sun__ */
-#if !(defined(__GLIBC__) || defined(__DARWIN__) || defined(__NetBSD__) || defined(__sun__))
+#if defined(__FreeBSD__)
+/*
+ * This is a copy of Darwin code for FreeBSD.
+ * CAVEAT: detailed semantics are not verified yet.
+ */
+#include <dlfcn.h>
+static int (*__next_sigaction)(int, const struct sigaction*, struct sigaction*);
+#define init_done() (__next_sigaction != 0)
+extern int _sigaction(int, const struct sigaction*, struct sigaction*);
+#define __SIGACTION _sigaction
+static void do_init(void)
+{
+ __next_sigaction = dlsym(RTLD_NEXT, "sigaction");
+ if (__next_sigaction != 0)
+ return;
+ perror("dlsym_freebsd");
+ abort();
+}
+#define _NSIG NSIG
+#define INIT() do { if (!init_done()) do_init(); } while (0)
+#endif /* __FreeBSD__ */
+
+#if !(defined(__GLIBC__) || defined(__DARWIN__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__sun__))
/*
* Unknown libc -- assume musl. Note: musl deliberately does not provide a musl-specific
* feature test macro, so we cannot check for it.
@@ -259,7 +281,7 @@ static void do_init(void)
#define _NSIG NSIG
#endif
#define INIT() do { if (!init_done()) do_init(); } while (0)
-#endif /* !(__GLIBC__ || __DARWIN__ || __NetBSD__ || __sun__) */
+#endif /* !(__GLIBC__ || __DARWIN__ || __NetBSD__ || __FreeBSD__ || __sun__) */
#if !defined(__NetBSD__)
/*
@@ -299,7 +321,7 @@ int __SIGACTION(int signum, const struct sigaction *act, struct sigaction *oldac
/*
* This catches the application's own sigaction() calls.
*/
-#if !defined(__DARWIN__) && !defined(__NetBSD__)
+#if !defined(__DARWIN__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
{
return my_sigaction(signum, act, oldact);