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