My Project
Loading...
Searching...
No Matches
omGetPageSize.h
Go to the documentation of this file.
1/*******************************************************************
2 * File: omGetPageSize.h
3 * Purpose: figure out how to get the pagesize
4 * This is adapted from dlmalloc's mechanisms which in fact derived it from
5 * bsd/gnu getpagesize.h
6 *******************************************************************/
7#include <unistd.h>
8
9#ifndef omalloc_getpagesize
10# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
11# ifndef _SC_PAGE_SIZE
12# define _SC_PAGE_SIZE _SC_PAGESIZE
13# endif
14# endif
15# ifdef _SC_PAGE_SIZE
16# define omalloc_getpagesize sysconf(_SC_PAGE_SIZE)
17# else
18# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
19 extern size_t getpagesize();
20# define omalloc_getpagesize getpagesize()
21# else
22# include <sys/param.h>
23# ifdef EXEC_PAGESIZE
24# define omalloc_getpagesize EXEC_PAGESIZE
25# else
26# ifdef NBPG
27# ifndef CLSIZE
28# define omalloc_getpagesize NBPG
29# else
30# define omalloc_getpagesize (NBPG * CLSIZE)
31# endif
32# else
33# ifdef NBPC
34# define omalloc_getpagesize NBPC
35# else
36# ifdef PAGESIZE
37# define omalloc_getpagesize PAGESIZE
38# else
39# define omalloc_getpagesize (4096) /* just guess */
40# endif
41# endif
42# endif
43# endif
44# endif
45# endif
46#endif