summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-08-05 02:50:45 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2013-08-10 16:28:18 +0200
commita20d565d9c4be6ab8397cf3a9546c39a247c7aca (patch)
tree278d9be16b24417cb667977e2f1ebc0cb25ddbf2 /deps
parentf69be329f0d78f19e71ac9e75d6e4ee816e13c97 (diff)
downloadnode-new-a20d565d9c4be6ab8397cf3a9546c39a247c7aca.tar.gz
v8: fix openbsd build
This is [1] applied ahead of time. Summary: OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h> and is a typedef for struct sigcontext. There is no uc_mcontext. [1] https://codereview.chromium.org/21705003/ Note: the patch has been accepted upstream but hasn't made its way into a stable release yet.
Diffstat (limited to 'deps')
-rw-r--r--deps/v8/src/sampler.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/deps/v8/src/sampler.cc b/deps/v8/src/sampler.cc
index d72ed1acdb..6e451f0bde 100644
--- a/deps/v8/src/sampler.cc
+++ b/deps/v8/src/sampler.cc
@@ -38,7 +38,10 @@
#include <signal.h>
#include <sys/time.h>
#include <sys/syscall.h>
-#if !defined(__ANDROID__) || defined(__BIONIC_HAVE_UCONTEXT_T)
+// OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
+// and is a typedef for struct sigcontext. There is no uc_mcontext.
+#if (!defined(__ANDROID__) || defined(__BIONIC_HAVE_UCONTEXT_T)) \
+ && !defined(__OpenBSD__)
#include <ucontext.h>
#endif
#include <unistd.h>
@@ -330,7 +333,9 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info,
#else
// Extracting the sample from the context is extremely machine dependent.
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
+#if !defined(__OpenBSD__)
mcontext_t& mcontext = ucontext->uc_mcontext;
+#endif
#if defined(__linux__) || defined(__ANDROID__)
#if V8_HOST_ARCH_IA32
state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
@@ -384,7 +389,6 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info,
state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RBP]);
#endif // V8_HOST_ARCH_*
#elif defined(__OpenBSD__)
- USE(mcontext);
#if V8_HOST_ARCH_IA32
state.pc = reinterpret_cast<Address>(ucontext->sc_eip);
state.sp = reinterpret_cast<Address>(ucontext->sc_esp);