From 0b6b94e6b6152f15cf4c2247c5974f539aae28cd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 21:49:46 +0200 Subject: Adding upstream version 1:9.6p1. Signed-off-by: Daniel Baumann --- openbsd-compat/bsd-getpagesize.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 openbsd-compat/bsd-getpagesize.c (limited to 'openbsd-compat/bsd-getpagesize.c') diff --git a/openbsd-compat/bsd-getpagesize.c b/openbsd-compat/bsd-getpagesize.c new file mode 100644 index 0000000..416a8d4 --- /dev/null +++ b/openbsd-compat/bsd-getpagesize.c @@ -0,0 +1,25 @@ +/* Placed in the public domain */ + +#include "includes.h" + +#ifndef HAVE_GETPAGESIZE + +#include +#include + +int +getpagesize(void) +{ +#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) + long r = sysconf(_SC_PAGESIZE); + if (r > 0 && r < INT_MAX) + return (int)r; +#endif + /* + * This is at the lower end of common values and appropriate for + * our current use of getpagesize() in recallocarray(). + */ + return 4096; +} + +#endif /* HAVE_GETPAGESIZE */ -- cgit v1.2.3