Bash  5.0-beta2
Bash - Bourne Again shell
getpagesize.h
Go to the documentation of this file.
1 /* Emulation of getpagesize() for systems that need it.
2  Copyright (C) 1991-2003 Free Software Foundation, Inc.
3 
4  This file is part of GNU Bash, the Bourne-Again SHell.
5 
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.
10 
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.
15 
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/>.
18 */
19 
20 #if defined (HAVE_UNISTD_H)
21 # ifdef _MINIX
22 # include <sys/types.h>
23 # endif
24 # include <unistd.h>
25 # if defined (_SC_PAGESIZE)
26 # define getpagesize() sysconf(_SC_PAGESIZE)
27 # else
28 # if defined (_SC_PAGE_SIZE)
29 # define getpagesize() sysconf(_SC_PAGE_SIZE)
30 # endif /* _SC_PAGE_SIZE */
31 # endif /* _SC_PAGESIZE */
32 #endif
33 
34 #if !defined (getpagesize)
35 # if defined (HAVE_SYS_PARAM_H)
36 # include <sys/param.h>
37 # endif
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 */
44 # if defined (NBPG)
45 # if !defined (CLSIZE)
46 # define CLSIZE 1
47 # endif /* !CLSIZE */
48 # define getpagesize() (NBPG * CLSIZE)
49 # else /* !NBPG */
50 # if defined (NBPC)
51 # define getpagesize() NBPC
52 # endif /* NBPC */
53 # endif /* !NBPG */
54 # endif /* !EXEC_PAGESIZE */
55 # endif /* !PAGESIZE */
56 #endif /* !getpagesize */
57 
58 #if !defined (getpagesize)
59 # define getpagesize() 4096 /* Just punt and use reasonable value */
60 #endif