]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Always use the same method to query the system page size
authorUlf Hermann <ulf.hermann@qt.io>
Wed, 15 Feb 2017 14:28:38 +0000 (15:28 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 15 Feb 2017 14:32:45 +0000 (15:32 +0100)
This makes it easier to write a replacement for it on systems where
sysconf(3) doesn't exist.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
lib/ChangeLog
lib/crc32_file.c
libdwfl/ChangeLog
libdwfl/linux-kernel-modules.c
libdwfl/linux-proc-maps.c

index 5ccf4d6b556ca3aa8c60dc43d3c9a4bfb8773c6b..6578ddbaef0da442cdbcdf017a3f1aba4f52ad5f 100644 (file)
@@ -1,3 +1,7 @@
+2017-02-15  Ulf Hermann  <ulf.hermann@qt.io>
+
+       * crc32_file.c: Use _SC_PAGESIZE rather than _SC_PAGE_SIZE.
+
 2017-02-14  Ulf Hermann  <ulf.hermann@qt.io>
 
        * color.h: New file.
index 57e429807368bb6cf98a518dc43f5d039275938d..f7607d0bcb2e85465c41bc84c1e0d4570fca0449 100644 (file)
@@ -53,7 +53,7 @@ crc32_file (int fd, uint32_t *resp)
       void *mapped = mmap (NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0);
       if (mapped == MAP_FAILED && errno == ENOMEM)
        {
-         const size_t pagesize = sysconf (_SC_PAGE_SIZE);
+         const size_t pagesize = sysconf (_SC_PAGESIZE);
          mapsize = ((mapsize / 2) + pagesize - 1) & -pagesize;
          while (mapsize >= pagesize
                 && (mapped = mmap (NULL, mapsize, PROT_READ, MAP_PRIVATE,
index 57671eafaa3ba27b3d893e723d4c46c7b6db5d36..52466cc35fcee288e5474ca0559910c846a9c721 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-15  Ulf Hermann  <ulf.hermann@qt.io>
+
+       * linux-kernel-modules.c: Use sysconf(_SC_PAGESIZE) to get page size.
+       * linux-proc-maps.c: Likewise.
+
 2016-12-29  Luiz Angelo Daros de Luca  <luizluca@gmail.com>
 
        * dwfl_build_id_find_elf.c: Include system.h.
index 9cd8ea93a159d5898a5b41eb6b7ae1dea73d2505..a7ac19d2627e1e037d5409875be1a7d5cf1e2c9d 100644 (file)
@@ -500,7 +500,7 @@ intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes)
        if (*notes == 0 && !strcmp (state.p, "__start_notes\n"))
          *notes = *end;
 
-      Dwarf_Addr round_kernel = sysconf (_SC_PAGE_SIZE);
+      Dwarf_Addr round_kernel = sysconf (_SC_PAGESIZE);
       *start &= -(Dwarf_Addr) round_kernel;
       *end += round_kernel - 1;
       *end &= -(Dwarf_Addr) round_kernel;
index 4ae1e74a3ac87b4e9f47728296601a1d2cee585f..094dd53daea3d76ac2e7ba273516a589dbc2ca51 100644 (file)
@@ -418,7 +418,7 @@ dwfl_linux_proc_find_elf (Dwfl_Module *mod __attribute__ ((unused)),
       if (fd < 0)
        goto detach;
 
-      *elfp = elf_from_remote_memory (base, getpagesize (), NULL,
+      *elfp = elf_from_remote_memory (base, sysconf (_SC_PAGESIZE), NULL,
                                      &read_proc_memory, &fd);
 
       close (fd);