Skip to content

Commit 5f5b0e3

Browse files
committed
deps: 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.
1 parent b197355 commit 5f5b0e3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.16',
41+
'v8_embedder_string': '-node.17',
4242

4343
##### V8 defaults for Node.js #####
4444

deps/v8/src/base/platform/platform-posix.cc

+13-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,19 @@
8080
#define MAP_ANONYMOUS MAP_ANON
8181
#endif
8282

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

0 commit comments

Comments
 (0)