Damien Miller | 151c6e4 | 2017-06-01 15:25:13 +1000 | [diff] [blame] | 1 | /* Placed in the public domain */ |
| 2 | |
Darren Tucker | f21455a | 2017-10-31 10:09:33 +1100 | [diff] [blame] | 3 | #include "includes.h" |
| 4 | |
Damien Miller | 151c6e4 | 2017-06-01 15:25:13 +1000 | [diff] [blame] | 5 | #ifndef HAVE_GETPAGESIZE |
| 6 | |
| 7 | #include <unistd.h> |
| 8 | #include <limits.h> |
| 9 | |
| 10 | int |
| 11 | getpagesize(void) |
| 12 | { |
| 13 | #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) |
| 14 | long r = sysconf(_SC_PAGESIZE); |
| 15 | if (r > 0 && r < INT_MAX) |
| 16 | return (int)r; |
| 17 | #endif |
| 18 | /* |
| 19 | * This is at the lower end of common values and appropriate for |
| 20 | * our current use of getpagesize() in recallocarray(). |
| 21 | */ |
| 22 | return 4096; |
| 23 | } |
| 24 | |
| 25 | #endif /* HAVE_GETPAGESIZE */ |