1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 02:38:13 +00:00

Add simplified mmap() and munmap() syscalls.

This commit is contained in:
Andreas Kling 2018-10-24 09:48:24 +02:00
parent a5caf7ca99
commit 9a296d63f3
13 changed files with 116 additions and 2 deletions

21
Userland/ls.cpp Normal file
View file

@ -0,0 +1,21 @@
#include <LibC/stdio.h>
#include <LibC/unistd.h>
#include <LibC/mman.h>
int main(int c, char** v)
{
int fd = open("/");
if (fd == -1) {
printf("failed to open / :(\n");
return 1;
}
byte* memory = (byte*)mmap(nullptr, 16384);
printf("%p\n", memory);
memory[0] = 'H';
memory[1] = 'i';
memory[2] = '!';
memory[3] = '\0';
printf("%p : %s\n", memory, memory);
return 0;
}