此篇博客用来在 ESP-IDF 中出现类似于 tcp udp 异常错误时能根据对应的 errno 获取大致的分析思路。
经了解,ESP-IDF 在 3.x 版本与 4.x 版本的 errno 对应列表有细微出入,故在此分为两小节:
- IDF 3.x 版本下的 errno 列表
- IDF 4.x 版本下的 errno 列表
1 IDF 3.x 版本下的 errno 列表
IDF 3.x 版本下的 errno 列表直接存在于 IDF 中,点击 esp-idf/components/newlib/include/sys/errno.h 可以进行查询。如下:
#define EPERM 1
#define ENOENT 2
#define ESRCH 3
#define EINTR 4
#define EIO 5
#define ENXIO 6
#define E2BIG 7
#define ENOEXEC 8
#define EBADF 9
#define ECHILD 10
#define EAGAIN 11
#define ENOMEM 12
#define EACCES 13
#define EFAULT 14
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOTBLK 15
#endif
#define EBUSY 16
#define EEXIST 17
#define EXDEV 18
#define ENODEV 19
#define ENOTDIR 20
#define EISDIR 21
#define EINVAL 22
#define ENFILE 23
#define EMFILE 24
#define ENOTTY 25
#define ETXTBSY 26
#define EFBIG 27
#define ENOSPC 28
#define ESPIPE 29
#define EROFS 30
#define EMLINK 31
#define EPIPE 32
#define EDOM 33
#define ERANGE 34
#define ENOMSG 35
#define EIDRM 36
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ECHRNG 37
#define EL2NSYNC 38
#define EL3HLT 39
#define EL3RST 40
#define ELNRNG 41
#define EUNATCH 42
#define ENOCSI 43
#define EL2HLT 44
#endif
#define EDEADLK 45
#define ENOLCK 46
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EBADE 50
#define EBADR 51
#define EXFULL 52
#define ENOANO 53
#define EBADRQC 54
#define EBADSLT 55
#define EDEADLOCK 56
#define EBFONT 57
#endif
#define ENOSTR 60
#define ENODATA 61
#define ETIME 62
#define ENOSR 63
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENONET 64
#define ENOPKG 65
#define EREMOTE 66
#endif
#define ENOLINK 67
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EADV 68
#define ESRMNT 69
#define ECOMM 70
#endif
#define EPROTO 71
#define EMULTIHOP 74
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ELBIN 75
#define EDOTDOT 76
#endif
#define EBADMSG 77
#define EFTYPE 79
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOTUNIQ 80
#define EBADFD 81
#define EREMCHG 82
#define ELIBACC 83
#define ELIBBAD 84
#define ELIBSCN 85
#define ELIBMAX 86
#define ELIBEXEC 87
#endif
#define ENOSYS 88
#ifdef __CYGWIN__
#define ENMFILE 89
#endif
#define ENOTEMPTY 90
#define ENAMETOOLONG 91
#define ELOOP 92
#define EOPNOTSUPP 95
#define EPFNOSUPPORT 96
#define ECONNRESET 104
#define ENOBUFS 105
#define EAFNOSUPPORT 106
#define EPROTOTYPE 107
#define ENOTSOCK 108
#define ENOPROTOOPT 109
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESHUTDOWN 110
#endif
#define ECONNREFUSED 111
#define EADDRINUSE 112
#define ECONNABORTED 113
#define ENETUNREACH 114
#define ENETDOWN 115
#define ETIMEDOUT 116
#define EHOSTDOWN 117
#define EHOSTUNREACH 118
#define EINPROGRESS 119
#define EALREADY 120
#define EDESTADDRREQ 121
#define EMSGSIZE 122
#define EPROTONOSUPPORT 123
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESOCKTNOSUPPORT 124
#endif
#define EADDRNOTAVAIL 125
#define ENETRESET 126
#define EISCONN 127
#define ENOTCONN 128
#define ETOOMANYREFS 129
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EPROCLIM 130
#define EUSERS 131
#endif
#define EDQUOT 132
#define ESTALE 133
#define ENOTSUP 134
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOMEDIUM 135
#endif
#ifdef __CYGWIN__
#define ENOSHARE 136
#define ECASECLASH 137
#endif
#define EILSEQ 138
#define EOVERFLOW 139
#define ECANCELED 140
#define ENOTRECOVERABLE 141
#define EOWNERDEAD 142
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESTRPIPE 143
#endif
#define EWOULDBLOCK EAGAIN
#define __ELASTERROR 2000
2 IDF 4.x 版本下的 errno 列表
与 IDF 3.x 版本不同的是,IDF 4.x 版本的 errno.h 位于编译器工具链下,比如,对于 esp-2020r3 而言, errno.h 的路径为
/root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/include/sys/errno.h 。如下:
#define EPERM 1
#define ENOENT 2
#define ESRCH 3
#define EINTR 4
#define EIO 5
#define ENXIO 6
#define E2BIG 7
#define ENOEXEC 8
#define EBADF 9
#define ECHILD 10
#define EAGAIN 11
#define ENOMEM 12
#define EACCES 13
#define EFAULT 14
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOTBLK 15
#endif
#define EBUSY 16
#define EEXIST 17
#define EXDEV 18
#define ENODEV 19
#define ENOTDIR 20
#define EISDIR 21
#define EINVAL 22
#define ENFILE 23
#define EMFILE 24
#define ENOTTY 25
#define ETXTBSY 26
#define EFBIG 27
#define ENOSPC 28
#define ESPIPE 29
#define EROFS 30
#define EMLINK 31
#define EPIPE 32
#define EDOM 33
#define ERANGE 34
#define ENOMSG 35
#define EIDRM 36
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ECHRNG 37
#define EL2NSYNC 38
#define EL3HLT 39
#define EL3RST 40
#define ELNRNG 41
#define EUNATCH 42
#define ENOCSI 43
#define EL2HLT 44
#endif
#define EDEADLK 45
#define ENOLCK 46
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EBADE 50
#define EBADR 51
#define EXFULL 52
#define ENOANO 53
#define EBADRQC 54
#define EBADSLT 55
#define EDEADLOCK 56
#define EBFONT 57
#endif
#define ENOSTR 60
#define ENODATA 61
#define ETIME 62
#define ENOSR 63
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENONET 64
#define ENOPKG 65
#define EREMOTE 66
#endif
#define ENOLINK 67
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EADV 68
#define ESRMNT 69
#define ECOMM 70
#endif
#define EPROTO 71
#define EMULTIHOP 74
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ELBIN 75
#define EDOTDOT 76
#endif
#define EBADMSG 77
#define EFTYPE 79
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOTUNIQ 80
#define EBADFD 81
#define EREMCHG 82
#define ELIBACC 83
#define ELIBBAD 84
#define ELIBSCN 85
#define ELIBMAX 86
#define ELIBEXEC 87
#endif
#define ENOSYS 88
#ifdef __CYGWIN__
#define ENMFILE 89
#endif
#define ENOTEMPTY 90
#define ENAMETOOLONG 91
#define ELOOP 92
#define EOPNOTSUPP 95
#define EPFNOSUPPORT 96
#define ECONNRESET 104
#define ENOBUFS 105
#define EAFNOSUPPORT 106
#define EPROTOTYPE 107
#define ENOTSOCK 108
#define ENOPROTOOPT 109
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESHUTDOWN 110
#endif
#define ECONNREFUSED 111
#define EADDRINUSE 112
#define ECONNABORTED 113
#define ENETUNREACH 114
#define ENETDOWN 115
#define ETIMEDOUT 116
#define EHOSTDOWN 117
#define EHOSTUNREACH 118
#define EINPROGRESS 119
#define EALREADY 120
#define EDESTADDRREQ 121
#define EMSGSIZE 122
#define EPROTONOSUPPORT 123
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESOCKTNOSUPPORT 124
#endif
#define EADDRNOTAVAIL 125
#define ENETRESET 126
#define EISCONN 127
#define ENOTCONN 128
#define ETOOMANYREFS 129
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EPROCLIM 130
#define EUSERS 131
#endif
#define EDQUOT 132
#define ESTALE 133
#define ENOTSUP 134
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOMEDIUM 135
#endif
#ifdef __CYGWIN__
#define ENOSHARE 136
#define ECASECLASH 137
#endif
#define EILSEQ 138
#define EOVERFLOW 139
#define ECANCELED 140
#define ENOTRECOVERABLE 141
#define EOWNERDEAD 142
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ESTRPIPE 143
#endif
#define EWOULDBLOCK EAGAIN
#define __ELASTERROR 2000
|