Backport 2011-04-04T22:08:01Z!lekktu@gmail.com and 2011-04-04T22:33:12Z!lekktu@gmail...
[emacs.git] / src / getpagesize.h
blob407e5ad4674adbb89998fb64fd86e5cd987dd7e7
1 /* Emulate getpagesize on systems that lack it.
2 Copyright (C) 1986, 1992, 1995, 2001, 2002, 2003, 2004,
3 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef HAVE_GETPAGESIZE
22 # ifdef HAVE_UNISTD_H
23 # include <unistd.h>
24 # endif
26 # ifdef _SC_PAGESIZE
27 # define getpagesize() sysconf(_SC_PAGESIZE)
28 # else /* no _SC_PAGESIZE */
29 # ifdef HAVE_SYS_PARAM_H
30 # include <sys/param.h>
31 # ifdef EXEC_PAGESIZE
32 # define getpagesize() EXEC_PAGESIZE
33 # else /* no EXEC_PAGESIZE */
34 # ifdef NBPG
35 # define getpagesize() NBPG * CLSIZE
36 # ifndef CLSIZE
37 # define CLSIZE 1
38 # endif /* no CLSIZE */
39 # else /* no NBPG */
40 # ifdef PAGESIZE
41 # define getpagesize() PAGESIZE
42 # endif /* PAGESIZE */
43 # endif /* no NBPG */
44 # endif /* no EXEC_PAGESIZE */
45 # else /* no HAVE_SYS_PARAM_H */
46 # define getpagesize() 8192 /* punt totally */
47 # endif /* no HAVE_SYS_PARAM_H */
48 # endif /* no _SC_PAGESIZE */
50 #endif /* no HAVE_GETPAGESIZE */
52 /* arch-tag: ff6206e3-97e2-4763-923a-e84bf28eabbc
53 (do not change this comment) */