Browse Source

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"
v0.7.4-release
Brian White 14 years ago
committed by Ryan Dahl
parent
commit
9eaf2329e7
  1. 4
      deps/libeio/eio.h
  2. 14
      deps/v8/src/platform-freebsd.cc
  3. 12
      deps/v8/src/platform-openbsd.cc
  4. 4
      src/node_stdio.cc
  5. 1
      wscript

4
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

14
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);

12
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);
}

4
src/node_stdio.cc

@ -5,8 +5,10 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#if defined(__APPLE__)
#if defined(__APPLE__) || defined(__OpenBSD__)
# include <util.h>
#elif __FreeBSD__
# include <libutil.h>
#elif defined(__sun)
# include <stropts.h> // for openpty ioctls
#else

1
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

Loading…
Cancel
Save