summary refs log tree commit diff
path: root/compat/getpagesize.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/getpagesize.c')
-rw-r--r--compat/getpagesize.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/compat/getpagesize.c b/compat/getpagesize.c
new file mode 100644
index 0000000..cbaae92
--- /dev/null
+++ b/compat/getpagesize.c
@@ -0,0 +1,18 @@
+/* $OpenBSD$ */
+
+#include <unistd.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+int
+getpagesize(void) {
+#ifdef _WIN32
+	SYSTEM_INFO system_info;
+	GetSystemInfo(&system_info);
+	return system_info.dwPageSize;
+#else
+	return sysconf(_SC_PAGESIZE);
+#endif
+}