@nxtedition/shared
Advanced tools
+2
-2
| { | ||
| "name": "@nxtedition/shared", | ||
| "description": "Cross-thread primitives for Node.js worker threads", | ||
| "version": "5.1.11", | ||
| "version": "5.1.12", | ||
| "type": "module", | ||
@@ -49,3 +49,3 @@ "main": "lib/index.js", | ||
| }, | ||
| "gitHead": "7d9b5f0e5066e988fa48e0703014509e217738e8" | ||
| "gitHead": "30ad35ec1e35ec0657f88d1c47efea4a4def6d16" | ||
| } |
+23
-4
@@ -155,2 +155,21 @@ #ifdef __linux__ | ||
| #include <linux/memfd.h> | ||
| // Some libc versions (e.g. glibc 2.36 on Debian bookworm) expose a partial set | ||
| // of huge-page constants through <sys/mman.h> — typically MAP_HUGETLB and | ||
| // MAP_HUGE_SHIFT but not MAP_HUGE_2MB. When the size-specific constant is | ||
| // missing, the guard in ring_buf_alloc_from_fd silently takes the fallback | ||
| // branch and forces huge_pages=false even when the allocation itself would | ||
| // have succeeded. Backfill the kernel UAPI values (stable ABI, identical on | ||
| // all mainstream architectures — x86_64, arm64, riscv64, etc.) so the | ||
| // huge-page code path compiles on every Linux toolchain. | ||
| #ifndef MAP_HUGETLB | ||
| #define MAP_HUGETLB 0x40000 | ||
| #endif | ||
| #ifndef MAP_HUGE_SHIFT | ||
| #define MAP_HUGE_SHIFT 26 | ||
| #endif | ||
| #ifndef MAP_HUGE_2MB | ||
| #define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) | ||
| #endif | ||
| #define RING_HUGE_2MB (2UL * 1024 * 1024) | ||
@@ -242,9 +261,9 @@ | ||
| int flags = MAP_FIXED | MAP_SHARED; | ||
| #if defined(__linux__) && defined(MAP_HUGE_2MB) && defined(MAP_HUGETLB) | ||
| // MAP_HUGETLB | MAP_HUGE_2MB: use explicit 2 MiB huge-page backing. | ||
| #ifdef __linux__ | ||
| // MAP_HUGETLB | MAP_HUGE_2MB: use explicit 2 MiB huge-page backing. Both | ||
| // constants are guaranteed to be defined by the fallbacks above. | ||
| if (huge_pages) | ||
| flags |= MAP_HUGETLB | MAP_HUGE_2MB; | ||
| #else | ||
| huge_pages = false; // MAP_HUGETLB not supported — ignore the request and report false from | ||
| // ring_get_huge_pages. | ||
| huge_pages = false; // non-Linux: no hugetlb support, report false from ring_get_huge_pages. | ||
| #endif | ||
@@ -251,0 +270,0 @@ if (mmap(addr, size, PROT_READ | PROT_WRITE, flags, fd, 0) == MAP_FAILED || |
Sorry, the diff of this file is not supported yet
98873
0.75%