File tree 2 files changed +20
-1
lines changed
deps/v8/src/base/platform
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 36
36
37
37
# Reset this number to 0 on major V8 upgrades.
38
38
# Increment by one for each non-official patch applied to deps/v8.
39
- 'v8_embedder_string' : '-node.17 ' ,
39
+ 'v8_embedder_string' : '-node.18 ' ,
40
40
41
41
##### V8 defaults for Node.js #####
42
42
Original file line number Diff line number Diff line change @@ -618,7 +618,26 @@ void OS::FreeAddressSpaceReservation(AddressSpaceReservation reservation) {
618
618
// Need to disable CFI_ICALL due to the indirect call to memfd_create.
619
619
DISABLE_CFI_ICALL
620
620
PlatformSharedMemoryHandle OS::CreateSharedMemoryHandleForTesting (size_t size) {
621
+ #if V8_OS_LINUX && !V8_OS_ANDROID
622
+ // Use memfd_create if available, otherwise mkstemp.
623
+ using memfd_create_t = int (*)(const char *, unsigned int );
624
+ memfd_create_t memfd_create =
625
+ reinterpret_cast <memfd_create_t >(dlsym (RTLD_DEFAULT, " memfd_create" ));
626
+ int fd = -1 ;
627
+ if (memfd_create) {
628
+ fd = memfd_create (" V8MemFDForTesting" , 0 );
629
+ }
630
+ if (fd == -1 ) {
631
+ char filename[] = " /tmp/v8_tmp_file_for_testing_XXXXXX" ;
632
+ fd = mkstemp (filename);
633
+ if (fd != -1 ) CHECK_EQ (0 , unlink (filename));
634
+ }
635
+ if (fd == -1 ) return kInvalidSharedMemoryHandle ;
636
+ CHECK_EQ (0 , ftruncate (fd, size));
637
+ return SharedMemoryHandleFromFileDescriptor (fd);
638
+ #else
621
639
return kInvalidSharedMemoryHandle ;
640
+ #endif
622
641
}
623
642
624
643
// static
You can’t perform that action at this time.
0 commit comments