.
[emacs.git] / src / getpagesize.h
bloba064973d15f30c449e845a3b12d3942ee6276e6f
1 /* Emulate getpagesize on systems that lack it. */
3 #ifndef HAVE_GETPAGESIZE
5 # ifdef VMS
6 # define getpagesize() 512
7 # endif
9 # ifdef HAVE_UNISTD_H
10 # include <unistd.h>
11 # endif
13 # ifdef _SC_PAGESIZE
14 # define getpagesize() sysconf(_SC_PAGESIZE)
15 # else /* no _SC_PAGESIZE */
16 # ifdef HAVE_SYS_PARAM_H
17 # include <sys/param.h>
18 # ifdef EXEC_PAGESIZE
19 # define getpagesize() EXEC_PAGESIZE
20 # else /* no EXEC_PAGESIZE */
21 # ifdef NBPG
22 # define getpagesize() NBPG * CLSIZE
23 # ifndef CLSIZE
24 # define CLSIZE 1
25 # endif /* no CLSIZE */
26 # else /* no NBPG */
27 # ifdef NBPC
28 # define getpagesize() NBPC
29 # else /* no NBPC */
30 # ifdef PAGESIZE
31 # define getpagesize() PAGESIZE
32 # endif /* PAGESIZE */
33 # endif /* no NBPC */
34 # endif /* no NBPG */
35 # endif /* no EXEC_PAGESIZE */
36 # else /* no HAVE_SYS_PARAM_H */
37 # define getpagesize() 8192 /* punt totally */
38 # endif /* no HAVE_SYS_PARAM_H */
39 # endif /* no _SC_PAGESIZE */
41 #endif /* no HAVE_GETPAGESIZE */