[__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
[coreutils.git] / lib / getpagesize.h
blobe63c1c708c9505d766d19b0f992e89d3a0f3545c
1 /* Emulate getpagesize on systems that lack it.
2 Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 USA. */
19 #ifndef HAVE_GETPAGESIZE
21 #ifdef HAVE_UNISTD_H
22 # include <unistd.h>
23 #endif
25 #if !defined getpagesize && defined _SC_PAGESIZE
26 # if !(defined VMS && __VMS_VER < 70000000)
27 # define getpagesize() sysconf (_SC_PAGESIZE)
28 # endif
29 #endif
31 #if !defined getpagesize && defined VMS
32 # ifdef __ALPHA
33 # define getpagesize() 8192
34 # else
35 # define getpagesize() 512
36 # endif
37 #endif
39 /* This is for BeOS. */
40 #if !defined getpagesize && HAVE_OS_H
41 # include <OS.h>
42 # if defined B_PAGE_SIZE
43 # define getpagesize() B_PAGE_SIZE
44 # endif
45 #endif
47 #if !defined getpagesize && HAVE_SYS_PARAM_H
48 # include <sys/param.h>
49 # ifdef EXEC_PAGESIZE
50 # define getpagesize() EXEC_PAGESIZE
51 # else
52 # ifdef NBPG
53 # ifndef CLSIZE
54 # define CLSIZE 1
55 # endif
56 # define getpagesize() (NBPG * CLSIZE)
57 # else
58 # ifdef NBPC
59 # define getpagesize() NBPC
60 # endif
61 # endif
62 # endif
63 #endif
65 #endif /* not HAVE_GETPAGESIZE */