The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
mman.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * @file mman.h
5 * @brief mmap protection and flag constants (kernel side).
6 *
7 * these values are ABI: they must match the libc mirror in
8 * src/libc/include/sys/mman.h exactly, since userspace passes them across the
9 * SYS_mmap boundary. kept small and POSIX-shaped.
10 */
11
12// protection bits (prot argument). combine with bitwise OR.
13#define PROT_NONE 0x0 // pages may not be accessed
14#define PROT_READ 0x1 // pages may be read
15#define PROT_WRITE 0x2 // pages may be written
16#define PROT_EXEC 0x4 // pages may be executed
17
18// mapping flags (flags argument).
19#define MAP_SHARED 0x01 // changes are shared (device/shared memory)
20#define MAP_PRIVATE 0x02 // changes are private to the process
21#define MAP_ANONYMOUS 0x04 // not backed by a file; zero-filled (fd ignored)
22#define MAP_FIXED 0x10 // place the mapping exactly at addr, replacing what is there
23
24// mmap failure return value (a userspace pointer sentinel).
25#define MAP_FAILED ((void *)-1)