Ian Maxon | a70fba5 | 2016-02-18 13:52:36 -0800 | [diff] [blame] | 1 | #include <stdio.h> |
2 | #include <sys/mman.h> | ||||
3 | #include <unistd.h> | ||||
4 | #include <stdint.h> | ||||
5 | |||||
6 | int main() { | ||||
7 | |||||
8 | void *mem; | ||||
9 | int err; | ||||
10 | uint64_t size = 4.5 * 1024 * 1024; | ||||
11 | size *= 1024; | ||||
12 | |||||
13 | mem = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); | ||||
14 | printf ("%d\n", mem); | ||||
15 | err = mlock(mem, size); | ||||
16 | printf ("err is %d\n", err); | ||||
17 | while(1) { | ||||
18 | sleep(10000); | ||||
19 | } | ||||
20 | return 0; | ||||
21 | } | ||||
22 |