mmap.c 569 B

123456789101112131415161718192021222324
  1. /* Use new style mmap for bfin */
  2. #include <unistd.h>
  3. #include <errno.h>
  4. #include <sys/mman.h>
  5. #include <sys/syscall.h>
  6. #include <asm/page.h>
  7. #define __NR___syscall_mmap2 __NR_mmap2
  8. inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
  9. size_t, len, int, prot, int, flags, int, fd, off_t, offset);
  10. libc_hidden_proto(mmap)
  11. __ptr_t mmap(__ptr_t addr, size_t len, int prot,
  12. int flags, int fd, __off_t offset)
  13. {
  14. if (offset & ~PAGE_MASK) {
  15. return NULL;
  16. }
  17. return __syscall_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
  18. }
  19. libc_hidden_def(mmap)