93c76582a5dfc77057e41c4b022098d5fc6c1067
[musl] / src / mman / mmap.c
1 #include <unistd.h>
2 #include <sys/mman.h>
3 #include <errno.h>
4 #include <limits.h>
5 #include "syscall.h"
6 #include "libc.h"
7
8 void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
9 {
10         if (sizeof(off_t) > sizeof(long))
11                 if (((long)off & 0xfff) | ((long)((unsigned long long)off>>(12 + 8*(sizeof(off_t)-sizeof(long))))))
12                         start = (void *)-1;
13         return (void *)syscall6(__NR_mmap2, (long)start, len, prot, flags, fd, off>>12);
14 }
15
16 weak_alias(__mmap, mmap);
17
18 LFS64(mmap);