From 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 12 Feb 2011 00:22:29 -0500 Subject: initial check-in, version 0.5.0 --- src/mman/mmap.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/mman/mmap.c (limited to 'src/mman/mmap.c') diff --git a/src/mman/mmap.c b/src/mman/mmap.c new file mode 100644 index 00000000..93c76582 --- /dev/null +++ b/src/mman/mmap.c @@ -0,0 +1,18 @@ +#include +#include +#include +#include +#include "syscall.h" +#include "libc.h" + +void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off) +{ + if (sizeof(off_t) > sizeof(long)) + if (((long)off & 0xfff) | ((long)((unsigned long long)off>>(12 + 8*(sizeof(off_t)-sizeof(long)))))) + start = (void *)-1; + return (void *)syscall6(__NR_mmap2, (long)start, len, prot, flags, fd, off>>12); +} + +weak_alias(__mmap, mmap); + +LFS64(mmap); -- cgit v1.2.1