|
2 | 2 | * Copyright (c) 2006-2018, RT-Thread Development Team |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: Apache-2.0 |
5 | | - */ |
6 | | - |
7 | | -/* |
8 | | - * File : libc_errno.h |
9 | 5 | * |
10 | 6 | * Change Logs: |
11 | 7 | * Date Author Notes |
|
17 | 13 |
|
18 | 14 | #include <rtconfig.h> |
19 | 15 |
|
20 | | -#if defined(RT_USING_NEWLIB) || defined(_WIN32) |
21 | | -/* use errno.h file in newlib */ |
| 16 | +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__) |
| 17 | +/* use errno.h file in toolchains */ |
22 | 18 | #include <errno.h> |
| 19 | +#endif |
| 20 | + |
| 21 | +#if defined(__CC_ARM) |
| 22 | +/* |
| 23 | +defined in armcc/errno.h |
| 24 | +
|
| 25 | +#define EDOM 1 |
| 26 | +#define ERANGE 2 |
| 27 | +#define EILSEQ 4 |
| 28 | +#define ESIGNUM 3 |
| 29 | +#define EINVAL 5 |
| 30 | +#define ENOMEM 6 |
| 31 | +*/ |
| 32 | +#define ERROR_BASE_NO 7 |
| 33 | + |
| 34 | +#elif defined(__IAR_SYSTEMS_ICC__) |
| 35 | +/* defined in iar/errno.h |
| 36 | +#define EDOM 33 |
| 37 | +#define ERANGE 34 |
| 38 | +#define EFPOS 35 |
| 39 | +#define EILSEQ 36 |
| 40 | +*/ |
| 41 | +#define ERROR_BASE_NO 36 |
| 42 | + |
23 | 43 | #else |
24 | | -/* define errno self. */ |
25 | | -#define EPERM 1 |
26 | | -#define ENOENT 2 |
27 | | -#define ESRCH 3 |
28 | | -#define EINTR 4 |
29 | | -#define EIO 5 |
30 | | -#define ENXIO 6 |
31 | | -#define E2BIG 7 |
32 | | -#define ENOEXEC 8 |
33 | | -#define EBADF 9 |
34 | | -#define ECHILD 10 |
35 | | -#define EAGAIN 11 |
36 | | -#define ENOMEM 12 |
37 | | -#define EACCES 13 |
38 | | -#define EFAULT 14 |
39 | | -#define ENOTBLK 15 |
40 | | -#define EBUSY 16 |
41 | | -#define EEXIST 17 |
42 | | -#define EXDEV 18 |
43 | | -#define ENODEV 19 |
44 | | -#define ENOTDIR 20 |
45 | | -#define EISDIR 21 |
46 | | -#define EINVAL 22 |
47 | | -#define ENFILE 23 |
48 | | -#define EMFILE 24 |
49 | | -#define ENOTTY 25 |
50 | | -#define ETXTBSY 26 |
51 | | -#define EFBIG 27 |
52 | | -#define ENOSPC 28 |
53 | | -#define ESPIPE 29 |
54 | | -#define EROFS 30 |
55 | | -#define EMLINK 31 |
56 | | -#define EPIPE 32 |
57 | | -#define EDOM 33 |
58 | | -#define ERANGE 34 |
59 | | -#define EDEADLK 35 |
60 | | -#define ENAMETOOLONG 36 |
61 | | -#define ENOLCK 37 |
62 | | -#define ENOSYS 38 |
63 | | -#define ENOTEMPTY 39 |
64 | | -#define ELOOP 40 |
| 44 | + |
| 45 | +#define ERROR_BASE_NO 0 |
| 46 | +#endif |
| 47 | + |
| 48 | +#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) |
| 49 | + |
| 50 | +#define EPERM (ERROR_BASE_NO + 1) |
| 51 | +#define ENOENT (ERROR_BASE_NO + 2) |
| 52 | +#define ESRCH (ERROR_BASE_NO + 3) |
| 53 | +#define EINTR (ERROR_BASE_NO + 4) |
| 54 | +#define EIO (ERROR_BASE_NO + 5) |
| 55 | +#define ENXIO (ERROR_BASE_NO + 6) |
| 56 | +#define E2BIG (ERROR_BASE_NO + 7) |
| 57 | +#define ENOEXEC (ERROR_BASE_NO + 8) |
| 58 | +#define EBADF (ERROR_BASE_NO + 9) |
| 59 | +#define ECHILD (ERROR_BASE_NO + 10) |
| 60 | +#define EAGAIN (ERROR_BASE_NO + 11) |
| 61 | + |
| 62 | +#ifndef ENOMEM |
| 63 | +#define ENOMEM (ERROR_BASE_NO + 12) |
| 64 | +#endif |
| 65 | + |
| 66 | +#define EACCES (ERROR_BASE_NO + 13) |
| 67 | +#define EFAULT (ERROR_BASE_NO + 14) |
| 68 | +#define ENOTBLK (ERROR_BASE_NO + 15) |
| 69 | +#define EBUSY (ERROR_BASE_NO + 16) |
| 70 | +#define EEXIST (ERROR_BASE_NO + 17) |
| 71 | +#define EXDEV (ERROR_BASE_NO + 18) |
| 72 | +#define ENODEV (ERROR_BASE_NO + 19) |
| 73 | +#define ENOTDIR (ERROR_BASE_NO + 20) |
| 74 | +#define EISDIR (ERROR_BASE_NO + 21) |
| 75 | + |
| 76 | +#ifndef EINVAL |
| 77 | +#define EINVAL (ERROR_BASE_NO + 22) |
| 78 | +#endif |
| 79 | + |
| 80 | +#define ENFILE (ERROR_BASE_NO + 23) |
| 81 | +#define EMFILE (ERROR_BASE_NO + 24) |
| 82 | +#define ENOTTY (ERROR_BASE_NO + 25) |
| 83 | +#define ETXTBSY (ERROR_BASE_NO + 26) |
| 84 | +#define EFBIG (ERROR_BASE_NO + 27) |
| 85 | +#define ENOSPC (ERROR_BASE_NO + 28) |
| 86 | +#define ESPIPE (ERROR_BASE_NO + 29) |
| 87 | +#define EROFS (ERROR_BASE_NO + 30) |
| 88 | +#define EMLINK (ERROR_BASE_NO + 31) |
| 89 | +#define EPIPE (ERROR_BASE_NO + 32) |
| 90 | + |
| 91 | +#ifndef EDOM |
| 92 | +#define EDOM (ERROR_BASE_NO + 33) |
| 93 | +#endif |
| 94 | + |
| 95 | +#ifndef ERANGE |
| 96 | +#define ERANGE (ERROR_BASE_NO + 34) |
| 97 | +#endif |
| 98 | + |
| 99 | +#define EDEADLK (ERROR_BASE_NO + 35) |
| 100 | +#define ENAMETOOLONG (ERROR_BASE_NO + 36) |
| 101 | +#define ENOLCK (ERROR_BASE_NO + 37) |
| 102 | +#define ENOSYS (ERROR_BASE_NO + 38) |
| 103 | +#define ENOTEMPTY (ERROR_BASE_NO + 39) |
| 104 | +#define ELOOP (ERROR_BASE_NO + 40) |
65 | 105 | #define EWOULDBLOCK EAGAIN |
66 | | -#define ENOMSG 42 |
67 | | -#define EIDRM 43 |
68 | | -#define ECHRNG 44 |
69 | | -#define EL2NSYNC 45 |
70 | | -#define EL3HLT 46 |
71 | | -#define EL3RST 47 |
72 | | -#define ELNRNG 48 |
73 | | -#define EUNATCH 49 |
74 | | -#define ENOCSI 50 |
75 | | -#define EL2HLT 51 |
76 | | -#define EBADE 52 |
77 | | -#define EBADR 53 |
78 | | -#define EXFULL 54 |
79 | | -#define ENOANO 55 |
80 | | -#define EBADRQC 56 |
81 | | -#define EBADSLT 57 |
| 106 | +#define ENOMSG (ERROR_BASE_NO + 42) |
| 107 | +#define EIDRM (ERROR_BASE_NO + 43) |
| 108 | +#define ECHRNG (ERROR_BASE_NO + 44) |
| 109 | +#define EL2NSYNC (ERROR_BASE_NO + 45) |
| 110 | +#define EL3HLT (ERROR_BASE_NO + 46) |
| 111 | +#define EL3RST (ERROR_BASE_NO + 47) |
| 112 | +#define ELNRNG (ERROR_BASE_NO + 48) |
| 113 | +#define EUNATCH (ERROR_BASE_NO + 49) |
| 114 | +#define ENOCSI (ERROR_BASE_NO + 50) |
| 115 | +#define EL2HLT (ERROR_BASE_NO + 51) |
| 116 | +#define EBADE (ERROR_BASE_NO + 52) |
| 117 | +#define EBADR (ERROR_BASE_NO + 53) |
| 118 | +#define EXFULL (ERROR_BASE_NO + 54) |
| 119 | +#define ENOANO (ERROR_BASE_NO + 55) |
| 120 | +#define EBADRQC (ERROR_BASE_NO + 56) |
| 121 | +#define EBADSLT (ERROR_BASE_NO + 57) |
82 | 122 | #define EDEADLOCK EDEADLK |
83 | | -#define EBFONT 59 |
84 | | -#define ENOSTR 60 |
85 | | -#define ENODATA 61 |
86 | | -#define ETIME 62 |
87 | | -#define ENOSR 63 |
88 | | -#define ENONET 64 |
89 | | -#define ENOPKG 65 |
90 | | -#define EREMOTE 66 |
91 | | -#define ENOLINK 67 |
92 | | -#define EADV 68 |
93 | | -#define ESRMNT 69 |
94 | | -#define ECOMM 70 |
95 | | -#define EPROTO 71 |
96 | | -#define EMULTIHOP 72 |
97 | | -#define EDOTDOT 73 |
98 | | -#define EBADMSG 74 |
99 | | -#define EOVERFLOW 75 |
100 | | -#define ENOTUNIQ 76 |
101 | | -#define EBADFD 77 |
102 | | -#define EREMCHG 78 |
103 | | -#define ELIBACC 79 |
104 | | -#define ELIBBAD 80 |
105 | | -#define ELIBSCN 81 |
106 | | -#define ELIBMAX 82 |
107 | | -#define ELIBEXEC 83 |
108 | | -#define EILSEQ 84 |
109 | | -#define ERESTART 85 |
110 | | -#define ESTRPIPE 86 |
111 | | -#define EUSERS 87 |
112 | | -#define ENOTSOCK 88 |
113 | | -#define EDESTADDRREQ 89 |
114 | | -#define EMSGSIZE 90 |
115 | | -#define EPROTOTYPE 91 |
116 | | -#define ENOPROTOOPT 92 |
117 | | -#define EPROTONOSUPPORT 93 |
118 | | -#define ESOCKTNOSUPPORT 94 |
119 | | -#define EOPNOTSUPP 95 |
120 | | -#define ENOTSUP EOPNOTSUPP |
121 | | -#define EPFNOSUPPORT 96 |
122 | | -#define EAFNOSUPPORT 97 |
123 | | -#define EADDRINUSE 98 |
124 | | -#define EADDRNOTAVAIL 99 |
125 | | -#define ENETDOWN 100 |
126 | | -#define ENETUNREACH 101 |
127 | | -#define ENETRESET 102 |
128 | | -#define ECONNABORTED 103 |
129 | | -#define ECONNRESET 104 |
130 | | -#define ENOBUFS 105 |
131 | | -#define EISCONN 106 |
132 | | -#define ENOTCONN 107 |
133 | | -#define ESHUTDOWN 108 |
134 | | -#define ETOOMANYREFS 109 |
135 | | -#define ETIMEDOUT 110 |
136 | | -#define ECONNREFUSED 111 |
137 | | -#define EHOSTDOWN 112 |
138 | | -#define EHOSTUNREACH 113 |
139 | | -#define EALREADY 114 |
140 | | -#define EINPROGRESS 115 |
141 | | -#define ESTALE 116 |
142 | | -#define EUCLEAN 117 |
143 | | -#define ENOTNAM 118 |
144 | | -#define ENAVAIL 119 |
145 | | -#define EISNAM 120 |
146 | | -#define EREMOTEIO 121 |
147 | | -#define EDQUOT 122 |
148 | | -#define ENOMEDIUM 123 |
149 | | -#define EMEDIUMTYPE 124 |
150 | | -#define ECANCELED 125 |
151 | | -#define ENOKEY 126 |
152 | | -#define EKEYEXPIRED 127 |
153 | | -#define EKEYREVOKED 128 |
154 | | -#define EKEYREJECTED 129 |
155 | | -#define EOWNERDEAD 130 |
156 | | -#define ENOTRECOVERABLE 131 |
157 | | -#define ERFKILL 132 |
158 | | -#define EHWPOISON 133 |
| 123 | +#define EBFONT (ERROR_BASE_NO + 59) |
| 124 | +#define ENOSTR (ERROR_BASE_NO + 60) |
| 125 | +#define ENODATA (ERROR_BASE_NO + 61) |
| 126 | +#define ETIME (ERROR_BASE_NO + 62) |
| 127 | +#define ENOSR (ERROR_BASE_NO + 63) |
| 128 | +#define ENONET (ERROR_BASE_NO + 64) |
| 129 | +#define ENOPKG (ERROR_BASE_NO + 65) |
| 130 | +#define EREMOTE (ERROR_BASE_NO + 66) |
| 131 | +#define ENOLINK (ERROR_BASE_NO + 67) |
| 132 | +#define EADV (ERROR_BASE_NO + 68) |
| 133 | +#define ESRMNT (ERROR_BASE_NO + 69) |
| 134 | +#define ECOMM (ERROR_BASE_NO + 70) |
| 135 | +#define EPROTO (ERROR_BASE_NO + 71) |
| 136 | +#define EMULTIHOP (ERROR_BASE_NO + 72) |
| 137 | +#define EDOTDOT (ERROR_BASE_NO + 73) |
| 138 | +#define EBADMSG (ERROR_BASE_NO + 74) |
| 139 | +#define EOVERFLOW (ERROR_BASE_NO + 75) |
| 140 | +#define ENOTUNIQ (ERROR_BASE_NO + 76) |
| 141 | +#define EBADFD (ERROR_BASE_NO + 77) |
| 142 | +#define EREMCHG (ERROR_BASE_NO + 78) |
| 143 | +#define ELIBACC (ERROR_BASE_NO + 79) |
| 144 | +#define ELIBBAD (ERROR_BASE_NO + 80) |
| 145 | +#define ELIBSCN (ERROR_BASE_NO + 81) |
| 146 | +#define ELIBMAX (ERROR_BASE_NO + 82) |
| 147 | +#define ELIBEXEC (ERROR_BASE_NO + 83) |
| 148 | + |
| 149 | +#ifndef EILSEQ |
| 150 | +#define EILSEQ (ERROR_BASE_NO + 84) |
| 151 | +#endif |
| 152 | + |
| 153 | +#define ERESTART (ERROR_BASE_NO + 85) |
| 154 | +#define ESTRPIPE (ERROR_BASE_NO + 86) |
| 155 | +#define EUSERS (ERROR_BASE_NO + 87) |
| 156 | +#define ENOTSOCK (ERROR_BASE_NO + 88) |
| 157 | +#define EDESTADDRREQ (ERROR_BASE_NO + 89) |
| 158 | +#define EMSGSIZE (ERROR_BASE_NO + 90) |
| 159 | +#define EPROTOTYPE (ERROR_BASE_NO + 91) |
| 160 | +#define ENOPROTOOPT (ERROR_BASE_NO + 92) |
| 161 | +#define EPROTONOSUPPORT (ERROR_BASE_NO + 93) |
| 162 | +#define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94) |
| 163 | +#define EOPNOTSUPP (ERROR_BASE_NO + 95) |
| 164 | +#define ENOTSUP EOPNOTSUPP ) |
| 165 | +#define EPFNOSUPPORT (ERROR_BASE_NO + 96) |
| 166 | +#define EAFNOSUPPORT (ERROR_BASE_NO + 97) |
| 167 | +#define EADDRINUSE (ERROR_BASE_NO + 98) |
| 168 | +#define EADDRNOTAVAIL (ERROR_BASE_NO + 99) |
| 169 | +#define ENETDOWN (ERROR_BASE_NO + 100) |
| 170 | +#define ENETUNREACH (ERROR_BASE_NO + 101) |
| 171 | +#define ENETRESET (ERROR_BASE_NO + 102) |
| 172 | +#define ECONNABORTED (ERROR_BASE_NO + 103) |
| 173 | +#define ECONNRESET (ERROR_BASE_NO + 104) |
| 174 | +#define ENOBUFS (ERROR_BASE_NO + 105) |
| 175 | +#define EISCONN (ERROR_BASE_NO + 106) |
| 176 | +#define ENOTCONN (ERROR_BASE_NO + 107) |
| 177 | +#define ESHUTDOWN (ERROR_BASE_NO + 108) |
| 178 | +#define ETOOMANYREFS (ERROR_BASE_NO + 109) |
| 179 | +#define ETIMEDOUT (ERROR_BASE_NO + 110) |
| 180 | +#define ECONNREFUSED (ERROR_BASE_NO + 111) |
| 181 | +#define EHOSTDOWN (ERROR_BASE_NO + 112) |
| 182 | +#define EHOSTUNREACH (ERROR_BASE_NO + 113) |
| 183 | +#define EALREADY (ERROR_BASE_NO + 114) |
| 184 | +#define EINPROGRESS (ERROR_BASE_NO + 115) |
| 185 | +#define ESTALE (ERROR_BASE_NO + 116) |
| 186 | +#define EUCLEAN (ERROR_BASE_NO + 117) |
| 187 | +#define ENOTNAM (ERROR_BASE_NO + 118) |
| 188 | +#define ENAVAIL (ERROR_BASE_NO + 119) |
| 189 | +#define EISNAM (ERROR_BASE_NO + 120) |
| 190 | +#define EREMOTEIO (ERROR_BASE_NO + 121) |
| 191 | +#define EDQUOT (ERROR_BASE_NO + 122) |
| 192 | +#define ENOMEDIUM (ERROR_BASE_NO + 123) |
| 193 | +#define EMEDIUMTYPE (ERROR_BASE_NO + 124) |
| 194 | +#define ECANCELED (ERROR_BASE_NO + 125) |
| 195 | +#define ENOKEY (ERROR_BASE_NO + 126) |
| 196 | +#define EKEYEXPIRED (ERROR_BASE_NO + 127) |
| 197 | +#define EKEYREVOKED (ERROR_BASE_NO + 128) |
| 198 | +#define EKEYREJECTED (ERROR_BASE_NO + 129) |
| 199 | +#define EOWNERDEAD (ERROR_BASE_NO + 130) |
| 200 | +#define ENOTRECOVERABLE (ERROR_BASE_NO + 131) |
| 201 | +#define ERFKILL (ERROR_BASE_NO + 132) |
| 202 | +#define EHWPOISON (ERROR_BASE_NO + 133) |
| 203 | + |
159 | 204 | #endif |
160 | 205 |
|
161 | 206 | #endif |
0 commit comments