[git commit ldso-future] mmap64.c: use void * as in header, disable code that can't happen

Peter S. Mazinger ps.m at gmx.net
Wed Apr 20 10:50:38 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=6db10dbc6d1651eee96d9e3a61678a37926e9cb6
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future

Reorganize a bit.

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 libc/sysdeps/linux/common/mmap64.c |   38 +++++++++++++++--------------------
 1 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c
index 4ef0397..65a7381 100644
--- a/libc/sysdeps/linux/common/mmap64.c
+++ b/libc/sysdeps/linux/common/mmap64.c
@@ -6,17 +6,11 @@
 /* Massivly hacked up for uClibc by Erik Andersen */
 
 #include <_lfs_64.h>
-
-#ifdef __UCLIBC_HAS_LFS__
-
 #include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
 #include <sys/syscall.h>
-#include <bits/uClibc_page.h>
-
+#include <sys/mman.h>
 
-# if !defined __NR_mmap2
+#ifndef __NR_mmap2
 
 /*
  * This version is a stub that just chops off everything at the mmap 32 bit
@@ -26,7 +20,7 @@
  *
  */
 
-__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
+void *mmap64(void *addr, size_t len, int prot, int flags, int fd, __off64_t offset)
 {
 	if (offset != (off_t) offset ||
 	    (offset + len) != (off_t) (offset + len)) {
@@ -37,36 +31,36 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t
 	return mmap(addr, len, prot, flags, fd, (off_t) offset);
 }
 
-# else
+#else
+# include <bits/uClibc_page.h>
 
-#  define __NR___syscall_mmap2	    __NR_mmap2
-static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
+# define __NR___syscall_mmap2 __NR_mmap2
+static __inline__ _syscall6(void *, __syscall_mmap2, void *, addr,
 			size_t, len, int, prot, int, flags, int, fd,
 			off_t, offset)
 
-/* Some architectures always use 12 as page shift for mmap2() eventhough the
+/* Some architectures always use 12 as page shift for mmap2() even though the
  * real PAGE_SHIFT != 12.  Other architectures use the same value as
  * PAGE_SHIFT...
  */
-#  ifndef MMAP2_PAGE_SHIFT
-#   define MMAP2_PAGE_SHIFT 12
-#  endif
+# ifndef MMAP2_PAGE_SHIFT
+#  define MMAP2_PAGE_SHIFT 12
+# endif
 
-__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
+void *mmap64(void *addr, size_t len, int prot, int flags, int fd, __off64_t offset)
 {
 	if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
 		__set_errno(EINVAL);
 		return MAP_FAILED;
 	}
 
-#  ifdef __USE_FILE_OFFSET64
+# if 0 /*def __USE_FILE_OFFSET64 can't happen due to _lfs_64.h */
 	return __syscall_mmap2(addr, len, prot, flags,
 	                       fd, ((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
-#  else
+# else
 	return __syscall_mmap2(addr, len, prot, flags,
 	                       fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT));
-#  endif
+# endif
 }
 
-# endif
-#endif /* __UCLIBC_HAS_LFS__ */
+#endif
-- 
1.7.3.4



More information about the uClibc-cvs mailing list