| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 |  | 
 | 2 | /* The mmap test is useful, since syscalls with 6 arguments | 
 | 3 |  * (as mmap) are done differently on various architectures. | 
 | 4 |  */ | 
 | 5 |  | 
 | 6 | #include <stdio.h> | 
 | 7 | #include <stdlib.h> | 
 | 8 | #include <unistd.h> | 
 | 9 | #include <sys/mman.h> | 
 | 10 | #include <features.h> | 
 | 11 |  | 
 | 12 | int main(int argc, char **argv) | 
 | 13 | { | 
 | 14 | #ifdef __UCLIBC_HAS_LFS__ | 
 | 15 | 	void *ptr; | 
 | 16 |  | 
 | 17 | 	ptr = mmap64(NULL, 4096, PROT_READ|PROT_WRITE, | 
 | 18 | 		MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); | 
 | 19 |  | 
 | 20 | 	if (ptr == MAP_FAILED) { | 
 | 21 | 		perror("mmap"); | 
 | 22 | 		exit(1); | 
 | 23 | 	} | 
 | 24 | 	printf("mmap returned %p\n", ptr); | 
 | 25 | 	exit(0); | 
 | 26 | #else | 
 | 27 | 	exit(0); | 
 | 28 | #endif | 
 | 29 | } |