Fix mmap64 on powerpc
Andreas Jaeger
aj@suse.de
Mon Jul 24 09:56:00 GMT 2000
My last patch was broken :-(. I've corrected this now (thanks to
Andreas Schwab) (already committed). I'm appending a diff against
yesterday's version to show the important difference (offset &
PAGE_MASK).
I hope it's really ok now,
Andreas
2000-07-24 Andreas Jaeger <aj@suse.de>
* sysdeps/unix/sysv/linux/powerpc/mmap64.c (__mmap64): Really fix
check for offset.
Index: sysdeps/unix/sysv/linux/powerpc/mmap64.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/powerpc/mmap64.c,v
retrieving revision 1.4
diff -u -r1.4 mmap64.c
--- mmap64.c 2000/07/21 07:43:25 1.4
+++ mmap64.c 2000/07/24 16:47:51
@@ -41,31 +41,31 @@
{
#ifdef __NR_mmap2
if (
-#ifndef __ASSUME_MMAP2_SYSCALL
+# ifndef __ASSUME_MMAP2_SYSCALL
! have_no_mmap2 &&
-#endif
- ! (offset & PAGE_MASK))
+# endif
+ ! (offset & ~PAGE_MASK))
{
-#ifndef __ASSUME_MMAP2_SYSCALL
+# ifndef __ASSUME_MMAP2_SYSCALL
int saved_errno = errno;
-#endif
+# endif
/* This will be always 12, no matter what page size is. */
__ptr_t result;
__ptrvalue (result) = INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), len, prot,
flags, fd, (off_t) (offset >> PAGE_SHIFT));
-#if __BOUNDED_POINTERS__
+# if __BOUNDED_POINTERS__
__ptrlow (result) = __ptrvalue (result);
__ptrhigh (result) = __ptrvalue (result) + len;
-#endif
-#ifndef __ASSUME_MMAP2_SYSCALL
+# endif
+# ifndef __ASSUME_MMAP2_SYSCALL
if (result != (__ptr_t) -1 || errno != ENOSYS)
-#endif
+# endif
return result;
-#ifndef __ASSUME_MMAP2_SYSCALL
+# ifndef __ASSUME_MMAP2_SYSCALL
__set_errno (saved_errno);
have_no_mmap2 = 1;
-#endif
+# endif
}
#endif
if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len))
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
More information about the Libc-hacker
mailing list