mmap64.c 871 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * mmap64() for MIPS uClibc
  3. *
  4. * Copyright (C) 2026 Ramin Moussavi <ramin.moussavi@yacoub.de>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <_lfs_64.h>
  9. #include <sys/syscall.h>
  10. #include <sgidefs.h>
  11. #if _MIPS_SIM == _MIPS_SIM_NABI32 && defined __NR_mmap
  12. # include <errno.h>
  13. # include <sys/mman.h>
  14. /* n32 has no mmap2 and a 32-bit off_t, so the generic mmap64() (which either
  15. * needs mmap2 or truncates the offset to off_t and rejects anything that does
  16. * not fit) cannot express a >2GB offset. But the n32 mmap syscall takes a
  17. * full 64-bit byte offset, so pass it straight through. */
  18. void *mmap64(void *addr, size_t len, int prot, int flags, int fd,
  19. __off64_t offset)
  20. {
  21. return (void *) INLINE_SYSCALL(mmap, 6, addr, len, prot, flags, fd,
  22. offset);
  23. }
  24. #else
  25. # include "../common/mmap64.c"
  26. #endif