Skip to content

Commit

Permalink
build: fix build for SmartOS
Browse files Browse the repository at this point in the history
This change in V8: https://code.google.com/p/v8/source/detail?r=22210
has introduced a method named OS::GetCurrentThreadId which fails to
compile on OSes where a "gettid" syscall does not exist.

This build issue has been fixed upstream by several changes:
- https://code.google.com/p/v8/source/detail?r=23459.
- https://codereview.chromium.org/649553002
- https://codereview.chromium.org/642223003

Another minor fix to the upstream changes was also necessary.
See https://code.google.com/p/v8/issues/detail?id=3620 for
more information.

The other build issue was due to the fact that alloca.h is not included
by other system includes on SmartOS, which is assumed by V8.

Built and tested on Linux, MacOS X, Windows and SmartOS.

Reviewed-By: Trevor Norris <[email protected]>
PR-URL: nodejs/node-v0.x-archive#18206
  • Loading branch information
Julien Gilli committed Apr 29, 2015
1 parent 5b2bf92 commit 712cb43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions deps/v8/src/base/platform/platform-posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,15 @@ int OS::GetCurrentProcessId() {


int OS::GetCurrentThreadId() {
#if defined(ANDROID)
#if V8_OS_MACOSX
return static_cast<int>(pthread_mach_thread_np(pthread_self()));
#elif V8_OS_LINUX
return static_cast<int>(syscall(__NR_gettid));
#elif V8_OS_ANDROID
return static_cast<int>(gettid());
#else
return static_cast<int>(syscall(SYS_gettid));
#endif // defined(ANDROID)
return static_cast<int>(pthread_self());
#endif
}


Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/base/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace std {
int signbit(double x);
}
# endif
#include <alloca.h>
#endif

#if V8_OS_QNX
Expand Down

0 comments on commit 712cb43

Please sign in to comment.