diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-08-20 16:43:59 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-08-20 16:43:59 +0000 |
commit | 42c8fdd8f1d3245a0abf957fc9f0a6eb35145643 (patch) | |
tree | 75ac0e75ac8b4e9c9ef6c88480bd39e06d3397a7 | |
parent | b31469d0d40ac858687657c72baaafd7a63041d9 (diff) | |
download | glibc-42c8fdd8f1d3245a0abf957fc9f0a6eb35145643.tar.gz glibc-42c8fdd8f1d3245a0abf957fc9f0a6eb35145643.tar.xz glibc-42c8fdd8f1d3245a0abf957fc9f0a6eb35145643.zip |
Use __getpagesize and __ffs in MMAP2_PAGE_SHIFT == -1 case of mmap64.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mmap64.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 0880ef74ec..d6eb8dcd45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ 2013-08-20 Joseph Myers <joseph@codesourcery.com> + + * sysdeps/unix/sysv/linux/mmap64.c (__mmap64) + [MMAP2_PAGE_SHIFT == -1]: Use __getpagesize to determine page + size. Use __ffs to determine corresponding shift. + +2013-08-20 Joseph Myers <joseph@codesourcery.com> Roland McGrath <roland@hack.frob.com> * Makefile (INSTALL): Remove trailing blank lines from output of diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c index e2dcdc4d9a..4ba686c8fb 100644 --- a/sysdeps/unix/sysv/linux/mmap64.c +++ b/sysdeps/unix/sysv/linux/mmap64.c @@ -42,9 +42,8 @@ __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) #if MMAP2_PAGE_SHIFT == -1 if (page_shift == 0) { - int page_size = getpagesize (); - while ((1 << ++page_shift) != page_size) - ; + int page_size = __getpagesize (); + page_shift = __ffs (page_size) - 1; } #endif if (offset & ((1 << page_shift) - 1)) |