From 25505898530a333011f4fd5cbc841ad6b26c089c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 16:40:04 +0200 Subject: Adding upstream version 1:9.2p1. 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