From ea8e66ccd16fa264a1f1b4b1530b64c415fc70ec Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 3 Nov 2025 08:36:29 -0800
Subject: [PATCH] Don't use getpagesize() on Windows
Fixes https://github.com/libsdl-org/SDL/issues/14328
---
src/cpuinfo/SDL_cpuinfo.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c
index bdfb5a3b06935..c277db837a40f 100644
--- a/src/cpuinfo/SDL_cpuinfo.c
+++ b/src/cpuinfo/SDL_cpuinfo.c
@@ -29,7 +29,11 @@
// CPU feature detection for SDL
-#if defined(HAVE_SYSCONF) || defined(HAVE_GETPAGESIZE)
+#if defined(HAVE_GETPAGESIZE) && !defined(SDL_PLATFORM_WINDOWS)
+#define USE_GETPAGESIZE
+#endif
+
+#if defined(HAVE_SYSCONF) || defined(USE_GETPAGESIZE)
#include <unistd.h>
#endif
#ifdef HAVE_SYSCTLBYNAME
@@ -1252,7 +1256,7 @@ int SDL_GetSystemPageSize(void)
}
}
#endif
-#ifdef HAVE_GETPAGESIZE
+#ifdef USE_GETPAGESIZE
if (SDL_SystemPageSize <= 0) {
SDL_SystemPageSize = getpagesize();
}