1*a8fa202aSchristos /* $NetBSD: getpagesize.h,v 1.1.1.1 2016/01/10 21:36:20 christos Exp $ */ 2*a8fa202aSchristos 3*a8fa202aSchristos /* Emulate getpagesize on systems that lack it. */ 4*a8fa202aSchristos 5*a8fa202aSchristos #ifndef HAVE_GETPAGESIZE 6*a8fa202aSchristos 7*a8fa202aSchristos #if !defined getpagesize && defined __BEOS__ 8*a8fa202aSchristos # include <OS.h> 9*a8fa202aSchristos # define getpagesize() B_PAGE_SIZE 10*a8fa202aSchristos #endif 11*a8fa202aSchristos 12*a8fa202aSchristos #ifdef HAVE_UNISTD_H 13*a8fa202aSchristos # include <unistd.h> 14*a8fa202aSchristos #endif 15*a8fa202aSchristos 16*a8fa202aSchristos #if !defined getpagesize && defined _SC_PAGESIZE 17*a8fa202aSchristos # if !(defined VMS && __VMS_VER < 70000000) 18*a8fa202aSchristos # define getpagesize() sysconf (_SC_PAGESIZE) 19*a8fa202aSchristos # endif 20*a8fa202aSchristos #endif 21*a8fa202aSchristos 22*a8fa202aSchristos #if !defined getpagesize && defined VMS 23*a8fa202aSchristos # ifdef __ALPHA 24*a8fa202aSchristos # define getpagesize() 8192 25*a8fa202aSchristos # else 26*a8fa202aSchristos # define getpagesize() 512 27*a8fa202aSchristos # endif 28*a8fa202aSchristos #endif 29*a8fa202aSchristos 30*a8fa202aSchristos #ifndef getpagesize 31*a8fa202aSchristos # include <sys/param.h> 32*a8fa202aSchristos # ifdef EXEC_PAGESIZE 33*a8fa202aSchristos # define getpagesize() EXEC_PAGESIZE 34*a8fa202aSchristos # else 35*a8fa202aSchristos # ifdef NBPG 36*a8fa202aSchristos # ifndef CLSIZE 37*a8fa202aSchristos # define CLSIZE 1 38*a8fa202aSchristos # endif 39*a8fa202aSchristos # define getpagesize() (NBPG * CLSIZE) 40*a8fa202aSchristos # else 41*a8fa202aSchristos # ifdef NBPC 42*a8fa202aSchristos # define getpagesize() NBPC 43*a8fa202aSchristos # endif 44*a8fa202aSchristos # endif 45*a8fa202aSchristos # endif 46*a8fa202aSchristos #endif 47*a8fa202aSchristos 48*a8fa202aSchristos #endif /* not HAVE_GETPAGESIZE */ 49