getpagesize.h 1.51 KB
Newer Older
Gerd Moellmann's avatar
Gerd Moellmann committed
1
/* Emulate getpagesize on systems that lack it.
Paul Eggert's avatar
Paul Eggert committed
2
   Copyright (C) 1986, 1992, 1995, 2001-2019 Free Software Foundation,
3
   Inc.
Gerd Moellmann's avatar
Gerd Moellmann committed
4 5 6

This file is part of GNU Emacs.

7
GNU Emacs is free software: you can redistribute it and/or modify
Gerd Moellmann's avatar
Gerd Moellmann committed
8
it under the terms of the GNU General Public License as published by
9 10
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
Gerd Moellmann's avatar
Gerd Moellmann committed
11 12 13 14 15 16 17

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
18
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
Roland McGrath's avatar
Roland McGrath committed
19 20 21

#ifndef HAVE_GETPAGESIZE

Paul Eggert's avatar
Paul Eggert committed
22
# include <unistd.h>
Roland McGrath's avatar
Roland McGrath committed
23

David J. MacKenzie's avatar
David J. MacKenzie committed
24
# ifdef _SC_PAGESIZE
Juanma Barranquero's avatar
Juanma Barranquero committed
25
#  define getpagesize() sysconf (_SC_PAGESIZE)
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
# else /* no _SC_PAGESIZE */
#  ifdef HAVE_SYS_PARAM_H
#   include <sys/param.h>
#   ifdef EXEC_PAGESIZE
#    define getpagesize() EXEC_PAGESIZE
#   else /* no EXEC_PAGESIZE */
#    ifdef NBPG
#     define getpagesize() NBPG * CLSIZE
#     ifndef CLSIZE
#      define CLSIZE 1
#     endif /* no CLSIZE */
#    else /* no NBPG */
#      ifdef PAGESIZE
#       define getpagesize() PAGESIZE
#      endif /* PAGESIZE */
#    endif /* no NBPG */
#   endif /* no EXEC_PAGESIZE */
#  else /* no HAVE_SYS_PARAM_H */
#   define getpagesize() 8192	/* punt totally */
#  endif /* no HAVE_SYS_PARAM_H */
David J. MacKenzie's avatar
David J. MacKenzie committed
46
# endif /* no _SC_PAGESIZE */
Roland McGrath's avatar
Roland McGrath committed
47

David J. MacKenzie's avatar
David J. MacKenzie committed
48
#endif /* no HAVE_GETPAGESIZE */