#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
Go to the source code of this file.
◆ omVallocMmap()
static void * omVallocMmap |
( |
size_t |
size | ) |
|
|
inlinestatic |
Definition at line 15 of file omMmap.c.
16{
17 void* addr;
18#ifndef MAP_ANONYMOUS
20#endif
21
22#ifdef MAP_ANONYMOUS
23#ifndef __CYGWIN__
24
25 addr = mmap(0,
size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
26#else
27
28 addr = mmap(0,
size, PROT_READ|PROT_WRITE, MAP_PRIVATE, -1, 0);
29#endif
30#else
32 {
33 fd =
open(
"/dev/zero", O_RDWR);
35 }
36 addr = mmap(0,
size, PROT_READ|PROT_WRITE, MAP_PRIVATE,
fd, 0);
37#endif
38
39 if (addr == (
void*) -1)
return NULL;
40 return addr;
41}
int status int void size_t count int const void size_t count open
◆ omVfreeMmap()
static int omVfreeMmap |
( |
void * |
addr, |
|
|
size_t |
size |
|
) |
| |
|
inlinestatic |
Definition at line 43 of file omMmap.c.
44{
45 return munmap(addr,
size);
46}