| 1 | /* sys/mman.h: Memory management declarations.
|
|---|
| 2 | */
|
|---|
| 3 |
|
|---|
| 4 | #ifndef _SYSMMAN_
|
|---|
| 5 | #define _SYSMMAN_
|
|---|
| 6 |
|
|---|
| 7 | /* Types */
|
|---|
| 8 | typedef int mode_t;
|
|---|
| 9 | typedef long off_t;
|
|---|
| 10 | typedef unsigned long int size_t;
|
|---|
| 11 | typedef struct posix_typed_mem_info posix_typed_mem_info;
|
|---|
| 12 |
|
|---|
| 13 | /* Macros */
|
|---|
| 14 | #define PROT_READ 0x04 /* pages can be read */
|
|---|
| 15 | #define PROT_WRITE 0x02 /* pages can be written */
|
|---|
| 16 | #define PROT_EXEC 0x01 /* pages can be executed */
|
|---|
| 17 | #define PROT_NONE 0x00 /* page cannot be accessed */
|
|---|
| 18 |
|
|---|
| 19 | #define MAP_FIXED 0x0100 /* map addr must be exactly as requested */
|
|---|
| 20 | #define MAP_PRIVATE 0x0000 /* changes are private */
|
|---|
| 21 | #define MAP_SHARED 0x0010 /* share changes */
|
|---|
| 22 | #define MS_ASYNC 0x0800 /* perform asynchronous writes. */
|
|---|
| 23 | #define MS_INVALIDATE 0x0200 /* invalidate mappings. */
|
|---|
| 24 | #define MS_SYNC 0x0400 /* perform synchronous writes. */
|
|---|
| 25 |
|
|---|
| 26 | #define MCL_CURRENT 0x0001 /* lock currently mapped pages. */
|
|---|
| 27 | #define MCL_FUTURE 0x0020 /* lock pages that become mapped. */
|
|---|
| 28 |
|
|---|
| 29 | #define POSIX_MADV_NORMAL 0 /* no further special treatment */
|
|---|
| 30 | #define POSIX_MADV_RANDOM 1 /* expect random page refs */
|
|---|
| 31 | #define POSIX_MADV_SEQUENTIAL 2 /* expect sequential page refs */
|
|---|
| 32 | #define POSIX_MADV_WILLNEED 3 /* will need these pages */
|
|---|
| 33 | #define POSIX_MADV_DONTNEED 4 /* dont need these pages */
|
|---|
| 34 |
|
|---|
| 35 | #define POSIX_TYPED_MEM_ALLOCATE 5 /* allocate on mmap(). */
|
|---|
| 36 | #define POSIX_TYPED_MEM_ALLOCATE_CONTIG 6 /* allocate contiguously on mmap()*/
|
|---|
| 37 | #define POSIX_TYPED_MEM_MAP_ALLOCATABLE 7 /* map on mmap(), without affecting allocatability.*/
|
|---|
| 38 |
|
|---|
| 39 | /* Functions */
|
|---|
| 40 | int mlock(const void *, size_t);
|
|---|
| 41 | int mlockall(int);
|
|---|
| 42 | void *mmap(void *, size_t, int, int, int, off_t);
|
|---|
| 43 | int mprotect(void *, size_t, int);
|
|---|
| 44 | int msync(void *, size_t, int);
|
|---|
| 45 | int munlock(const void *, size_t);
|
|---|
| 46 | int munlockall(void);
|
|---|
| 47 | int munmap(void *, size_t);
|
|---|
| 48 | int posix_madvise(void *, size_t, int);
|
|---|
| 49 | int posix_mem_offset(const void *restrict, size_t, off_t *restrict,
|
|---|
| 50 | size_t *restrict, int *restrict);
|
|---|
| 51 | int posix_typed_mem_get_info(int, struct posix_typed_mem_info *);
|
|---|
| 52 | int posix_typed_mem_open(const char *, int, int);
|
|---|
| 53 | int shm_open(const char *, int, mode_t);
|
|---|
| 54 | int shm_unlink(const char *);
|
|---|
| 55 |
|
|---|
| 56 | #endif
|
|---|