aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_x86_signal.c
diff options
context:
space:
mode:
authorKenji Rikitake <[email protected]>2015-12-17 20:52:54 +0900
committerKenji Rikitake <[email protected]>2015-12-17 20:52:54 +0900
commite616e04d55b28bff5f0660eb8e3a32fffe398a13 (patch)
tree6d3b180b5382ab9e63211027c40c3e2d9ec9bd18 /erts/emulator/hipe/hipe_x86_signal.c
parentb855206a1a7788216717ca272f44e9beb1f58e7c (diff)
downloadotp-e616e04d55b28bff5f0660eb8e3a32fffe398a13.tar.gz
otp-e616e04d55b28bff5f0660eb8e3a32fffe398a13.tar.bz2
otp-e616e04d55b28bff5f0660eb8e3a32fffe398a13.zip
hipe_x86_signal.c: add FreeBSD sigaction code
* erts/emulator/hipe/hipe_x86_signal.c: add FreeBSD sigaction code, based on the Darwin (OS X) code
Diffstat (limited to 'erts/emulator/hipe/hipe_x86_signal.c')
-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);