userspace: mmap test read and write
This commit is contained in:
parent
16624a0cfd
commit
91b8d48f52
@ -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);
|
||||
char *path = "/dev/zero";
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user