summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/dfs/include/dfs_fs.h2
-rw-r--r--components/libc/compilers/common/none-gcc/sys/errno.h199
-rw-r--r--components/libc/compilers/common/time.c1
-rw-r--r--components/libc/getline/posix_getline.c6
-rw-r--r--components/libc/pthreads/posix_types.h2
-rw-r--r--components/libc/termios/posix_termios.c2
-rw-r--r--components/net/lwip-1.4.1/src/arch/include/arch/cc.h2
-rw-r--r--components/net/lwip-2.0.2/src/arch/include/arch/cc.h2
-rw-r--r--components/net/lwip-2.0.2/src/lwipopts.h2
-rw-r--r--components/net/lwip-2.1.2/src/arch/include/arch/cc.h2
-rw-r--r--components/net/lwip-2.1.2/src/include/lwip/errno.h2
-rw-r--r--components/net/lwip-2.1.2/src/lwipopts.h1
-rw-r--r--components/net/sal_socket/socket/net_sockets.c2
13 files changed, 214 insertions, 11 deletions
diff --git a/components/dfs/include/dfs_fs.h b/components/dfs/include/dfs_fs.h
index 828f15a0f5..3d194515df 100644
--- a/components/dfs/include/dfs_fs.h
+++ b/components/dfs/include/dfs_fs.h
@@ -15,7 +15,7 @@
#ifdef RT_USING_LIBC
#include <sys/types.h>
#endif
-
+#include <sys/errno.h>
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/components/libc/compilers/common/none-gcc/sys/errno.h b/components/libc/compilers/common/none-gcc/sys/errno.h
new file mode 100644
index 0000000000..bdc3a3c9da
--- /dev/null
+++ b/components/libc/compilers/common/none-gcc/sys/errno.h
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-05-22 Meco Man The first version.
+ */
+#ifndef _SYS_ERRNO_H
+#define _SYS_ERRNO_H
+
+#if defined(__CC_ARM)
+/*
+defined in armcc/errno.h
+
+#define EDOM 1
+#define ERANGE 2
+#define EILSEQ 4
+#define ESIGNUM 3
+#define EINVAL 5
+#define ENOMEM 6
+*/
+
+#define ERROR_BASE_NO 7
+
+#elif defined(__IAR_SYSTEMS_ICC__)
+/* defined in iar/errno.h
+#define EDOM 33
+#define ERANGE 34
+#define EFPOS 35
+#define EILSEQ 36
+*/
+#define ERROR_BASE_NO 36
+
+#else
+#define ERROR_BASE_NO 0
+#endif
+
+#if !defined(_WIN32)
+
+#include <errno.h>
+
+#define EPERM (ERROR_BASE_NO + 1)
+#define ENOENT (ERROR_BASE_NO + 2)
+#define ESRCH (ERROR_BASE_NO + 3)
+#define EINTR (ERROR_BASE_NO + 4)
+#define EIO (ERROR_BASE_NO + 5)
+#define ENXIO (ERROR_BASE_NO + 6)
+#define E2BIG (ERROR_BASE_NO + 7)
+#define ENOEXEC (ERROR_BASE_NO + 8)
+#define EBADF (ERROR_BASE_NO + 9)
+#define ECHILD (ERROR_BASE_NO + 10)
+#define EAGAIN (ERROR_BASE_NO + 11)
+
+#ifndef ENOMEM
+#define ENOMEM (ERROR_BASE_NO + 12)
+#endif
+
+#define EACCES (ERROR_BASE_NO + 13)
+#define EFAULT (ERROR_BASE_NO + 14)
+#define ENOTBLK (ERROR_BASE_NO + 15)
+#define EBUSY (ERROR_BASE_NO + 16)
+#define EEXIST (ERROR_BASE_NO + 17)
+#define EXDEV (ERROR_BASE_NO + 18)
+#define ENODEV (ERROR_BASE_NO + 19)
+#define ENOTDIR (ERROR_BASE_NO + 20)
+#define EISDIR (ERROR_BASE_NO + 21)
+
+#ifndef EINVAL
+#define EINVAL (ERROR_BASE_NO + 22)
+#endif
+
+#define ENFILE (ERROR_BASE_NO + 23)
+#define EMFILE (ERROR_BASE_NO + 24)
+#define ENOTTY (ERROR_BASE_NO + 25)
+#define ETXTBSY (ERROR_BASE_NO + 26)
+#define EFBIG (ERROR_BASE_NO + 27)
+#define ENOSPC (ERROR_BASE_NO + 28)
+#define ESPIPE (ERROR_BASE_NO + 29)
+#define EROFS (ERROR_BASE_NO + 30)
+#define EMLINK (ERROR_BASE_NO + 31)
+#define EPIPE (ERROR_BASE_NO + 32)
+
+#ifndef EDOM
+#define EDOM (ERROR_BASE_NO + 33)
+#endif
+
+#ifndef ERANGE
+#define ERANGE (ERROR_BASE_NO + 34)
+#endif
+
+#define EDEADLK (ERROR_BASE_NO + 35)
+#define ENAMETOOLONG (ERROR_BASE_NO + 36)
+#define ENOLCK (ERROR_BASE_NO + 37)
+#define ENOSYS (ERROR_BASE_NO + 38)
+#define ENOTEMPTY (ERROR_BASE_NO + 39)
+#define ELOOP (ERROR_BASE_NO + 40)
+#define EWOULDBLOCK EAGAIN
+#define ENOMSG (ERROR_BASE_NO + 42)
+#define EIDRM (ERROR_BASE_NO + 43)
+#define ECHRNG (ERROR_BASE_NO + 44)
+#define EL2NSYNC (ERROR_BASE_NO + 45)
+#define EL3HLT (ERROR_BASE_NO + 46)
+#define EL3RST (ERROR_BASE_NO + 47)
+#define ELNRNG (ERROR_BASE_NO + 48)
+#define EUNATCH (ERROR_BASE_NO + 49)
+#define ENOCSI (ERROR_BASE_NO + 50)
+#define EL2HLT (ERROR_BASE_NO + 51)
+#define EBADE (ERROR_BASE_NO + 52)
+#define EBADR (ERROR_BASE_NO + 53)
+#define EXFULL (ERROR_BASE_NO + 54)
+#define ENOANO (ERROR_BASE_NO + 55)
+#define EBADRQC (ERROR_BASE_NO + 56)
+#define EBADSLT (ERROR_BASE_NO + 57)
+#define EDEADLOCK EDEADLK
+#define EBFONT (ERROR_BASE_NO + 59)
+#define ENOSTR (ERROR_BASE_NO + 60)
+#define ENODATA (ERROR_BASE_NO + 61)
+#define ETIME (ERROR_BASE_NO + 62)
+#define ENOSR (ERROR_BASE_NO + 63)
+#define ENONET (ERROR_BASE_NO + 64)
+#define ENOPKG (ERROR_BASE_NO + 65)
+#define EREMOTE (ERROR_BASE_NO + 66)
+#define ENOLINK (ERROR_BASE_NO + 67)
+#define EADV (ERROR_BASE_NO + 68)
+#define ESRMNT (ERROR_BASE_NO + 69)
+#define ECOMM (ERROR_BASE_NO + 70)
+#define EPROTO (ERROR_BASE_NO + 71)
+#define EMULTIHOP (ERROR_BASE_NO + 72)
+#define EDOTDOT (ERROR_BASE_NO + 73)
+#define EBADMSG (ERROR_BASE_NO + 74)
+#define EOVERFLOW (ERROR_BASE_NO + 75)
+#define ENOTUNIQ (ERROR_BASE_NO + 76)
+#define EBADFD (ERROR_BASE_NO + 77)
+#define EREMCHG (ERROR_BASE_NO + 78)
+#define ELIBACC (ERROR_BASE_NO + 79)
+#define ELIBBAD (ERROR_BASE_NO + 80)
+#define ELIBSCN (ERROR_BASE_NO + 81)
+#define ELIBMAX (ERROR_BASE_NO + 82)
+#define ELIBEXEC (ERROR_BASE_NO + 83)
+
+#ifndef EILSEQ
+#define EILSEQ (ERROR_BASE_NO + 84)
+#endif
+
+#define ERESTART (ERROR_BASE_NO + 85)
+#define ESTRPIPE (ERROR_BASE_NO + 86)
+#define EUSERS (ERROR_BASE_NO + 87)
+#define ENOTSOCK (ERROR_BASE_NO + 88)
+#define EDESTADDRREQ (ERROR_BASE_NO + 89)
+#define EMSGSIZE (ERROR_BASE_NO + 90)
+#define EPROTOTYPE (ERROR_BASE_NO + 91)
+#define ENOPROTOOPT (ERROR_BASE_NO + 92)
+#define EPROTONOSUPPORT (ERROR_BASE_NO + 93)
+#define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94)
+#define EOPNOTSUPP (ERROR_BASE_NO + 95)
+#define ENOTSUP EOPNOTSUPP
+#define EPFNOSUPPORT (ERROR_BASE_NO + 96)
+#define EAFNOSUPPORT (ERROR_BASE_NO + 97)
+#define EADDRINUSE (ERROR_BASE_NO + 98)
+#define EADDRNOTAVAIL (ERROR_BASE_NO + 99)
+#define ENETDOWN (ERROR_BASE_NO + 100)
+#define ENETUNREACH (ERROR_BASE_NO + 101)
+#define ENETRESET (ERROR_BASE_NO + 102)
+#define ECONNABORTED (ERROR_BASE_NO + 103)
+#define ECONNRESET (ERROR_BASE_NO + 104)
+#define ENOBUFS (ERROR_BASE_NO + 105)
+#define EISCONN (ERROR_BASE_NO + 106)
+#define ENOTCONN (ERROR_BASE_NO + 107)
+#define ESHUTDOWN (ERROR_BASE_NO + 108)
+#define ETOOMANYREFS (ERROR_BASE_NO + 109)
+#define ETIMEDOUT (ERROR_BASE_NO + 110)
+#define ECONNREFUSED (ERROR_BASE_NO + 111)
+#define EHOSTDOWN (ERROR_BASE_NO + 112)
+#define EHOSTUNREACH (ERROR_BASE_NO + 113)
+#define EALREADY (ERROR_BASE_NO + 114)
+#define EINPROGRESS (ERROR_BASE_NO + 115)
+#define ESTALE (ERROR_BASE_NO + 116)
+#define EUCLEAN (ERROR_BASE_NO + 117)
+#define ENOTNAM (ERROR_BASE_NO + 118)
+#define ENAVAIL (ERROR_BASE_NO + 119)
+#define EISNAM (ERROR_BASE_NO + 120)
+#define EREMOTEIO (ERROR_BASE_NO + 121)
+#define EDQUOT (ERROR_BASE_NO + 122)
+#define ENOMEDIUM (ERROR_BASE_NO + 123)
+#define EMEDIUMTYPE (ERROR_BASE_NO + 124)
+#define ECANCELED (ERROR_BASE_NO + 125)
+#define ENOKEY (ERROR_BASE_NO + 126)
+#define EKEYEXPIRED (ERROR_BASE_NO + 127)
+#define EKEYREVOKED (ERROR_BASE_NO + 128)
+#define EKEYREJECTED (ERROR_BASE_NO + 129)
+#define EOWNERDEAD (ERROR_BASE_NO + 130)
+#define ENOTRECOVERABLE (ERROR_BASE_NO + 131)
+#define ERFKILL (ERROR_BASE_NO + 132)
+#define EHWPOISON (ERROR_BASE_NO + 133)
+#endif
+
+#endif
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 9996212444..4cdfe77343 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -21,6 +21,7 @@
*/
#include "sys/time.h"
+#include <sys/errno.h>
#include <rtthread.h>
#ifdef RT_USING_DEVICE
diff --git a/components/libc/getline/posix_getline.c b/components/libc/getline/posix_getline.c
index 794ac3a07d..da80242ecc 100644
--- a/components/libc/getline/posix_getline.c
+++ b/components/libc/getline/posix_getline.c
@@ -11,8 +11,8 @@
#include "posix_getline.h"
#include <stdlib.h>
-#include <errno.h>
-#include <rtlibc.h>
+#include <limits.h>
+#include <sys/errno.h>
ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) {
char *cur_pos, *new_lineptr;
@@ -43,7 +43,7 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) {
break;
if ((*lineptr + *n - cur_pos) < 2) {
- if (SSIZE_MAX / 2 < *n) {
+ if (LONG_MAX / 2 < *n) {
#ifdef EOVERFLOW
errno = EOVERFLOW;
#else
diff --git a/components/libc/pthreads/posix_types.h b/components/libc/pthreads/posix_types.h
index 942657ef39..5838e8b370 100644
--- a/components/libc/pthreads/posix_types.h
+++ b/components/libc/pthreads/posix_types.h
@@ -20,7 +20,7 @@
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
-#include <errno.h>
+#include <sys/errno.h>
#include <fcntl.h>
#endif
diff --git a/components/libc/termios/posix_termios.c b/components/libc/termios/posix_termios.c
index 01ba010c86..10a1f466d6 100644
--- a/components/libc/termios/posix_termios.c
+++ b/components/libc/termios/posix_termios.c
@@ -11,7 +11,7 @@
#include <string.h>
#include <rtthread.h>
#include <dfs_posix.h>
-
+#include <sys/errno.h>
#include <termios.h>
int tcgetattr(int fd, struct termios *tio)
diff --git a/components/net/lwip-1.4.1/src/arch/include/arch/cc.h b/components/net/lwip-1.4.1/src/arch/include/arch/cc.h
index 8dd59e8dee..880366d1f8 100644
--- a/components/net/lwip-1.4.1/src/arch/include/arch/cc.h
+++ b/components/net/lwip-1.4.1/src/arch/include/arch/cc.h
@@ -105,7 +105,7 @@ void sys_arch_assert(const char* file, int line);
#define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0)
#define LWIP_PLATFORM_ASSERT(x) do {rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__);}while(0)
-#include "string.h"
+#include <string.h>
#define SYS_ARCH_DECL_PROTECT(level)
#define SYS_ARCH_PROTECT(level) rt_enter_critical()
diff --git a/components/net/lwip-2.0.2/src/arch/include/arch/cc.h b/components/net/lwip-2.0.2/src/arch/include/arch/cc.h
index e3014f552c..a17b162805 100644
--- a/components/net/lwip-2.0.2/src/arch/include/arch/cc.h
+++ b/components/net/lwip-2.0.2/src/arch/include/arch/cc.h
@@ -84,7 +84,7 @@ void sys_arch_assert(const char* file, int line);
#define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0)
#define LWIP_PLATFORM_ASSERT(x) do {rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__);}while(0)
-#include "string.h"
+#include <string.h>
#define SYS_ARCH_DECL_PROTECT(level)
#define SYS_ARCH_PROTECT(level) rt_enter_critical()
diff --git a/components/net/lwip-2.0.2/src/lwipopts.h b/components/net/lwip-2.0.2/src/lwipopts.h
index 09bd223aa4..b334c5ac17 100644
--- a/components/net/lwip-2.0.2/src/lwipopts.h
+++ b/components/net/lwip-2.0.2/src/lwipopts.h
@@ -5,6 +5,8 @@
#define ERRNO 1
+#define LWIP_ERRNO_STDINCLUDE
+
#define LWIP_IPV4 1
#ifdef RT_USING_LWIP_IPV6
diff --git a/components/net/lwip-2.1.2/src/arch/include/arch/cc.h b/components/net/lwip-2.1.2/src/arch/include/arch/cc.h
index 413fef65df..e85ca1d085 100644
--- a/components/net/lwip-2.1.2/src/arch/include/arch/cc.h
+++ b/components/net/lwip-2.1.2/src/arch/include/arch/cc.h
@@ -46,7 +46,7 @@
#define X32_F "lx"
#ifdef RT_USING_LIBC
-#include <errno.h>
+#include <sys/errno.h>
#ifndef ENSRNOTFOUND
#define ENSRNOTFOUND 163 /* Domain name not found */
#endif
diff --git a/components/net/lwip-2.1.2/src/include/lwip/errno.h b/components/net/lwip-2.1.2/src/include/lwip/errno.h
index 48d6b539d8..9fd88fc91a 100644
--- a/components/net/lwip-2.1.2/src/include/lwip/errno.h
+++ b/components/net/lwip-2.1.2/src/include/lwip/errno.h
@@ -181,7 +181,7 @@ extern int errno;
/* Define LWIP_ERRNO_STDINCLUDE if you want to include <errno.h> here */
#ifdef LWIP_ERRNO_STDINCLUDE
-#include <errno.h>
+#include <sys/errno.h>
#else /* LWIP_ERRNO_STDINCLUDE */
/* Define LWIP_ERRNO_INCLUDE to an equivalent of <errno.h> to include the error defines here */
#ifdef LWIP_ERRNO_INCLUDE
diff --git a/components/net/lwip-2.1.2/src/lwipopts.h b/components/net/lwip-2.1.2/src/lwipopts.h
index 220bb6fa41..8c2bfbdd76 100644
--- a/components/net/lwip-2.1.2/src/lwipopts.h
+++ b/components/net/lwip-2.1.2/src/lwipopts.h
@@ -5,6 +5,7 @@
#define ERRNO 1
+#define LWIP_ERRNO_STDINCLUDE
#define LWIP_SOCKET_SELECT 1
#define LWIP_SOCKET_POLL 1
diff --git a/components/net/sal_socket/socket/net_sockets.c b/components/net/sal_socket/socket/net_sockets.c
index 3637635d50..7d4db34327 100644
--- a/components/net/sal_socket/socket/net_sockets.c
+++ b/components/net/sal_socket/socket/net_sockets.c
@@ -13,7 +13,7 @@
#include <dfs_file.h>
#include <dfs_poll.h>
#include <dfs_net.h>
-
+#include <sys/errno.h>
#include <sys/socket.h>
int accept(int s, struct sockaddr *addr, socklen_t *addrlen)