summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm
diff options
context:
space:
mode:
authorKhem Raj <kraj@mvista.com>2007-05-15 00:37:02 +0000
committerKhem Raj <kraj@mvista.com>2007-05-15 00:37:02 +0000
commit22a4424b0b32a898950b917af834967c2672fb9e (patch)
tree5067067932182a7a0819ec153a200e825167a457 /libc/sysdeps/linux/arm
parent4bad09584733d17678511f5f8fa392a671f61ece (diff)
Fix arm mmap when using mmap2 syscall. Fixes bug #1303
Diffstat (limited to 'libc/sysdeps/linux/arm')
-rw-r--r--libc/sysdeps/linux/arm/mmap.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/arm/mmap.c b/libc/sysdeps/linux/arm/mmap.c
index 2eea38efc..63f76d7db 100644
--- a/libc/sysdeps/linux/arm/mmap.c
+++ b/libc/sysdeps/linux/arm/mmap.c
@@ -27,7 +27,6 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot,
#elif defined (__NR_mmap2)
#define __NR__mmap __NR_mmap2
-
#ifndef MMAP2_PAGE_SHIFT
# define MMAP2_PAGE_SHIFT 12
#endif
@@ -39,9 +38,17 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot,
{
/* 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,((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
+#else
return (__ptr_t) _mmap (addr, len, prot, flags,
- fd,(off_t) (offset >> MMAP2_PAGE_SHIFT));
+ fd,((__u_long) offset >> MMAP2_PAGE_SHIFT));
+#endif
}
#elif defined (__NR_mmap)
# define __NR__mmap __NR_mmap