svn commit: branches/uClibc_0_9_29/libc/sysdeps/linux: arm common

vapier at uclibc.org vapier at uclibc.org
Sat Jan 5 09:07:45 PST 2008


Author: vapier
Date: 2008-01-05 09:07:45 -0800 (Sat, 05 Jan 2008)
New Revision: 20734

Log:
Merge r18616 by kraj from trunk:
Fix arm mmap when using mmap2 syscall. Fixes bug #1303


Modified:
   branches/uClibc_0_9_29/libc/sysdeps/linux/arm/mmap.c
   branches/uClibc_0_9_29/libc/sysdeps/linux/common/mmap64.c


Changeset:
Modified: branches/uClibc_0_9_29/libc/sysdeps/linux/arm/mmap.c
===================================================================
--- branches/uClibc_0_9_29/libc/sysdeps/linux/arm/mmap.c	2008-01-05 17:07:11 UTC (rev 20733)
+++ branches/uClibc_0_9_29/libc/sysdeps/linux/arm/mmap.c	2008-01-05 17:07:45 UTC (rev 20734)
@@ -27,7 +27,6 @@
 
 #elif defined  (__NR_mmap2)
 #define __NR__mmap __NR_mmap2
-
 #ifndef MMAP2_PAGE_SHIFT
 # define MMAP2_PAGE_SHIFT 12
 #endif
@@ -39,9 +38,17 @@
 {
   /* check if offset is page aligned */
     if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
+    {
+        __set_errno(EINVAL);
         return MAP_FAILED;
+    }
+#ifdef __USE_FILE_OFFSET64
   return (__ptr_t) _mmap (addr, len, prot, flags,
-						  fd,(off_t) (offset >> MMAP2_PAGE_SHIFT));
+						  fd,((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
+#else
+  return (__ptr_t) _mmap (addr, len, prot, flags,
+                          fd,((__u_long) offset >> MMAP2_PAGE_SHIFT));
+#endif
 }
 #elif defined (__NR_mmap)
 # define __NR__mmap __NR_mmap

Modified: branches/uClibc_0_9_29/libc/sysdeps/linux/common/mmap64.c
===================================================================
--- branches/uClibc_0_9_29/libc/sysdeps/linux/common/mmap64.c	2008-01-05 17:07:11 UTC (rev 20733)
+++ branches/uClibc_0_9_29/libc/sysdeps/linux/common/mmap64.c	2008-01-05 17:07:45 UTC (rev 20734)
@@ -58,8 +58,13 @@
 		__set_errno(EINVAL);
 		return MAP_FAILED;
 	}
-
-	return __syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT));
+#ifdef __USE_FILE_OFFSET64
+  return __syscall_mmap2(addr, len, prot, flags,
+                         fd,((__u_quad_t)offset >> MMAP2_PAGE_SHIFT));
+#else
+   return __syscall_mmap2(addr, len, prot, flags,
+                          fd,((__ulong_t)offset >> MMAP2_PAGE_SHIFT));
+#endif
 }
 
 # endif



More information about the uClibc-cvs mailing list