Index: src/platform-linux.cc |
=================================================================== |
--- src/platform-linux.cc (revision 1536) |
+++ src/platform-linux.cc (working copy) |
@@ -42,8 +42,8 @@ |
#include <sys/types.h> // mmap & munmap |
#include <sys/mman.h> // mmap & munmap |
#include <sys/stat.h> // open |
-#include <sys/fcntl.h> // open |
-#include <unistd.h> // getpagesize |
+#include <fcntl.h> // open |
+#include <unistd.h> // sysconf |
#include <execinfo.h> // backtrace, backtrace_symbols |
#include <strings.h> // index |
#include <errno.h> |
@@ -230,14 +230,14 @@ |
size_t OS::AllocateAlignment() { |
- return getpagesize(); |
+ return sysconf(_SC_PAGESIZE); |
} |
void* OS::Allocate(const size_t requested, |
size_t* allocated, |
bool executable) { |
- const size_t msize = RoundUp(requested, getpagesize()); |
+ const size_t msize = RoundUp(requested, sysconf(_SC_PAGESIZE)); |
int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); |
void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
if (mbase == MAP_FAILED) { |