libc_musl.h 4.3 KB

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