diff options
author | Brian White <mscdex@mscdex.net> | 2010-12-17 06:57:41 +0300 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-12-17 20:06:31 +0300 |
commit | 9eaf2329e7d1e7c2de20ab7e4461bf55b18595c2 (patch) | |
tree | 199e1a57302c7fc465b167518156a4da8ba64e2d /deps | |
parent | d0beac70f4d494c4c481281d6c8f672deae9a5d8 (diff) |
Fix compilation on OpenBSD and FreeBSD
While it compiles fine on FreeBSD, at least on amd64 node dies with:
"CALL_AND_RETRY_0 allocation failed - process out of memory"
Diffstat (limited to 'deps')
-rw-r--r-- | deps/libeio/eio.h | 4 | ||||
-rw-r--r-- | deps/v8/src/platform-freebsd.cc | 14 | ||||
-rw-r--r-- | deps/v8/src/platform-openbsd.cc | 12 |
3 files changed, 26 insertions, 4 deletions
diff --git a/deps/libeio/eio.h b/deps/libeio/eio.h index 129cc4c0a78..5e2bdfe63d6 100644 --- a/deps/libeio/eio.h +++ b/deps/libeio/eio.h @@ -47,6 +47,10 @@ extern "C" { #include <stddef.h> #include <sys/types.h> +#ifdef __OpenBSD__ +# include <inttypes.h> +#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 b58d0662fb1..3c454d4c3a0 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<ucontext_t*>(context); mcontext_t& mcontext = ucontext->uc_mcontext; + sample.state = Top::current_vm_state(); #if V8_HOST_ARCH_IA32 sample.pc = reinterpret_cast<Address>(mcontext.mc_eip); sample.sp = reinterpret_cast<Address>(mcontext.mc_esp); diff --git a/deps/v8/src/platform-openbsd.cc b/deps/v8/src/platform-openbsd.cc index b698d16b9a4..7658272e3cd 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); } |