Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
MMAP.cpp
Go to the documentation of this file.
1// checking for mmap() and munmap() in <sys/mman.h>
2
3
25#include <sys/mman.h>
26#include <sys/types.h>
27
28
29void* map_file (int fd)
30{
31 return mmap (0, 4096, PROT_READ, MAP_PRIVATE, fd, 0);
32}
33
34
35int main (int argc, char *argv[])
36{
37 // avoid executing the code except when one or more command
38 // line arguments have been specified
39 if (argc < 2)
40 return 0;
41
42 void *p = map_file (argc);
43 munmap (p, 0);
44
45 return 0;
46}
#define p
Definition 17.names.cpp:132
#define main
void * map_file(int fd)
Definition MMAP.cpp:29
#define MAP_PRIVATE
Definition alloc.cpp:166