summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-03-19 13:39:32 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:28 +0200
commit2b836fc1d536a44282010643e438257cb599d1d0 (patch)
tree0c7a9a4f02c673ab78453e23016d967e6ec8df70
parentf8942a121c022cf48e5bfbc6122f28219b36751f (diff)
mmap.c: provide a common mmap.c that is good for most of archs
Remove all others, only avr32 needs to be kept. Define __UCLIBC_ARCH_HAS_6_ARGS__ where needed. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--libc/sysdeps/linux/arm/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/arm/mmap.c74
-rw-r--r--libc/sysdeps/linux/avr32/mmap.c6
-rw-r--r--libc/sysdeps/linux/common/mmap.c90
-rw-r--r--libc/sysdeps/linux/frv/Makefile2
-rw-r--r--libc/sysdeps/linux/frv/mmap.c50
-rw-r--r--libc/sysdeps/linux/hppa/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h2
-rw-r--r--libc/sysdeps/linux/hppa/mmap.c19
-rw-r--r--libc/sysdeps/linux/microblaze/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/microblaze/mmap.c16
-rw-r--r--libc/sysdeps/linux/mips/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/mips/mmap.c26
-rw-r--r--libc/sysdeps/linux/sh/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/sh/mmap.c34
-rw-r--r--libc/sysdeps/linux/v850/Makefile2
-rw-r--r--libc/sysdeps/linux/v850/bits/uClibc_arch_features.h2
-rw-r--r--libc/sysdeps/linux/v850/mmap.c16
-rw-r--r--libc/sysdeps/linux/vax/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/vax/mmap.c10
-rw-r--r--libc/sysdeps/linux/x86_64/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/x86_64/mmap.c19
22 files changed, 63 insertions, 319 deletions
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index 093eb2dbd..0cc2626f3 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -5,7 +5,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := brk.c ioperm.c iopl.c mmap.c __syscall_error.c sigaction.c
+CSRC := brk.c ioperm.c iopl.c __syscall_error.c sigaction.c
SSRC := \
__longjmp.S setjmp.S bsd-setjmp.S \
diff --git a/libc/sysdeps/linux/arm/mmap.c b/libc/sysdeps/linux/arm/mmap.c
deleted file mode 100644
index df550fedf..000000000
--- a/libc/sysdeps/linux/arm/mmap.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * _mmap() for uClibc
- *
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
- *
- * GNU Library General Public License (LGPL) version 2 or later.
- */
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-
-#if defined (__NR_mmap) || defined (__NR_mmap2)
-
-libc_hidden_proto(mmap)
-#if defined (__UCLIBC_MMAP_HAS_6_ARGS__) && defined (__NR_mmap)
-#define __NR__mmap __NR_mmap
-static __inline__ _syscall6 (__ptr_t, _mmap, __ptr_t, addr, size_t, len,
- int, prot, int, flags, int, fd, __off_t, offset)
-__ptr_t mmap(__ptr_t addr, size_t len, int prot,
- int flags, int fd, __off_t offset)
-{
- return (__ptr_t) _mmap (addr, len, prot, flags,
- fd, offset);
-}
-
-#elif defined (__NR_mmap2)
-#define __NR__mmap __NR_mmap2
-
-#ifndef MMAP2_PAGE_SHIFT
-# define MMAP2_PAGE_SHIFT 12
-#endif
-
-static __inline__ _syscall6 (__ptr_t, _mmap, __ptr_t, addr, size_t, len,
- int, prot, int, flags, int, fd, __off_t, offset);
-__ptr_t mmap(__ptr_t addr, size_t len, int prot,
- int flags, int fd, __off_t offset)
-{
- /* 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, ((__u_long) offset >> MMAP2_PAGE_SHIFT));
-#endif
-}
-#elif defined (__NR_mmap)
-# define __NR__mmap __NR_mmap
-static __inline__ _syscall1(__ptr_t, _mmap, unsigned long *, buffer)
-__ptr_t mmap(__ptr_t addr, size_t len, int prot,
- int flags, int fd, __off_t offset)
-{
- unsigned long buffer[6];
-
- buffer[0] = (unsigned long) addr;
- buffer[1] = (unsigned long) len;
- buffer[2] = (unsigned long) prot;
- buffer[3] = (unsigned long) flags;
- buffer[4] = (unsigned long) fd;
- buffer[5] = (unsigned long) offset;
- return (__ptr_t) _mmap(buffer);
-}
-#endif
-libc_hidden_def (mmap)
-#else
-# error "Your architecture doesn't seem to provide mmap() !?"
-#endif
diff --git a/libc/sysdeps/linux/avr32/mmap.c b/libc/sysdeps/linux/avr32/mmap.c
index dee88aaf2..cd3315810 100644
--- a/libc/sysdeps/linux/avr32/mmap.c
+++ b/libc/sysdeps/linux/avr32/mmap.c
@@ -12,10 +12,10 @@
#include <sys/syscall.h>
-static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot,
- int, flags, int, fd, __off_t, pgoff)
+static __inline__ _syscall6(void *, mmap2, void *, addr, size_t, len, int, prot,
+ int, flags, int, fd, __off_t, pgoff)
-__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
+void *mmap(void *addr, size_t len, int prot, int flags, int fd, __off_t offset)
{
unsigned long page_size = sysconf(_SC_PAGESIZE);
unsigned long pgoff;
diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c
index d53eabb18..dbc66c208 100644
--- a/libc/sysdeps/linux/common/mmap.c
+++ b/libc/sysdeps/linux/common/mmap.c
@@ -7,25 +7,57 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <sys/syscall.h>
-#include <unistd.h>
#include <sys/mman.h>
-#include <bits/uClibc_page.h>
+#include <sys/syscall.h>
-#ifdef __NR_mmap
+#if defined __UCLIBC_MMAP_HAS_6_ARGS__ && defined __NR_mmap
+# ifndef _syscall6
+# error disable __UCLIBC_MMAP_HAS_6_ARGS__ for this arch
+# endif
-#ifdef __UCLIBC_MMAP_HAS_6_ARGS__
+# define __NR__mmap __NR_mmap
+static _syscall6(void *, _mmap, void *, addr, size_t, len,
+ int, prot, int, flags, int, fd, __off_t, offset)
-_syscall6(void *, mmap, void *, start, size_t, length,
- int, prot, int, flags, int, fd, off_t, offset)
+#elif defined __NR_mmap2 && defined _syscall6
-#else
+# include <errno.h>
+# include <bits/uClibc_page.h>
+# ifndef MMAP2_PAGE_SHIFT
+# define MMAP2_PAGE_SHIFT 12
+# endif
-# define __NR__mmap __NR_mmap
-static __inline__ _syscall1(__ptr_t, _mmap, unsigned long *, buffer)
-__ptr_t mmap(__ptr_t addr, size_t len, int prot,
- int flags, int fd, __off_t offset)
+# 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)
+
+static void *_mmap(void *addr, size_t len, int prot, int flags,
+ int fd, __off_t offset)
+{
+ const int mmap2_shift = MMAP2_PAGE_SHIFT;
+ const __off_t mmap2_mask = ((__off_t) 1 << MMAP2_PAGE_SHIFT) - 1;
+ /* check if offset is page aligned */
+ if (offset & mmap2_mask) {
+ __set_errno(EINVAL);
+ return MAP_FAILED;
+ }
+# ifdef __USE_FILE_OFFSET64
+ return __syscall_mmap2(addr, len, prot, flags, fd,
+ ((__u_quad_t) offset >> mmap2_shift));
+# else
+ return __syscall_mmap2(addr, len, prot, flags, fd,
+ ((__u_long) offset >> mmap2_shift));
+# endif
+}
+
+#elif defined __NR_mmap
+
+# define __NR___syscall_mmap __NR_mmap
+static __inline__ _syscall1(void *, __syscall_mmap, unsigned long *, buffer)
+
+static void *_mmap(void *addr, size_t len, int prot, int flags,
+ int fd, __off_t offset)
{
unsigned long buffer[6];
@@ -35,38 +67,14 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot,
buffer[3] = (unsigned long) flags;
buffer[4] = (unsigned long) fd;
buffer[5] = (unsigned long) offset;
- return (__ptr_t) _mmap(buffer);
+ return __syscall_mmap(buffer);
}
-#endif
-
-libc_hidden_def(mmap)
-
-#elif defined(__NR_mmap2)
-
+#else
-#define __NR___syscall_mmap2 __NR_mmap2
-static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
- size_t, len, int, prot, int, flags, int, fd, off_t, offset)
+# error "Your architecture doesn't seem to provide mmap() !?"
-/* Some architectures always use 12 as page shift for mmap2() eventhough the
- * real PAGE_SHIFT != 12. Other architectures use the same value as
- * PAGE_SHIFT...
- */
-# ifndef MMAP2_PAGE_SHIFT
-# define MMAP2_PAGE_SHIFT 12
-# endif
-
-__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
-{
- if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
- __set_errno(EINVAL);
- return MAP_FAILED;
- }
- return __syscall_mmap2(addr, len, prot, flags,
- fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT));
-}
+#endif
+strong_alias(_mmap,mmap)
libc_hidden_def(mmap)
-
-#endif
diff --git a/libc/sysdeps/linux/frv/Makefile b/libc/sysdeps/linux/frv/Makefile
index 554fdb0f4..7cdb8eca3 100644
--- a/libc/sysdeps/linux/frv/Makefile
+++ b/libc/sysdeps/linux/frv/Makefile
@@ -17,7 +17,7 @@ CTOR_TARGETS := crti.o crtn.o
SSRC := __longjmp.S setjmp.S clone.S vfork.S
SOBJ := $(patsubst %.S,%.o, $(SSRC))
-CSRC = mmap.c sysdep.c syscall.c brk.c sbrk.c __init_brk.c dl-iterate-phdr.c
+CSRC = sysdep.c syscall.c brk.c sbrk.c __init_brk.c dl-iterate-phdr.c
CSRC += xstatconv.c stat.c stat64.c fstat.c fstat64.c lstat.c lstat64.c
COBJ := $(patsubst %.c,%.o, $(CSRC))
diff --git a/libc/sysdeps/linux/frv/mmap.c b/libc/sysdeps/linux/frv/mmap.c
deleted file mode 100644
index cb9112483..000000000
--- a/libc/sysdeps/linux/frv/mmap.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Daniel Jacobowitz <dan@debian.org>, 1999.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* Massivly hacked up for uClibc by Erik Andersen */
-
-/* Extracted from ../common/mmap64.c by Alexandre Oliva <aoliva@redhat.com>
-
- We don't want to use the old mmap interface. */
-
-#include <features.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <sys/mman.h>
-
-
-#define __NR___syscall_mmap2 __NR_mmap2
-static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
- size_t, len, int, prot, int, flags, int, fd, off_t, offset)
-
-/* This is always 12, even on architectures where PAGE_SHIFT != 12. */
-# ifndef MMAP2_PAGE_SHIFT
-# define MMAP2_PAGE_SHIFT 12
-# endif
-
-__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
-{
- if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
- __set_errno (EINVAL);
- return MAP_FAILED;
- }
- return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));
-}
-libc_hidden_def(mmap)
diff --git a/libc/sysdeps/linux/hppa/Makefile.arch b/libc/sysdeps/linux/hppa/Makefile.arch
index 2b0cf09a8..f155cc8f3 100644
--- a/libc/sysdeps/linux/hppa/Makefile.arch
+++ b/libc/sysdeps/linux/hppa/Makefile.arch
@@ -5,7 +5,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := __syscall_error.c brk.c mmap.c syscall.c
+CSRC := __syscall_error.c brk.c syscall.c
SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S \
add_n.s lshift.s rshift.s sub_n.s udiv_qrnnd.s
diff --git a/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h b/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h
index 722447da2..18cd732a4 100644
--- a/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h
@@ -9,7 +9,7 @@
#define __UCLIBC_ABORT_INSTRUCTION__ "iitlbp %r0,(%sr0,%r0)"
/* can your target use syscall6() for mmap ? */
-#undef __UCLIBC_MMAP_HAS_6_ARGS__
+#define __UCLIBC_MMAP_HAS_6_ARGS__
/* does your target use syscall4() for truncate64 ? (32bit arches only) */
#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
diff --git a/libc/sysdeps/linux/hppa/mmap.c b/libc/sysdeps/linux/hppa/mmap.c
deleted file mode 100644
index bb1352f9e..000000000
--- a/libc/sysdeps/linux/hppa/mmap.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * mmap() for uClibc/x86_64
- *
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- * Copyright (C) 2005 by Mike Frysinger <vapier@gentoo.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-
-
-_syscall6(void *, mmap, void *, start, size_t, length, int, prot,
- int, flags, int, fd, off_t, offset)
-libc_hidden_def(mmap)
diff --git a/libc/sysdeps/linux/microblaze/Makefile.arch b/libc/sysdeps/linux/microblaze/Makefile.arch
index c80c65085..0a19f5e72 100644
--- a/libc/sysdeps/linux/microblaze/Makefile.arch
+++ b/libc/sysdeps/linux/microblaze/Makefile.arch
@@ -5,7 +5,7 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-CSRC := mmap.c clone.c fixdfsi.c
+CSRC := clone.c fixdfsi.c
SSRC := setjmp.S __longjmp.S vfork.S
diff --git a/libc/sysdeps/linux/microblaze/mmap.c b/libc/sysdeps/linux/microblaze/mmap.c
deleted file mode 100644
index 41cf6f45b..000000000
--- a/libc/sysdeps/linux/microblaze/mmap.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Use new style mmap for microblaze */
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-
-
-_syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot,
- int, flags, int, fd, __off_t, offset)
-libc_hidden_def(mmap)
diff --git a/libc/sysdeps/linux/mips/Makefile.arch b/libc/sysdeps/linux/mips/Makefile.arch
index 738cdd0f5..6db0b2a84 100644
--- a/libc/sysdeps/linux/mips/Makefile.arch
+++ b/libc/sysdeps/linux/mips/Makefile.arch
@@ -6,7 +6,7 @@
#
CSRC := \
- __longjmp.c brk.c setjmp_aux.c mmap.c \
+ __longjmp.c brk.c setjmp_aux.c \
cacheflush.c pread_write.c sigaction.c sysmips.c _test_and_set.c \
readahead.c
diff --git a/libc/sysdeps/linux/mips/mmap.c b/libc/sysdeps/linux/mips/mmap.c
deleted file mode 100644
index be96451ef..000000000
--- a/libc/sysdeps/linux/mips/mmap.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Use new style mmap for mips */
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-
-
-#if 0
-/* For now, leave mmap using mmap1 since mmap2 seems
- * to have issues (i.e. it doesn't work 100% properly).
- */
-#ifdef __NR_mmap2
-# undef __NR_mmap
-# define __NR_mmap __NR_mmap2
-#endif
-#endif
-
-_syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot,
- int, flags, int, fd, __off_t, offset)
-libc_hidden_def(mmap)
diff --git a/libc/sysdeps/linux/sh/Makefile.arch b/libc/sysdeps/linux/sh/Makefile.arch
index 6cbc68111..0c7287840 100644
--- a/libc/sysdeps/linux/sh/Makefile.arch
+++ b/libc/sysdeps/linux/sh/Makefile.arch
@@ -7,6 +7,6 @@
#
CSRC := \
- mmap.c pipe.c __init_brk.c brk.c sbrk.c pread_write.c cacheflush.c
+ pipe.c __init_brk.c brk.c sbrk.c pread_write.c cacheflush.c
SSRC := setjmp.S __longjmp.S ___fpscr_values.S vfork.S clone.S
diff --git a/libc/sysdeps/linux/sh/mmap.c b/libc/sysdeps/linux/sh/mmap.c
deleted file mode 100644
index b14181cb2..000000000
--- a/libc/sysdeps/linux/sh/mmap.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2001 Hewlett-Packard
-
- This program is free software; you can redistribute it and/or modify it under
- the terms of the GNU Library General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
- details.
-
- You should have received a copy of the GNU Library General Public License
- along with this program; if not, write to the Free Software Foundation, Inc.,
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Derived in part from the Linux-8086 C library, the GNU C Library, and several
- other sundry sources. Files within this library are copyright by their
- respective copyright holders.
-*/
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/mman.h>
-
-
-#ifdef HIOS
-# define __SH_SYSCALL6_TRAPA 0x2E
-#endif
-
-#include <sys/syscall.h>
-
-_syscall6(__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset)
-libc_hidden_def(mmap)
diff --git a/libc/sysdeps/linux/v850/Makefile b/libc/sysdeps/linux/v850/Makefile
index 60dc97c1d..e54e18c49 100644
--- a/libc/sysdeps/linux/v850/Makefile
+++ b/libc/sysdeps/linux/v850/Makefile
@@ -20,7 +20,7 @@ CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
SSRC := setjmp.S __longjmp.S vfork.S
SOBJ := $(patsubst %.S,%.o, $(SSRC))
-CSRC := mmap.c syscall.c clone.c
+CSRC := syscall.c clone.c
COBJ := $(patsubst %.c,%.o, $(CSRC))
OBJS := $(SOBJ) $(COBJ)
diff --git a/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h b/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h
index 2a9422e23..4bab5476d 100644
--- a/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h
@@ -10,7 +10,7 @@
#undef __UCLIBC_ABORT_INSTRUCTION__
/* can your target use syscall6() for mmap ? */
-#undef __UCLIBC_MMAP_HAS_6_ARGS__
+#define __UCLIBC_MMAP_HAS_6_ARGS__
/* does your target use syscall4() for truncate64 ? (32bit arches only) */
#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
diff --git a/libc/sysdeps/linux/v850/mmap.c b/libc/sysdeps/linux/v850/mmap.c
deleted file mode 100644
index 7fb3f22a4..000000000
--- a/libc/sysdeps/linux/v850/mmap.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Use new style mmap for v850 */
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-
-
-_syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot,
- int, flags, int, fd, __off_t, offset)
-libc_hidden_def(mmap)
diff --git a/libc/sysdeps/linux/vax/Makefile.arch b/libc/sysdeps/linux/vax/Makefile.arch
index 027c65f90..4f805a8b3 100644
--- a/libc/sysdeps/linux/vax/Makefile.arch
+++ b/libc/sysdeps/linux/vax/Makefile.arch
@@ -6,5 +6,5 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := brk.c mmap.c
+CSRC := brk.c
SSRC := __longjmp.S setjmp.S _setjmp.S clone.S
diff --git a/libc/sysdeps/linux/vax/mmap.c b/libc/sysdeps/linux/vax/mmap.c
deleted file mode 100644
index 2bc347f4d..000000000
--- a/libc/sysdeps/linux/vax/mmap.c
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#include <unistd.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <sys/syscall.h>
-
-_syscall6 (void *, mmap, void *, start, size_t, length, int, prot, int, flags,
- int, fd, off_t, offset)
-libc_hidden_def(mmap)
-
diff --git a/libc/sysdeps/linux/x86_64/Makefile.arch b/libc/sysdeps/linux/x86_64/Makefile.arch
index 3243d8676..7491d92b2 100644
--- a/libc/sysdeps/linux/x86_64/Makefile.arch
+++ b/libc/sysdeps/linux/x86_64/Makefile.arch
@@ -5,7 +5,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := brk.c __syscall_error.c sigaction.c mmap.c
+CSRC := brk.c __syscall_error.c sigaction.c
SSRC := \
__longjmp.S setjmp.S syscall.S bsd-setjmp.S bsd-_setjmp.S
diff --git a/libc/sysdeps/linux/x86_64/mmap.c b/libc/sysdeps/linux/x86_64/mmap.c
deleted file mode 100644
index bb1352f9e..000000000
--- a/libc/sysdeps/linux/x86_64/mmap.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * mmap() for uClibc/x86_64
- *
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- * Copyright (C) 2005 by Mike Frysinger <vapier@gentoo.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-
-
-_syscall6(void *, mmap, void *, start, size_t, length, int, prot,
- int, flags, int, fd, off_t, offset)
-libc_hidden_def(mmap)