[352] | 1 | #ifndef _SYS_MMAN_H
|
---|
| 2 | #define _SYS_MMAN_H
|
---|
| 3 | #ifdef __cplusplus
|
---|
| 4 | extern "C" {
|
---|
| 5 | #endif
|
---|
| 6 |
|
---|
| 7 | #include <features.h>
|
---|
| 8 |
|
---|
| 9 | #define __NEED_mode_t
|
---|
| 10 | #define __NEED_size_t
|
---|
| 11 | #define __NEED_off_t
|
---|
| 12 |
|
---|
| 13 | #if defined(_GNU_SOURCE)
|
---|
| 14 | #define __NEED_ssize_t
|
---|
| 15 | #endif
|
---|
| 16 |
|
---|
| 17 | #include <bits/alltypes.h>
|
---|
| 18 |
|
---|
| 19 | #define MAP_FAILED ((void *) -1)
|
---|
| 20 |
|
---|
| 21 | #define MAP_SHARED 0x01
|
---|
| 22 | #define MAP_PRIVATE 0x02
|
---|
| 23 | #define MAP_TYPE 0x0f
|
---|
| 24 | #define MAP_FIXED 0x10
|
---|
| 25 | #define MAP_ANON 0x20
|
---|
| 26 | #define MAP_ANONYMOUS MAP_ANON
|
---|
| 27 | #define MAP_NORESERVE 0x4000
|
---|
| 28 | #define MAP_GROWSDOWN 0x0100
|
---|
| 29 | #define MAP_DENYWRITE 0x0800
|
---|
| 30 | #define MAP_EXECUTABLE 0x1000
|
---|
| 31 | #define MAP_LOCKED 0x2000
|
---|
| 32 | #define MAP_POPULATE 0x8000
|
---|
| 33 | #define MAP_NONBLOCK 0x10000
|
---|
| 34 | #define MAP_STACK 0x20000
|
---|
| 35 | #define MAP_HUGETLB 0x40000
|
---|
| 36 | #define MAP_FILE 0
|
---|
| 37 |
|
---|
| 38 | #define PROT_NONE 0
|
---|
| 39 | #define PROT_READ 1
|
---|
| 40 | #define PROT_WRITE 2
|
---|
| 41 | #define PROT_EXEC 4
|
---|
| 42 | #define PROT_GROWSDOWN 0x01000000
|
---|
| 43 | #define PROT_GROWSUP 0x02000000
|
---|
| 44 |
|
---|
| 45 | #define MS_ASYNC 1
|
---|
| 46 | #define MS_INVALIDATE 2
|
---|
| 47 | #define MS_SYNC 4
|
---|
| 48 |
|
---|
| 49 | #define MCL_CURRENT 1
|
---|
| 50 | #define MCL_FUTURE 2
|
---|
| 51 | #define MCL_ONFAULT 4
|
---|
| 52 |
|
---|
| 53 | #define POSIX_MADV_NORMAL 0
|
---|
| 54 | #define POSIX_MADV_RANDOM 1
|
---|
| 55 | #define POSIX_MADV_SEQUENTIAL 2
|
---|
| 56 | #define POSIX_MADV_WILLNEED 3
|
---|
| 57 | #define POSIX_MADV_DONTNEED 4
|
---|
| 58 |
|
---|
| 59 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
---|
| 60 | #define MADV_NORMAL 0
|
---|
| 61 | #define MADV_RANDOM 1
|
---|
| 62 | #define MADV_SEQUENTIAL 2
|
---|
| 63 | #define MADV_WILLNEED 3
|
---|
| 64 | #define MADV_DONTNEED 4
|
---|
| 65 | #define MADV_FREE 8
|
---|
| 66 | #define MADV_REMOVE 9
|
---|
| 67 | #define MADV_DONTFORK 10
|
---|
| 68 | #define MADV_DOFORK 11
|
---|
| 69 | #define MADV_MERGEABLE 12
|
---|
| 70 | #define MADV_UNMERGEABLE 13
|
---|
| 71 | #define MADV_HUGEPAGE 14
|
---|
| 72 | #define MADV_NOHUGEPAGE 15
|
---|
| 73 | #define MADV_DONTDUMP 16
|
---|
| 74 | #define MADV_DODUMP 17
|
---|
| 75 | #define MADV_HWPOISON 100
|
---|
| 76 | #define MADV_SOFT_OFFLINE 101
|
---|
| 77 | #endif
|
---|
| 78 |
|
---|
| 79 | #include <bits/mman.h>
|
---|
| 80 |
|
---|
| 81 | void *mmap (void *, size_t, int, int, int, off_t);
|
---|
| 82 | int munmap (void *, size_t);
|
---|
| 83 |
|
---|
| 84 | int mprotect (void *, size_t, int);
|
---|
| 85 | int msync (void *, size_t, int);
|
---|
| 86 |
|
---|
| 87 | int posix_madvise (void *, size_t, int);
|
---|
| 88 |
|
---|
| 89 | int mlock (const void *, size_t);
|
---|
| 90 | int munlock (const void *, size_t);
|
---|
| 91 | int mlockall (int);
|
---|
| 92 | int munlockall (void);
|
---|
| 93 |
|
---|
| 94 | #ifdef _GNU_SOURCE
|
---|
| 95 | #define MREMAP_MAYMOVE 1
|
---|
| 96 | #define MREMAP_FIXED 2
|
---|
| 97 | void *mremap (void *, size_t, size_t, int, ...);
|
---|
| 98 | int remap_file_pages (void *, size_t, int, size_t, int);
|
---|
| 99 | #endif
|
---|
| 100 |
|
---|
| 101 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
---|
| 102 | #define MLOCK_ONFAULT 0x01
|
---|
| 103 | int madvise (void *, size_t, int);
|
---|
| 104 | int mincore (void *, size_t, unsigned char *);
|
---|
| 105 | #endif
|
---|
| 106 |
|
---|
| 107 | int shm_open (const char *, int, mode_t);
|
---|
| 108 | int shm_unlink (const char *);
|
---|
| 109 |
|
---|
| 110 | #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
---|
| 111 | #define mmap64 mmap
|
---|
| 112 | #define off64_t off_t
|
---|
| 113 | #endif
|
---|
| 114 |
|
---|
| 115 | #ifdef __cplusplus
|
---|
| 116 | }
|
---|
| 117 | #endif
|
---|
| 118 | #endif
|
---|