mirror of
https://github.com/nodejs/node.git
synced 2024-11-27 22:16:50 +01:00
deps: make V8 compilable with older glibc
Remove call to `memfd_create`. The function that references it is only used for V8 testing. PR-URL: https://github.com/nodejs/node/pull/42657 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
parent
0cc81f0aa4
commit
84d455e08e
@ -36,7 +36,7 @@
|
||||
|
||||
# Reset this number to 0 on major V8 upgrades.
|
||||
# Increment by one for each non-official patch applied to deps/v8.
|
||||
'v8_embedder_string': '-node.3',
|
||||
'v8_embedder_string': '-node.4',
|
||||
|
||||
##### V8 defaults for Node.js #####
|
||||
|
||||
|
19
deps/v8/src/base/platform/platform-posix.cc
vendored
19
deps/v8/src/base/platform/platform-posix.cc
vendored
@ -618,26 +618,7 @@ void OS::FreeAddressSpaceReservation(AddressSpaceReservation reservation) {
|
||||
// Need to disable CFI_ICALL due to the indirect call to memfd_create.
|
||||
DISABLE_CFI_ICALL
|
||||
PlatformSharedMemoryHandle OS::CreateSharedMemoryHandleForTesting(size_t size) {
|
||||
#if V8_OS_LINUX && !V8_OS_ANDROID
|
||||
// Use memfd_create if available, otherwise mkstemp.
|
||||
using memfd_create_t = int (*)(const char*, unsigned int);
|
||||
memfd_create_t memfd_create =
|
||||
reinterpret_cast<memfd_create_t>(dlsym(RTLD_DEFAULT, "memfd_create"));
|
||||
int fd = -1;
|
||||
if (memfd_create) {
|
||||
fd = memfd_create("V8MemFDForTesting", 0);
|
||||
}
|
||||
if (fd == -1) {
|
||||
char filename[] = "/tmp/v8_tmp_file_for_testing_XXXXXX";
|
||||
fd = mkstemp(filename);
|
||||
if (fd != -1) CHECK_EQ(0, unlink(filename));
|
||||
}
|
||||
if (fd == -1) return kInvalidSharedMemoryHandle;
|
||||
CHECK_EQ(0, ftruncate(fd, size));
|
||||
return SharedMemoryHandleFromFileDescriptor(fd);
|
||||
#else
|
||||
return kInvalidSharedMemoryHandle;
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
|
Loading…
Reference in New Issue
Block a user