mman.h 2.6 KB

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