]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Use sysconf to get the page size as it is more portable.
authorTom Hughes <tom@compton.nu>
Mon, 7 Nov 2005 16:46:55 +0000 (16:46 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 7 Nov 2005 16:46:55 +0000 (16:46 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5029

coregrind/launcher.c

index 08a1792d9d95851f388d82a895ab7bc79ef514fa..b994716d1d766b54cc5d447fb846237f8ac6664b 100644 (file)
@@ -105,6 +105,7 @@ static const char *select_platform(const char *clientname)
    int fd;
    unsigned char *header;
    const char *platform = NULL;
+   int32_t pagesize = sysconf(_SC_PAGESIZE);
 
    if (strchr(clientname, '/') == NULL)
       clientname = find_client(clientname);
@@ -113,7 +114,7 @@ static const char *select_platform(const char *clientname)
       return NULL;
    //   barf("open(%s): %s", clientname, strerror(errno));
 
-   if ((header = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
+   if ((header = mmap(NULL, pagesize, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
       return NULL;
    //   barf("mmap(%s): %s", clientname, strerror(errno));
 
@@ -155,7 +156,7 @@ static const char *select_platform(const char *clientname)
       }
    }
 
-   munmap(header, PAGE_SIZE);
+   munmap(header, pagesize);
 
    return platform;
 }