Skip to content

Commit 5dea94c

Browse files
joyeecheungDan McDonald
authored andcommitted
[platform] support madvise(3C) across ALL illumos revisions
In illumos, madvise(3C) now takes `void *` for its first argument post-illumos#14418, but uses `caddr_t` pre-illumos#14418. This fix will detect if the illumos mman.h file in use is pre-or-post-illumos#14418 so builds can work either way. Co-Authored-By: Dan McDonald <[email protected]> Refs: nodejs/node#65161 Change-Id: I87faa4e7042cf9b02449bd3debfdd7fed30e5d3c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8532506 Reviewed-by: Michael Lippautz <[email protected]> Commit-Queue: Joyee Cheung <[email protected]> Cr-Commit-Position: refs/heads/main@{#111024}
1 parent 9ac4be9 commit 5dea94c

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎src/base/platform/platform-posix.cc‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,19 @@
8181
#define MAP_ANONYMOUS MAP_ANON
8282
#endif
8383

84-
#if defined(V8_OS_SOLARIS)
84+
/*
85+
* NOTE: illumos starting with illumos#14418 (pushed April 20th, 2022)
86+
* prototypes madvise(3C) properly with a `void *` first argument.
87+
* The only way to detect this outside of configure-time checking is to
88+
* check for the existence of MEMCNTL_SHARED, which gets defined for the first
89+
* time in illumos#14418 under the same circumstances save _STRICT_POSIX, which
90+
* thankfully neither Solaris nor illumos builds of Node or V8 do.
91+
*
92+
* If some future illumos push changes the MEMCNTL_SHARED assumptions made
93+
* above, the illumos check below will have to be revisited. This check
94+
* will work on both pre-and-post illumos#14418 illumos environments.
95+
*/
96+
#if defined(V8_OS_SOLARIS) && !(defined(__illumos__) && defined(MEMCNTL_SHARED))
8597
#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
8698
extern "C" int madvise(caddr_t, size_t, int);
8799
#else

0 commit comments

Comments
 (0)