mmap.c 726 B

123456789101112131415161718192021222324252627282930
  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. _syscall1(__ptr_t, _mmap, unsigned long *, buffer);
  15. __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. #endif