cleaning up syscalls in preparation for x86_64 port
[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 #ifdef __NR_mmap2
14         return (void *)syscall6(__NR_mmap2, (long)start, len, prot, flags, fd, off>>12);
15 #else
16         return (void *)syscall6(__NR_mmap, (long)start, len, prot, flags, fd, off);
17 #endif
18 }
19
20 weak_alias(__mmap, mmap);
21
22 LFS64(mmap);