libc_musl.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. #define FUTEX_WAITERS 0x80000000
  26. #define FUTEX_OWNER_DIED 0x40000000
  27. #define FUTEX_TID_MASK 0x3fffffff
  28. struct robust_list
  29. {
  30. struct robust_list *next;
  31. };
  32. struct robust_list_head
  33. {
  34. struct robust_list list;
  35. long futex_offset;
  36. struct robust_list *list_op_pending;
  37. };
  38. /* for pmutex op */
  39. #define PMUTEX_INIT 0
  40. #define PMUTEX_LOCK 1
  41. #define PMUTEX_UNLOCK 2
  42. #define PMUTEX_DESTROY 3
  43. /* for sys/mman.h */
  44. #define MAP_SHARED 0x01
  45. #define MAP_PRIVATE 0x02
  46. #define MAP_SHARED_VALIDATE 0x03
  47. #define MAP_TYPE 0x0f
  48. #define MAP_FIXED 0x10
  49. #define MAP_ANON 0x20
  50. #define MAP_ANONYMOUS MAP_ANON
  51. #define MAP_NORESERVE 0x4000
  52. #define MAP_GROWSDOWN 0x0100
  53. #define MAP_DENYWRITE 0x0800
  54. #define MAP_EXECUTABLE 0x1000
  55. #define MAP_LOCKED 0x2000
  56. #define MAP_POPULATE 0x8000
  57. #define MAP_NONBLOCK 0x10000
  58. #define MAP_STACK 0x20000
  59. #define MAP_HUGETLB 0x40000
  60. #define MAP_SYNC 0x80000
  61. #define MAP_FIXED_NOREPLACE 0x100000
  62. #define MAP_FILE 0
  63. #define MAP_UNINITIALIZED 0x4000000
  64. #define MAP_HUGE_SHIFT 26
  65. #define MAP_HUGE_MASK 0x3f
  66. #define MAP_HUGE_16KB (14 << 26)
  67. #define MAP_HUGE_64KB (16 << 26)
  68. #define MAP_HUGE_512KB (19 << 26)
  69. #define MAP_HUGE_1MB (20 << 26)
  70. #define MAP_HUGE_2MB (21 << 26)
  71. #define MAP_HUGE_8MB (23 << 26)
  72. #define MAP_HUGE_16MB (24 << 26)
  73. #define MAP_HUGE_32MB (25 << 26)
  74. #define MAP_HUGE_256MB (28 << 26)
  75. #define MAP_HUGE_512MB (29 << 26)
  76. #define MAP_HUGE_1GB (30 << 26)
  77. #define MAP_HUGE_2GB (31 << 26)
  78. #define MAP_HUGE_16GB (34U << 26)
  79. #define PROT_NONE 0
  80. #define PROT_READ 1
  81. #define PROT_WRITE 2
  82. #define PROT_EXEC 4
  83. #define PROT_GROWSDOWN 0x01000000
  84. #define PROT_GROWSUP 0x02000000
  85. #define MS_ASYNC 1
  86. #define MS_INVALIDATE 2
  87. #define MS_SYNC 4
  88. #define MCL_CURRENT 1
  89. #define MCL_FUTURE 2
  90. #define MCL_ONFAULT 4
  91. #define POSIX_MADV_NORMAL 0
  92. #define POSIX_MADV_RANDOM 1
  93. #define POSIX_MADV_SEQUENTIAL 2
  94. #define POSIX_MADV_WILLNEED 3
  95. #define POSIX_MADV_DONTNEED 4
  96. #define CLONE_VM 0x00000100
  97. #define CLONE_FS 0x00000200
  98. #define CLONE_FILES 0x00000400
  99. #define CLONE_SIGHAND 0x00000800
  100. #define CLONE_PTRACE 0x00002000
  101. #define CLONE_VFORK 0x00004000
  102. #define CLONE_PARENT 0x00008000
  103. #define CLONE_THREAD 0x00010000
  104. #define CLONE_NEWNS 0x00020000
  105. #define CLONE_SYSVSEM 0x00040000
  106. #define CLONE_SETTLS 0x00080000
  107. #define CLONE_PARENT_SETTID 0x00100000
  108. #define CLONE_CHILD_CLEARTID 0x00200000
  109. #define CLONE_DETACHED 0x00400000
  110. #define CLONE_UNTRACED 0x00800000
  111. #define CLONE_CHILD_SETTID 0x01000000
  112. #define CLONE_NEWCGROUP 0x02000000
  113. #define CLONE_NEWUTS 0x04000000
  114. #define CLONE_NEWIPC 0x08000000
  115. #define CLONE_NEWUSER 0x10000000
  116. #define CLONE_NEWPID 0x20000000
  117. #define CLONE_NEWNET 0x40000000
  118. #define CLONE_IO 0x80000000
  119. /* arg[] -> flags
  120. * stack
  121. * new_tid
  122. * tls
  123. * set_clear_tid_address
  124. * quit_func
  125. * start_args
  126. * */
  127. #define SYS_CLONE_ARGS_NR 7
  128. /* wait.h */
  129. /* options */
  130. #define WNOHANG 1
  131. #define WUNTRACED 2
  132. #define WSTOPPED 2
  133. #define WEXITED 4
  134. #define WCONTINUED 8
  135. #define WNOWAIT 0x1000000
  136. #define __WNOTHREAD 0x20000000
  137. #define __WALL 0x40000000
  138. #define __WCLONE 0x80000000
  139. #endif /* __LIBC_MUSL_H__ */