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) | |
15 | # else | |
16 | # include <sys/param.h> | |
17 | # ifdef EXEC_PAGESIZE | |
18 | # define getpagesize() EXEC_PAGESIZE | |
19 | # else /* no EXEC_PAGESIZE */ | |
20 | # ifdef NBPG | |
21 | # define getpagesize() NBPG * CLSIZE | |
22 | # ifndef CLSIZE | |
23 | # define CLSIZE 1 | |
24 | # endif /* no CLSIZE */ | |
25 | # else /* no NBPG */ | |
26 | # ifdef NBPC | |
27 | # define getpagesize() NBPC | |
28 | # else /* no NBPC */ | |
29 | # ifdef PAGESIZE | |
30 | # define getpagesize() PAGESIZE | |
31 | # endif /* PAGESIZE */ | |
32 | # endif /* no NBPC */ | |
33 | # endif /* no NBPG */ | |
34 | # endif /* no EXEC_PAGESIZE */ | |
35 | # endif /* no _SC_PAGESIZE */ | |
bac7913a | 36 | |
eb93fe6a | 37 | #endif /* no HAVE_GETPAGESIZE */ |