Import OpenSSH-7.6p1
[dragonfly.git] / crypto / openssh / openbsd-compat / bsd-getpagesize.c
1 /* Placed in the public domain */
2
3 #ifndef HAVE_GETPAGESIZE
4
5 #include <unistd.h>
6 #include <limits.h>
7
8 int
9 getpagesize(void)
10 {
11 #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
12         long r = sysconf(_SC_PAGESIZE);
13         if (r > 0 && r < INT_MAX)
14                 return (int)r;
15 #endif
16         /*
17          * This is at the lower end of common values and appropriate for
18          * our current use of getpagesize() in recallocarray().
19          */
20         return 4096;
21 }
22
23 #endif /* HAVE_GETPAGESIZE */