diff --git a/deps/libeio/eio.h b/deps/libeio/eio.h index 129cc4c0a7..5e2bdfe63d 100644 --- a/deps/libeio/eio.h +++ b/deps/libeio/eio.h @@ -47,6 +47,10 @@ extern "C" { #include #include +#ifdef __OpenBSD__ +# include +#endif + #ifdef _WIN32 # define uid_t int # define gid_t int diff --git a/deps/v8/src/platform-freebsd.cc b/deps/v8/src/platform-freebsd.cc index b58d0662fb..3c454d4c3a 100644 --- a/deps/v8/src/platform-freebsd.cc +++ b/deps/v8/src/platform-freebsd.cc @@ -500,6 +500,16 @@ class FreeBSDMutex : public Mutex { return result; } + virtual bool TryLock() { + int result = pthread_mutex_trylock(&mutex_); + // Return false if the lock is busy and locking failed. + if (result == EBUSY) { + return false; + } + ASSERT(result == 0); // Verify no other errors. + return true; + } + private: pthread_mutex_t mutex_; // Pthread mutex for POSIX platforms. }; @@ -577,14 +587,12 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { TickSample sample; - // We always sample the VM state. - sample.state = VMState::current_state(); - // If profiling, we extract the current pc and sp. if (active_sampler_->IsProfiling()) { // Extracting the sample from the context is extremely machine dependent. ucontext_t* ucontext = reinterpret_cast(context); mcontext_t& mcontext = ucontext->uc_mcontext; + sample.state = Top::current_vm_state(); #if V8_HOST_ARCH_IA32 sample.pc = reinterpret_cast
(mcontext.mc_eip); sample.sp = reinterpret_cast
(mcontext.mc_esp); diff --git a/deps/v8/src/platform-openbsd.cc b/deps/v8/src/platform-openbsd.cc index b698d16b9a..7658272e3c 100644 --- a/deps/v8/src/platform-openbsd.cc +++ b/deps/v8/src/platform-openbsd.cc @@ -476,6 +476,16 @@ class OpenBSDMutex : public Mutex { return result; } + virtual bool TryLock() { + int result = pthread_mutex_trylock(&mutex_); + // Return false if the lock is busy and locking failed. + if (result == EBUSY) { + return false; + } + ASSERT(result == 0); // Verify no other errors. + return true; + } + private: pthread_mutex_t mutex_; // Pthread mutex for POSIX platforms. }; @@ -554,7 +564,7 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { TickSample sample; // We always sample the VM state. - sample.state = VMState::current_state(); + sample.state = Top::current_vm_state(); active_sampler_->Tick(&sample); } diff --git a/src/node_stdio.cc b/src/node_stdio.cc index 213bd33b0a..ad098352b9 100644 --- a/src/node_stdio.cc +++ b/src/node_stdio.cc @@ -5,8 +5,10 @@ #include #include #include -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(__OpenBSD__) # include +#elif __FreeBSD__ +# include #elif defined(__sun) # include // for openpty ioctls #else diff --git a/wscript b/wscript index f9ce5e3be1..016b2b0254 100644 --- a/wscript +++ b/wscript @@ -178,6 +178,7 @@ def configure(conf): o = Options.options conf.env["USE_DEBUG"] = o.debug + conf.env["SNAPSHOT_V8"] = not o.without_snapshot if sys.platform.startswith("sunos"): conf.env["SNAPSHOT_V8"] = False conf.env["USE_PROFILING"] = o.profile