From 999ae6be3243c7b4a815247199447b53c39a3d65 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 03:26:58 +0200 Subject: Adding upstream version 1:7.9p1. 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