This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Consistently use page_shift in sysdeps/unix/sysv/linux/mmap64.c


sysdeps/unix/sysv/linux/mmap64.c has a case for MMAP2_PAGE_SHIFT ==
-1, where the shift is determined at runtime with getpagesize.  But
while some uses inside mmap64 correctly use page_shift as a shift
amount, the syscall itself still uses MMAP2_PAGE_SHIFT.  This patch
fixes this.

(This doesn't affect any checked-in architecture support at present
because of the lack of definitions of MMAP2_PAGE_SHIFT to -1.  When
it's not defined to -1, page_shift is a macro defined to
MMAP2_PAGE_SHIFT and so this patch doesn't change anything.)

2013-06-28  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Shift by page_shift
	instead of MMAP2_PAGE_SHIFT in call to INLINE_SYSCALL.

diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c
index 175e4ab..e2dcdc4 100644
--- a/sysdeps/unix/sysv/linux/mmap64.c
+++ b/sysdeps/unix/sysv/linux/mmap64.c
@@ -56,7 +56,7 @@ __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset)
   result = (void *)
     INLINE_SYSCALL (mmap2, 6, addr,
 		    len, prot, flags, fd,
-		    (off_t) (offset >> MMAP2_PAGE_SHIFT));
+		    (off_t) (offset >> page_shift));
   return result;
 }
 weak_alias (__mmap64, mmap64)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]