diff options
Diffstat (limited to 'crypto/openssh/openbsd-compat/bsd-getpagesize.c')
-rw-r--r-- | crypto/openssh/openbsd-compat/bsd-getpagesize.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crypto/openssh/openbsd-compat/bsd-getpagesize.c b/crypto/openssh/openbsd-compat/bsd-getpagesize.c new file mode 100644 index 000000000000..9daddfbd3865 --- /dev/null +++ b/crypto/openssh/openbsd-compat/bsd-getpagesize.c @@ -0,0 +1,23 @@ +/* Placed in the public domain */ + +#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 */ |