mmap64.c 488 B

12345678910111213141516171819202122232425262728
  1. /* The mmap test is useful, since syscalls with 6 arguments
  2. * (as mmap) are done differently on various architectures.
  3. */
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <unistd.h>
  7. #include <sys/mman.h>
  8. int main(int argc, char **argv)
  9. {
  10. #ifdef __NR_mmap64
  11. void *ptr;
  12. ptr = mmap64(NULL, 4096, PROT_READ|PROT_WRITE,
  13. MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
  14. if (ptr == MAP_FAILED) {
  15. perror("mmap");
  16. exit(1);
  17. }
  18. printf("mmap returned %p\n", ptr);
  19. exit(0);
  20. #else
  21. exit(0);
  22. #endif
  23. }