mmap #8

Merged
mathieu merged 22 commits from mmap into master 2024-02-11 15:29:59 +01:00
Showing only changes of commit ccfafe4a04 - Show all commits

View File

@ -56,11 +56,13 @@ int func_alloc()
return 0;
}
int func_mmap()
{
int func_mmap() {
char *path = "/dev/zero";
mmap(0, 4096, 0, 0, path);
void *mapAddr = mmap((void *)4096, 4096, PROT_READ | PROT_WRITE, 0, path);
printf("Zero mmaped at %p\n", mapAddr);
int data = *(int *)mapAddr;
*(int *)mapAddr = data;
return 0;
}