xref: /dflybsd-src/contrib/cvs-1.12/lib/getpagesize.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /* Emulate getpagesize on systems that lack it.
286d7f5d3SJohn Marino    Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
386d7f5d3SJohn Marino 
486d7f5d3SJohn Marino    This program is free software; you can redistribute it and/or modify
586d7f5d3SJohn Marino    it under the terms of the GNU General Public License as published by
686d7f5d3SJohn Marino    the Free Software Foundation; either version 2, or (at your option)
786d7f5d3SJohn Marino    any later version.
886d7f5d3SJohn Marino 
986d7f5d3SJohn Marino    This program is distributed in the hope that it will be useful,
1086d7f5d3SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
1186d7f5d3SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1286d7f5d3SJohn Marino    GNU General Public License for more details.
1386d7f5d3SJohn Marino 
1486d7f5d3SJohn Marino    You should have received a copy of the GNU General Public License
1586d7f5d3SJohn Marino    along with this program; if not, write to the Free Software
1686d7f5d3SJohn Marino    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1786d7f5d3SJohn Marino    USA.  */
1886d7f5d3SJohn Marino 
1986d7f5d3SJohn Marino #ifndef HAVE_GETPAGESIZE
2086d7f5d3SJohn Marino 
2186d7f5d3SJohn Marino #ifdef HAVE_UNISTD_H
2286d7f5d3SJohn Marino # include <unistd.h>
2386d7f5d3SJohn Marino #endif
2486d7f5d3SJohn Marino 
2586d7f5d3SJohn Marino #if !defined getpagesize && defined _SC_PAGESIZE
2686d7f5d3SJohn Marino # if !(defined VMS && __VMS_VER < 70000000)
2786d7f5d3SJohn Marino #  define getpagesize() sysconf (_SC_PAGESIZE)
2886d7f5d3SJohn Marino # endif
2986d7f5d3SJohn Marino #endif
3086d7f5d3SJohn Marino 
3186d7f5d3SJohn Marino #if !defined getpagesize && defined VMS
3286d7f5d3SJohn Marino # ifdef __ALPHA
3386d7f5d3SJohn Marino #  define getpagesize() 8192
3486d7f5d3SJohn Marino # else
3586d7f5d3SJohn Marino #  define getpagesize() 512
3686d7f5d3SJohn Marino # endif
3786d7f5d3SJohn Marino #endif
3886d7f5d3SJohn Marino 
3986d7f5d3SJohn Marino /* This is for BeOS.  */
4086d7f5d3SJohn Marino #if !defined getpagesize && HAVE_OS_H
4186d7f5d3SJohn Marino # include <OS.h>
4286d7f5d3SJohn Marino # if defined B_PAGE_SIZE
4386d7f5d3SJohn Marino #  define getpagesize() B_PAGE_SIZE
4486d7f5d3SJohn Marino # endif
4586d7f5d3SJohn Marino #endif
4686d7f5d3SJohn Marino 
4786d7f5d3SJohn Marino #if !defined getpagesize && HAVE_SYS_PARAM_H
4886d7f5d3SJohn Marino # include <sys/param.h>
4986d7f5d3SJohn Marino # ifdef EXEC_PAGESIZE
5086d7f5d3SJohn Marino #  define getpagesize() EXEC_PAGESIZE
5186d7f5d3SJohn Marino # else
5286d7f5d3SJohn Marino #  ifdef NBPG
5386d7f5d3SJohn Marino #   ifndef CLSIZE
5486d7f5d3SJohn Marino #    define CLSIZE 1
5586d7f5d3SJohn Marino #   endif
5686d7f5d3SJohn Marino #   define getpagesize() (NBPG * CLSIZE)
5786d7f5d3SJohn Marino #  else
5886d7f5d3SJohn Marino #   ifdef NBPC
5986d7f5d3SJohn Marino #    define getpagesize() NBPC
6086d7f5d3SJohn Marino #   endif
6186d7f5d3SJohn Marino #  endif
6286d7f5d3SJohn Marino # endif
6386d7f5d3SJohn Marino #endif
6486d7f5d3SJohn Marino 
6586d7f5d3SJohn Marino #endif /* not HAVE_GETPAGESIZE */
66