Commit | Line | Data |
---|---|---|
bac7913a RM |
1 | /* Emulate getpagesize on systems that lack it. */ |
2 | ||
3 | #ifndef HAVE_GETPAGESIZE | |
4 | ||
eb93fe6a DM |
5 | # ifdef VMS |
6 | # define getpagesize() 512 | |
7 | # endif | |
bac7913a | 8 | |
eb93fe6a DM |
9 | # ifdef HAVE_UNISTD_H |
10 | # include <unistd.h> | |
11 | # endif | |
bac7913a | 12 | |
eb93fe6a DM |
13 | # ifdef _SC_PAGESIZE |
14 | # define getpagesize() sysconf(_SC_PAGESIZE) | |
4b45d671 DM |
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 */ | |
eb93fe6a | 39 | # endif /* no _SC_PAGESIZE */ |
bac7913a | 40 | |
eb93fe6a | 41 | #endif /* no HAVE_GETPAGESIZE */ |