| 1 | /* Emulate getpagesize on systems that lack it.
|
|---|
| 2 | Copyright (C) 1999, 2000, 2004, 2005 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 7 | any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|---|
| 17 | USA. */
|
|---|
| 18 |
|
|---|
| 19 | #ifndef HAVE_GETPAGESIZE
|
|---|
| 20 |
|
|---|
| 21 | #include <unistd.h>
|
|---|
| 22 |
|
|---|
| 23 | #if !defined getpagesize && defined _SC_PAGESIZE
|
|---|
| 24 | # if ! (defined __VMS && __VMS_VER < 70000000)
|
|---|
| 25 | # define getpagesize() sysconf (_SC_PAGESIZE)
|
|---|
| 26 | # endif
|
|---|
| 27 | #endif
|
|---|
| 28 |
|
|---|
| 29 | #if !defined getpagesize && defined __VMS
|
|---|
| 30 | # ifdef __ALPHA
|
|---|
| 31 | # define getpagesize() 8192
|
|---|
| 32 | # else
|
|---|
| 33 | # define getpagesize() 512
|
|---|
| 34 | # endif
|
|---|
| 35 | #endif
|
|---|
| 36 |
|
|---|
| 37 | /* This is for BeOS. */
|
|---|
| 38 | #if !defined getpagesize && HAVE_OS_H
|
|---|
| 39 | # include <OS.h>
|
|---|
| 40 | # if defined B_PAGE_SIZE
|
|---|
| 41 | # define getpagesize() B_PAGE_SIZE
|
|---|
| 42 | # endif
|
|---|
| 43 | #endif
|
|---|
| 44 |
|
|---|
| 45 | #if !defined getpagesize && HAVE_SYS_PARAM_H
|
|---|
| 46 | # include <sys/param.h>
|
|---|
| 47 | # ifdef EXEC_PAGESIZE
|
|---|
| 48 | # define getpagesize() EXEC_PAGESIZE
|
|---|
| 49 | # else
|
|---|
| 50 | # ifdef NBPG
|
|---|
| 51 | # ifndef CLSIZE
|
|---|
| 52 | # define CLSIZE 1
|
|---|
| 53 | # endif
|
|---|
| 54 | # define getpagesize() (NBPG * CLSIZE)
|
|---|
| 55 | # else
|
|---|
| 56 | # ifdef NBPC
|
|---|
| 57 | # define getpagesize() NBPC
|
|---|
| 58 | # endif
|
|---|
| 59 | # endif
|
|---|
| 60 | # endif
|
|---|
| 61 | #endif
|
|---|
| 62 |
|
|---|
| 63 | #endif /* not HAVE_GETPAGESIZE */
|
|---|