replace_pagesize_in_mmap.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. diff --git a/src/libbacktrace/mmap.c b/src/libbacktrace/mmap.c
  2. index 138ef70711..e3c4cd2643 100644
  3. --- a/src/libbacktrace/mmap.c
  4. +++ b/src/libbacktrace/mmap.c
  5. @@ -140,7 +140,7 @@ backtrace_alloc (struct backtrace_state *state,
  6. {
  7. /* Allocate a new page. */
  8. - pagesize = getpagesize ();
  9. + pagesize = sysconf(_SC_PAGESIZE);
  10. asksize = (size + pagesize - 1) & ~ (pagesize - 1);
  11. page = mmap (NULL, asksize, PROT_READ | PROT_WRITE,
  12. MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  13. @@ -181,7 +181,7 @@ backtrace_free (struct backtrace_state *state, void *addr, size_t size,
  14. {
  15. size_t pagesize;
  16. - pagesize = getpagesize ();
  17. + pagesize = sysconf(_SC_PAGESIZE);
  18. if (((uintptr_t) addr & (pagesize - 1)) == 0
  19. && (size & (pagesize - 1)) == 0)
  20. {
  21. @@ -226,7 +226,7 @@ backtrace_vector_grow (struct backtrace_state *state,size_t size,
  22. size_t alc;
  23. void *base;
  24. - pagesize = getpagesize ();
  25. + pagesize = sysconf(_SC_PAGESIZE);
  26. alc = vec->size + size;
  27. if (vec->size == 0)
  28. alc = 16 * size;
  29. diff --git a/src/libbacktrace/mmapio.c b/src/libbacktrace/mmapio.c
  30. index dfdaf6fa52..5b23003090 100644
  31. --- a/src/libbacktrace/mmapio.c
  32. +++ b/src/libbacktrace/mmapio.c
  33. @@ -60,7 +60,7 @@ backtrace_get_view (struct backtrace_state *state ATTRIBUTE_UNUSED,
  34. off_t pageoff;
  35. void *map;
  36. - pagesize = getpagesize ();
  37. + pagesize = sysconf(_SC_PAGESIZE);
  38. inpage = offset % pagesize;
  39. pageoff = offset - inpage;