diff --git a/src/libbacktrace/mmap.c b/src/libbacktrace/mmap.c
index 138ef70711..e3c4cd2643 100644
--- a/src/libbacktrace/mmap.c
+++ b/src/libbacktrace/mmap.c
@@ -140,7 +140,7 @@ backtrace_alloc (struct backtrace_state *state,
     {
       /* Allocate a new page.  */
 
-      pagesize = getpagesize ();
+      pagesize = sysconf(_SC_PAGESIZE);
       asksize = (size + pagesize - 1) & ~ (pagesize - 1);
       page = mmap (NULL, asksize, PROT_READ | PROT_WRITE,
 		   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@@ -181,7 +181,7 @@ backtrace_free (struct backtrace_state *state, void *addr, size_t size,
     {
       size_t pagesize;
 
-      pagesize = getpagesize ();
+      pagesize = sysconf(_SC_PAGESIZE);
       if (((uintptr_t) addr & (pagesize - 1)) == 0
 	  && (size & (pagesize - 1)) == 0)
 	{
@@ -226,7 +226,7 @@ backtrace_vector_grow (struct backtrace_state *state,size_t size,
       size_t alc;
       void *base;
 
-      pagesize = getpagesize ();
+      pagesize = sysconf(_SC_PAGESIZE);
       alc = vec->size + size;
       if (vec->size == 0)
 	alc = 16 * size;
diff --git a/src/libbacktrace/mmapio.c b/src/libbacktrace/mmapio.c
index dfdaf6fa52..5b23003090 100644
--- a/src/libbacktrace/mmapio.c
+++ b/src/libbacktrace/mmapio.c
@@ -60,7 +60,7 @@ backtrace_get_view (struct backtrace_state *state ATTRIBUTE_UNUSED,
   off_t pageoff;
   void *map;
 
-  pagesize = getpagesize ();
+  pagesize = sysconf(_SC_PAGESIZE);
   inpage = offset % pagesize;
   pageoff = offset - inpage;
 
