libc_musl.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-07-11 RT-Thread first version
  9. */
  10. #ifndef __LIBC_MUSL_H__
  11. #define __LIBC_MUSL_H__
  12. /* from internal/futex.h */
  13. #define FUTEX_WAIT 0
  14. #define FUTEX_WAKE 1
  15. #define FUTEX_FD 2
  16. #define FUTEX_REQUEUE 3
  17. #define FUTEX_CMP_REQUEUE 4
  18. #define FUTEX_WAKE_OP 5
  19. #define FUTEX_LOCK_PI 6
  20. #define FUTEX_UNLOCK_PI 7
  21. #define FUTEX_TRYLOCK_PI 8
  22. #define FUTEX_WAIT_BITSET 9
  23. #define FUTEX_PRIVATE 128
  24. #define FUTEX_CLOCK_REALTIME 256
  25. /* for pmutex op */
  26. #define PMUTEX_INIT 0
  27. #define PMUTEX_LOCK 1
  28. #define PMUTEX_UNLOCK 2
  29. #define PMUTEX_DESTROY 3
  30. /* for sys/mman.h */
  31. #define MAP_SHARED 0x01
  32. #define MAP_PRIVATE 0x02
  33. #define MAP_SHARED_VALIDATE 0x03
  34. #define MAP_TYPE 0x0f
  35. #define MAP_FIXED 0x10
  36. #define MAP_ANON 0x20
  37. #define MAP_ANONYMOUS MAP_ANON
  38. #define MAP_NORESERVE 0x4000
  39. #define MAP_GROWSDOWN 0x0100
  40. #define MAP_DENYWRITE 0x0800
  41. #define MAP_EXECUTABLE 0x1000
  42. #define MAP_LOCKED 0x2000
  43. #define MAP_POPULATE 0x8000
  44. #define MAP_NONBLOCK 0x10000
  45. #define MAP_STACK 0x20000
  46. #define MAP_HUGETLB 0x40000
  47. #define MAP_SYNC 0x80000
  48. #define MAP_FIXED_NOREPLACE 0x100000
  49. #define MAP_FILE 0
  50. #define MAP_UNINITIALIZED 0x4000000
  51. #define MAP_HUGE_SHIFT 26
  52. #define MAP_HUGE_MASK 0x3f
  53. #define MAP_HUGE_16KB (14 << 26)
  54. #define MAP_HUGE_64KB (16 << 26)
  55. #define MAP_HUGE_512KB (19 << 26)
  56. #define MAP_HUGE_1MB (20 << 26)
  57. #define MAP_HUGE_2MB (21 << 26)
  58. #define MAP_HUGE_8MB (23 << 26)
  59. #define MAP_HUGE_16MB (24 << 26)
  60. #define MAP_HUGE_32MB (25 << 26)
  61. #define MAP_HUGE_256MB (28 << 26)
  62. #define MAP_HUGE_512MB (29 << 26)
  63. #define MAP_HUGE_1GB (30 << 26)
  64. #define MAP_HUGE_2GB (31 << 26)
  65. #define MAP_HUGE_16GB (34U << 26)
  66. #define PROT_NONE 0
  67. #define PROT_READ 1
  68. #define PROT_WRITE 2
  69. #define PROT_EXEC 4
  70. #define PROT_GROWSDOWN 0x01000000
  71. #define PROT_GROWSUP 0x02000000
  72. #define MS_ASYNC 1
  73. #define MS_INVALIDATE 2
  74. #define MS_SYNC 4
  75. #define MCL_CURRENT 1
  76. #define MCL_FUTURE 2
  77. #define MCL_ONFAULT 4
  78. #define POSIX_MADV_NORMAL 0
  79. #define POSIX_MADV_RANDOM 1
  80. #define POSIX_MADV_SEQUENTIAL 2
  81. #define POSIX_MADV_WILLNEED 3
  82. #define POSIX_MADV_DONTNEED 4
  83. #define CLONE_VM 0x00000100
  84. #define CLONE_FS 0x00000200
  85. #define CLONE_FILES 0x00000400
  86. #define CLONE_SIGHAND 0x00000800
  87. #define CLONE_PTRACE 0x00002000
  88. #define CLONE_VFORK 0x00004000
  89. #define CLONE_PARENT 0x00008000
  90. #define CLONE_THREAD 0x00010000
  91. #define CLONE_NEWNS 0x00020000
  92. #define CLONE_SYSVSEM 0x00040000
  93. #define CLONE_SETTLS 0x00080000
  94. #define CLONE_PARENT_SETTID 0x00100000
  95. #define CLONE_CHILD_CLEARTID 0x00200000
  96. #define CLONE_DETACHED 0x00400000
  97. #define CLONE_UNTRACED 0x00800000
  98. #define CLONE_CHILD_SETTID 0x01000000
  99. #define CLONE_NEWCGROUP 0x02000000
  100. #define CLONE_NEWUTS 0x04000000
  101. #define CLONE_NEWIPC 0x08000000
  102. #define CLONE_NEWUSER 0x10000000
  103. #define CLONE_NEWPID 0x20000000
  104. #define CLONE_NEWNET 0x40000000
  105. #define CLONE_IO 0x80000000
  106. /* arg[] -> flags
  107. * stack
  108. * new_tid
  109. * tls
  110. * set_clear_tid_address
  111. * quit_func
  112. * start_args
  113. * */
  114. #define SYS_CLONE_ARGS_NR 7
  115. /* wait.h */
  116. /* options */
  117. #define WNOHANG 1
  118. #define WUNTRACED 2
  119. #define WSTOPPED 2
  120. #define WEXITED 4
  121. #define WCONTINUED 8
  122. #define WNOWAIT 0x1000000
  123. #define __WNOTHREAD 0x20000000
  124. #define __WALL 0x40000000
  125. #define __WCLONE 0x80000000
  126. #endif /* __LIBC_MUSL_H__ */