Use __getpagesize and __ffs in MMAP2_PAGE_SHIFT == -1 case of mmap64.

This commit is contained in:
Joseph Myers 2013-08-20 16:43:59 +00:00
parent b31469d0d4
commit 42c8fdd8f1
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,9 @@
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>

View File

@ -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))