1 /* $NetBSD: getpagesize.h,v 1.4 2016/01/17 22:51:32 christos Exp $ */ 2 3 /* Emulate getpagesize on systems that lack it. */ 4 5 #ifdef HAVE_UNISTD_H 6 #include <unistd.h> 7 #endif 8 9 #ifndef HAVE_GETPAGESIZE 10 11 #ifdef VMS 12 #define getpagesize() 512 13 #endif 14 15 16 #ifdef _SC_PAGESIZE 17 #define getpagesize() sysconf(_SC_PAGESIZE) 18 #else 19 20 #include <sys/param.h> 21 22 #ifdef EXEC_PAGESIZE 23 #define getpagesize() EXEC_PAGESIZE 24 #else 25 #ifdef NBPG 26 #define getpagesize() (NBPG * CLSIZE) 27 #ifndef CLSIZE 28 #define CLSIZE 1 29 #endif /* no CLSIZE */ 30 #else /* no NBPG */ 31 #ifdef NBPC 32 #define getpagesize() NBPC 33 #else /* no NBPC */ 34 #ifdef PAGESIZE 35 #define getpagesize() PAGESIZE 36 #endif 37 #endif /* NBPC */ 38 #endif /* no NBPG */ 39 #endif /* no EXEC_PAGESIZE */ 40 #endif /* no _SC_PAGESIZE */ 41 42 #endif /* not HAVE_GETPAGESIZE */ 43