1 /* 2 * Copyright (c) 2006-2018, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2016-11-12 Bernard The first version 9 */ 10 11 #ifndef LIBC_ERRNO_H__ 12 #define LIBC_ERRNO_H__ 13 14 #include <rtconfig.h> 15 16 #if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__) 17 /* use errno.h file in toolchains */ 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 43 #else 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) 105 #define EWOULDBLOCK EAGAIN 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) 122 #define EDEADLOCK EDEADLK 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 204 #endif 205 206 #endif 207