1 /* Emulation of getpagesize() for systems that need it.
2 Copyright (C) 1991-2003 Free Software Foundation, Inc.
4 This file is part of GNU Bash, the Bourne-Again SHell.
6 Bash is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Bash is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Bash. If not, see <http://www.gnu.org/licenses/>.
20 #if defined (HAVE_UNISTD_H)
22 # include <sys/types.h>
25 # if defined (_SC_PAGESIZE)
26 # define getpagesize() sysconf(_SC_PAGESIZE)
28 # if defined (_SC_PAGE_SIZE)
29 # define getpagesize() sysconf(_SC_PAGE_SIZE)
30 # endif /* _SC_PAGE_SIZE */
31 # endif /* _SC_PAGESIZE */
34 #if !defined (getpagesize)
36 # include <sys/param.h>
38 # if defined (PAGESIZE)
39 # define getpagesize() PAGESIZE
40 # else /* !PAGESIZE */
41 # if defined (EXEC_PAGESIZE)
42 # define getpagesize() EXEC_PAGESIZE
43 # else /* !EXEC_PAGESIZE */
45 # if !defined (CLSIZE)
48 # define getpagesize() (NBPG * CLSIZE)
51 # define getpagesize() NBPC
54 # endif /* !EXEC_PAGESIZE */
55 # endif /* !PAGESIZE */
56 #endif /* !getpagesize */
58 #if !defined (getpagesize)
59 # define getpagesize() 4096 /* Just punt and use reasonable value */