root@ubuntu:/home/code/test_virtual# more ./test_mmap.c
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
int main()
{
char *data = NULL;
int fd=open("./test.python",O_RDONLY);
long size = lseek(fd, 0, SEEK_END);
data = (char *) mmap( NULL, size ,PROT_READ, MAP_PRIVATE, fd, 0 );
printf("data=%s\r\n", data);
munmap(data, size);
return 0;
}
root@ubuntu:/home/code/test_virtual# gcc -o test_mmap test_mmap.c
root@ubuntu:/home/code/test_virtual# ./test_mmap
data=print 2+3