mmap.c 785 B

12345678910111213141516171819202122232425262728293031
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * _mmap() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #include <unistd.h>
  11. #include <sys/mman.h>
  12. #ifdef __NR_mmap
  13. #define __NR__mmap __NR_mmap
  14. static inline _syscall1(__ptr_t, _mmap, unsigned long *, buffer);
  15. attribute_hidden __ptr_t __mmap(__ptr_t addr, size_t len, int prot,
  16. int flags, int fd, __off_t offset)
  17. {
  18. unsigned long buffer[6];
  19. buffer[0] = (unsigned long) addr;
  20. buffer[1] = (unsigned long) len;
  21. buffer[2] = (unsigned long) prot;
  22. buffer[3] = (unsigned long) flags;
  23. buffer[4] = (unsigned long) fd;
  24. buffer[5] = (unsigned long) offset;
  25. return (__ptr_t) _mmap(buffer);
  26. }
  27. strong_alias(__mmap,mmap)
  28. #endif