2 * The LLVM Compiler Infrastructure
4 * This file was developed by the LLVM research group and is distributed under
5 * the University of Illinois Open Source License. See LICENSE.TXT for details.
7 ******************************************************************************
9 * This header file provides a platform-independent way of quering page size.
15 #include "Config/unistd.h"
16 #include <sys/param.h>
20 /* Compatibility chart:
22 * Linux/x86: _SC_PAGESIZE, _SC_PAGE_SIZE
23 * MacOS X/PowerPC: v. 10.2: NBPG,
24 * v. 10.3: _SC_PAGESIZE
25 * Solaris/Sparc: _SC_PAGESIZE, _SC_PAGE_SIZE
29 * GetPageSize - wrapper to return page size in bytes for various
30 * architecture/OS combinations
32 unsigned GetPageSize() {
34 return sysconf(_SC_PAGESIZE);
35 #elif defined(_SC_PAGE_SIZE)
36 return sysconf(_SC_PAGE_SIZE);
43 return 4096; /* allocate 4KB as a fall-back */