mmap.c 701 B

12345678910111213141516171819202122232425262728
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * _mmap() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.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. #define __NR__mmap __NR_mmap
  13. _syscall1(__ptr_t, _mmap, unsigned long *, buffer);
  14. __ptr_t mmap(__ptr_t addr, size_t len, int prot,
  15. int flags, int fd, __off_t offset)
  16. {
  17. unsigned long buffer[6];
  18. buffer[0] = (unsigned long) addr;
  19. buffer[1] = (unsigned long) len;
  20. buffer[2] = (unsigned long) prot;
  21. buffer[3] = (unsigned long) flags;
  22. buffer[4] = (unsigned long) fd;
  23. buffer[5] = (unsigned long) offset;
  24. return (__ptr_t) _mmap(buffer);
  25. }