2 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 /* Massivly hacked up for uClibc by Erik Andersen */
10 #ifdef __UCLIBC_HAS_LFS__
15 #include <sys/syscall.h>
16 #include <bits/uClibc_page.h>
18 libc_hidden_proto(mmap)
20 # if !defined __NR_mmap2 || !defined _syscall6
23 * This version is a stub that just chops off everything at the mmap 32 bit
24 * mmap() address space... You will probably need to add in an arch specific
25 * implementation to override this as there is not a generic way for me to
26 * implement this particular syscall if your arch lacks _syscall6...
30 __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
32 if (offset != (off_t) offset ||
33 (offset + len) != (off_t) (offset + len)) {
38 return mmap(addr, len, prot, flags, fd, (off_t) offset);
43 # define __NR___syscall_mmap2 __NR_mmap2
44 static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len,
45 int, prot, int, flags, int, fd, off_t, offset);
47 /* Some architectures always use 12 as page shift for mmap2() eventhough the
48 * real PAGE_SHIFT != 12. Other architectures use the same value as
51 # ifndef MMAP2_PAGE_SHIFT
52 # define MMAP2_PAGE_SHIFT 12
55 __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
57 if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
62 return __syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT));
66 #endif /* __UCLIBC_HAS_LFS__ */