libc: Document functions in sys/mman.h

This commit is contained in:
apio 2022-10-12 12:06:45 +02:00
parent a3362429d3
commit 1e16a78106
2 changed files with 9 additions and 2 deletions

View File

@ -7,6 +7,8 @@
#include "memory/VMM.h" #include "memory/VMM.h"
#include <stddef.h> #include <stddef.h>
// FIXME: Round size up instead of down. (use get_blocks_from_size)
#define MAP_FAIL(errno) 0xffffffffffffff00 | (unsigned char)(errno) #define MAP_FAIL(errno) 0xffffffffffffff00 | (unsigned char)(errno)
void sys_mmap(Context* context, void* address, size_t size, int flags) void sys_mmap(Context* context, void* address, size_t size, int flags)

View File

@ -5,6 +5,7 @@
typedef unsigned long off_t; typedef unsigned long off_t;
/* Address returned by mmap when it fails. */
#define MAP_FAILED (void*)-1 #define MAP_FAILED (void*)-1
#define PROT_READ_WRITE 1 #define PROT_READ_WRITE 1
@ -16,8 +17,12 @@ extern "C"
{ {
#endif #endif
void* mmap(void*, size_t, int, int, int, off_t); /* Maps size bytes of memory (rounded down to the nearest page-aligned size) into the current process's address
int munmap(void* addr, size_t len); * space at addr. If addr is null, the kernel will choose an address. */
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset);
/* Unmaps size bytes of memory (rounded down to the nearest page-aligned size) at addr from the current process's
* address space. */
int munmap(void* addr, size_t size);
#ifdef __cplusplus #ifdef __cplusplus
} }