PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/cvs/lib/getpagesize.h

https://bitbucket.org/freebsd/freebsd-head/
C++ Header | 55 lines | 36 code | 3 blank | 16 comment | 10 complexity | e0e6469198df78419a157f19c38ed7e1 MD5 | raw file
 1/* Emulation of getpagesize() for systems that need it.
 2   Copyright (C) 1991 Free Software Foundation, Inc.
 3
 4This program is free software; you can redistribute it and/or modify
 5it under the terms of the GNU General Public License as published by
 6the Free Software Foundation; either version 2 of the License, or
 7(at your option) any later version.
 8
 9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
17
18#if defined (HAVE_UNISTD_H)
19#  include <unistd.h>
20#  if defined (_SC_PAGESIZE)
21#    define getpagesize() sysconf(_SC_PAGESIZE)
22#  else
23#    if defined (_SC_PAGE_SIZE)
24#      define getpagesize() sysconf(_SC_PAGE_SIZE)
25#    endif /* _SC_PAGE_SIZE */
26#  endif /* _SC_PAGESIZE */
27#endif
28
29#if !defined (getpagesize)
30#  ifdef HAVE_SYS_PARAM_H
31#    include <sys/param.h>
32#  endif
33#  if defined (PAGESIZE)
34#     define getpagesize() PAGESIZE
35#  else /* !PAGESIZE */
36#    if defined (EXEC_PAGESIZE)
37#      define getpagesize() EXEC_PAGESIZE
38#    else /* !EXEC_PAGESIZE */
39#      if defined (NBPG)
40#        if !defined (CLSIZE)
41#          define CLSIZE 1
42#        endif /* !CLSIZE */
43#        define getpagesize() (NBPG * CLSIZE)
44#      else /* !NBPG */
45#        if defined (NBPC)
46#          define getpagesize() NBPC
47#        endif /* NBPC */
48#      endif /* !NBPG */
49#    endif /* !EXEC_PAGESIZE */
50#  endif /* !PAGESIZE */
51#endif /* !getpagesize */
52
53#if !defined (getpagesize)
54#  define getpagesize() 4096  /* Just punt and use reasonable value */
55#endif