Commit c8ffe744 authored by cjihrig's avatar cjihrig Committed by Commit Bot

Fix SmartOS compilation errors

Change-Id: I12f67d79c11a209b02262c282a27cc7ef6afc14b
Reviewed-on: https://chromium-review.googlesource.com/806774Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49983}
parent 1da91b83
...@@ -63,6 +63,14 @@ ...@@ -63,6 +63,14 @@
#define MAP_ANONYMOUS MAP_ANON #define MAP_ANONYMOUS MAP_ANON
#endif #endif
#if defined(V8_OS_SOLARIS)
#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
extern "C" int madvise(caddr_t, size_t, int);
#else
extern int madvise(caddr_t, size_t, int);
#endif
#endif
#ifndef MADV_FREE #ifndef MADV_FREE
#define MADV_FREE MADV_DONTNEED #define MADV_FREE MADV_DONTNEED
#endif #endif
...@@ -137,7 +145,7 @@ int ReclaimInaccessibleMemory(void* address, size_t size) { ...@@ -137,7 +145,7 @@ int ReclaimInaccessibleMemory(void* address, size_t size) {
// marks the pages with the reusable bit, which allows both Activity Monitor // marks the pages with the reusable bit, which allows both Activity Monitor
// and memory-infra to correctly track the pages. // and memory-infra to correctly track the pages.
int ret = madvise(address, size, MADV_FREE_REUSABLE); int ret = madvise(address, size, MADV_FREE_REUSABLE);
#elif defined(_AIX) #elif defined(_AIX) || defined(V8_OS_SOLARIS)
int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE); int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE);
#else #else
int ret = madvise(address, size, MADV_FREE); int ret = madvise(address, size, MADV_FREE);
...@@ -146,7 +154,7 @@ int ReclaimInaccessibleMemory(void* address, size_t size) { ...@@ -146,7 +154,7 @@ int ReclaimInaccessibleMemory(void* address, size_t size) {
// MADV_FREE only works on Linux 4.5+ . If request failed, retry with older // MADV_FREE only works on Linux 4.5+ . If request failed, retry with older
// MADV_DONTNEED . Note that MADV_FREE being defined at compile time doesn't // MADV_DONTNEED . Note that MADV_FREE being defined at compile time doesn't
// imply runtime support. // imply runtime support.
#if defined(_AIX) #if defined(_AIX) || defined(V8_OS_SOLARIS)
ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED); ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED);
#else #else
ret = madvise(address, size, MADV_DONTNEED); ret = madvise(address, size, MADV_DONTNEED);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment