diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 19:49:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 19:49:46 +0000 |
commit | 0b6b94e6b6152f15cf4c2247c5974f539aae28cd (patch) | |
tree | a7698198a1f527ede17a929af46e456e03d50600 /openbsd-compat/bsd-getpagesize.c | |
parent | Initial commit. (diff) | |
download | openssh-0b6b94e6b6152f15cf4c2247c5974f539aae28cd.tar.xz openssh-0b6b94e6b6152f15cf4c2247c5974f539aae28cd.zip |
Adding upstream version 1:9.6p1.upstream/1%9.6p1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'openbsd-compat/bsd-getpagesize.c')
-rw-r--r-- | openbsd-compat/bsd-getpagesize.c | 25 |
1 files changed, 25 insertions, 0 deletions
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 <unistd.h> +#include <limits.h> + +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 */ |