From cdb5470c704af9b4e6ce9a6aecb7a466f3732578 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 30 Oct 2026 06:53:55 +0100 Subject: [PATCH] pinned.cu: the shared-arena tmpfs check is Linux-only (sys/vfs.h and statfs f_type), so the Metal host build compiles again --- src/core/pinned.cu | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/pinned.cu b/src/core/pinned.cu index 45be4abb..01591340 100644 --- a/src/core/pinned.cu +++ b/src/core/pinned.cu @@ -33,7 +33,9 @@ #include #include #include +#ifdef __linux__ #include +#endif #include #include #ifndef MAP_HUGE_2MB @@ -384,6 +386,7 @@ void* reserve(uint64_t bytes, PageBacking& got, std::string& note, const std::st // tmpfs: take the pages now (ftruncate only sets the length). With /dev/shm too small the load would die with a bus // error part-way; here a full tmpfs is a plain error at start, for every engine that maps the file (pages already // taken cost nothing), and the server then starts its replicas with private copies. A file on a disk stays sparse. +#ifdef __linux__ { struct statfs sf{}; if (fstatfs(fd, &sf) == 0 && (unsigned long) sf.f_type == 0x01021994ul) { @@ -411,6 +414,7 @@ void* reserve(uint64_t bytes, PageBacking& got, std::string& note, const std::st } } } +#endif void* map = mmap(nullptr, (size_t) file_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); const int e = errno; close(fd);