POSIX Mapped Files option group.
More...
|
| #define | PROT_NONE 0x0 |
| | Pages may not be accessed.
|
| |
| #define | PROT_READ 0x1 |
| | Pages may be read.
|
| |
| #define | PROT_WRITE 0x2 |
| | Pages may be written.
|
| |
| #define | PROT_EXEC 0x4 |
| | Pages may be executed.
|
| |
| #define | MAP_SHARED 0x1 |
| | Changes are shared between all mappings of the same object.
|
| |
| #define | MAP_PRIVATE 0x2 |
| | Changes are private (copy-on-write).
|
| |
| #define | MAP_FIXED 0x4 |
| | Map at the exact address given in addr.
|
| |
| #define | MAP_ANONYMOUS 0x20 |
| | Anonymous mapping; fd argument is ignored.
|
| |
| #define | MS_SYNC 0x0 |
| | Flush modified pages to the underlying file synchronously.
|
| |
| #define | MS_ASYNC 0x1 |
| | Schedule writes; return immediately.
|
| |
| #define | MS_INVALIDATE 0x2 |
| | Invalidate cached data so subsequent reads reflect the file.
|
| |
| #define | MAP_FAILED ((void *)-1) |
| | Value returned by mmap() on failure.
|
| |
|
| void * | mmap (void *addr, size_t len, int prot, int flags, int fildes, off_t off) |
| | Map a file or device into memory.
|
| |
| int | msync (void *addr, size_t length, int flags) |
| | Synchronise a memory mapping with the underlying storage.
|
| |
| int | munmap (void *addr, size_t len) |
| | Unmap a previously mapped region.
|
| |
POSIX Mapped Files option group.
◆ MAP_ANONYMOUS
| #define MAP_ANONYMOUS 0x20 |
Anonymous mapping; fd argument is ignored.
Definition at line 41 of file mman.h.
◆ MAP_FAILED
| #define MAP_FAILED ((void *)-1) |
Value returned by mmap() on failure.
Definition at line 51 of file mman.h.
◆ MAP_FIXED
Map at the exact address given in addr.
Definition at line 38 of file mman.h.
◆ MAP_PRIVATE
Changes are private (copy-on-write).
Definition at line 36 of file mman.h.
◆ MAP_SHARED
Changes are shared between all mappings of the same object.
Definition at line 34 of file mman.h.
◆ MS_ASYNC
Schedule writes; return immediately.
Definition at line 46 of file mman.h.
◆ MS_INVALIDATE
| #define MS_INVALIDATE 0x2 |
Invalidate cached data so subsequent reads reflect the file.
Definition at line 48 of file mman.h.
◆ MS_SYNC
Flush modified pages to the underlying file synchronously.
Definition at line 44 of file mman.h.
◆ PROT_EXEC
Pages may be executed.
Definition at line 31 of file mman.h.
◆ PROT_NONE
Pages may not be accessed.
Definition at line 25 of file mman.h.
◆ PROT_READ
Pages may be read.
Definition at line 27 of file mman.h.
◆ PROT_WRITE
Pages may be written.
Definition at line 29 of file mman.h.
◆ mmap()
| void * mmap |
( |
void * |
addr, |
|
|
size_t |
len, |
|
|
int |
prot, |
|
|
int |
flags, |
|
|
int |
fildes, |
|
|
off_t |
off |
|
) |
| |
Map a file or device into memory.
- Parameters
-
| addr | Suggested address (hint), or NULL. |
| len | Length of the mapping in bytes. |
| prot | Memory protection (PROT_* flags). |
| flags | Mapping type and options (MAP_* flags). |
| fildes | File descriptor (-1 for anonymous mappings). |
| off | Offset within the file (must be page-aligned). |
- Returns
- Base address of the mapping, or MAP_FAILED on failure.
- See also
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
◆ msync()
| int msync |
( |
void * |
addr, |
|
|
size_t |
length, |
|
|
int |
flags |
|
) |
| |
◆ munmap()
| int munmap |
( |
void * |
addr, |
|
|
size_t |
len |
|
) |
| |