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