summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/dfs/include/dfs_fs.h2
-rw-r--r--components/drivers/cputime/cputime.c5
-rw-r--r--components/drivers/src/pipe.c11
-rw-r--r--components/finsh/shell.c2
-rw-r--r--components/libc/compilers/common/SConscript13
-rw-r--r--components/libc/compilers/common/none-gcc/SConscript6
-rw-r--r--components/libc/compilers/common/none-gcc/sys/errno.h (renamed from include/libc/libc_errno.h)21
-rw-r--r--components/libc/compilers/common/time.c1
-rw-r--r--components/libc/compilers/newlib/minilib.c14
-rw-r--r--components/libc/getline/posix_getline.c6
-rw-r--r--components/libc/pthreads/posix_types.h2
-rw-r--r--components/libc/signal/posix_signal.c3
-rw-r--r--components/libc/termios/posix_termios.c2
-rw-r--r--components/net/lwip-1.4.1/src/arch/include/arch/cc.h14
-rw-r--r--components/net/lwip-1.4.1/src/lwipopts.h2
-rw-r--r--components/net/lwip-2.0.2/src/arch/include/arch/cc.h16
-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.h13
-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.h3
-rw-r--r--components/net/sal_socket/socket/net_sockets.c2
-rw-r--r--examples/libc/ex3.c2
-rw-r--r--examples/libc/ex6.c2
-rw-r--r--examples/libc/ex7.c2
-rw-r--r--examples/libc/file.c2
-rw-r--r--examples/libc/memory.c2
-rw-r--r--include/libc/libc_limits.h25
-rw-r--r--include/rtlibc.h2
28 files changed, 68 insertions, 111 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/drivers/cputime/cputime.c b/components/drivers/cputime/cputime.c
index 4a9eee3a71..750733f366 100644
--- a/components/drivers/cputime/cputime.c
+++ b/components/drivers/cputime/cputime.c
@@ -10,6 +10,7 @@
#include <rtdevice.h>
#include <rtthread.h>
+#include <sys/errno.h>
static const struct rt_clock_cputime_ops *_cputime_ops = RT_NULL;
@@ -24,7 +25,7 @@ float clock_cpu_getres(void)
if (_cputime_ops)
return _cputime_ops->cputime_getres();
- rt_set_errno(-ENOSYS);
+ rt_set_errno(ENOSYS);
return 0;
}
@@ -38,7 +39,7 @@ uint32_t clock_cpu_gettime(void)
if (_cputime_ops)
return _cputime_ops->cputime_gettime();
- rt_set_errno(-ENOSYS);
+ rt_set_errno(ENOSYS);
return 0;
}
diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c
index 236c1ffec7..09448a8e9e 100644
--- a/components/drivers/src/pipe.c
+++ b/components/drivers/src/pipe.c
@@ -11,8 +11,9 @@
#include <rthw.h>
#include <rtdevice.h>
#include <stdint.h>
+#include <sys/errno.h>
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX
#include <dfs_file.h>
#include <dfs_posix.h>
#include <dfs_poll.h>
@@ -374,7 +375,7 @@ rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t
if (device == RT_NULL)
{
- rt_set_errno(-EINVAL);
+ rt_set_errno(EINVAL);
return 0;
}
if (count == 0) return 0;
@@ -402,7 +403,7 @@ rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt
if (device == RT_NULL)
{
- rt_set_errno(-EINVAL);
+ rt_set_errno(EINVAL);
return 0;
}
if (count == 0) return 0;
@@ -516,12 +517,12 @@ int rt_pipe_delete(const char *name)
}
else
{
- result = -ENODEV;
+ result = -RT_EINVAL;
}
}
else
{
- result = -ENODEV;
+ result = -RT_EINVAL;
}
return result;
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index 6f1133bf3b..a749660629 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -97,7 +97,7 @@ int finsh_set_prompt(const char * prompt)
}
#endif /* RT_USING_HEAP */
-#if defined(RT_USING_DFS)
+#ifdef RT_USING_DFS
#include <dfs_posix.h>
#endif /* RT_USING_DFS */
diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript
index 039e53a0b3..2ebfc36c4e 100644
--- a/components/libc/compilers/common/SConscript
+++ b/components/libc/compilers/common/SConscript
@@ -9,20 +9,17 @@ CPPPATH = [cwd]
if GetDepend('RT_USING_LIBC'):
src += Glob('*.c')
-else:
- if GetDepend('RT_LIBC_USING_TIME'):
- src += ['time.c']
-
-if GetDepend('RT_USING_POSIX') == False:
- SrcRemove(src, ['unistd.c'])
+ if GetDepend('RT_USING_POSIX') == False:
+ SrcRemove(src, ['unistd.c'])
+elif GetDepend('RT_LIBC_USING_TIME'):
+ src += ['time.c']
if rtconfig.CROSS_TOOL == 'keil':
CPPDEFINES = ['__CLK_TCK=RT_TICK_PER_SECOND']
else:
CPPDEFINES = []
-if GetDepend('RT_USING_LIBC') or GetDepend('RT_LIBC_USING_TIME'):
- group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
+group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
list = os.listdir(cwd)
for d in list:
diff --git a/components/libc/compilers/common/none-gcc/SConscript b/components/libc/compilers/common/none-gcc/SConscript
index c5838f8949..c766c8f82d 100644
--- a/components/libc/compilers/common/none-gcc/SConscript
+++ b/components/libc/compilers/common/none-gcc/SConscript
@@ -6,8 +6,10 @@ src = []
cwd = GetCurrentDir()
CPPPATH = [cwd]
group = []
-src += Glob('*.c')
+
+if GetDepend('RT_USING_LIBC'):
+ src += Glob('*.c')
if rtconfig.PLATFORM != 'gcc' or rtconfig.ARCH == 'sim':
- group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'], CPPPATH = CPPPATH)
+ group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH)
Return('group')
diff --git a/include/libc/libc_errno.h b/components/libc/compilers/common/none-gcc/sys/errno.h
index 30d6092e33..773c2cd7d3 100644
--- a/include/libc/libc_errno.h
+++ b/components/libc/compilers/common/none-gcc/sys/errno.h
@@ -5,18 +5,10 @@
*
* Change Logs:
* Date Author Notes
- * 2016-11-12 Bernard The first version
+ * 2021-05-22 Meco Man The first version.
*/
-
-#ifndef LIBC_ERRNO_H__
-#define LIBC_ERRNO_H__
-
-#include <rtconfig.h>
-
-#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
-/* use errno.h file in toolchains */
-#include <errno.h>
-#endif
+#ifndef _SYS_ERRNO_H
+#define _SYS_ERRNO_H
#if defined(__CC_ARM)
/*
@@ -29,6 +21,7 @@ defined in armcc/errno.h
#define EINVAL 5
#define ENOMEM 6
*/
+
#define ERROR_BASE_NO 7
#elif defined(__IAR_SYSTEMS_ICC__)
@@ -41,12 +34,11 @@ defined in armcc/errno.h
#define ERROR_BASE_NO 36
#else
-
#define ERROR_BASE_NO 0
#endif
-#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) && !(defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
-
+#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
+#include <errno.h>
#define EPERM (ERROR_BASE_NO + 1)
#define ENOENT (ERROR_BASE_NO + 2)
#define ESRCH (ERROR_BASE_NO + 3)
@@ -200,7 +192,6 @@ defined in armcc/errno.h
#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/compilers/newlib/minilib.c b/components/libc/compilers/newlib/minilib.c
index f6df38f67b..612554ca66 100644
--- a/components/libc/compilers/newlib/minilib.c
+++ b/components/libc/compilers/newlib/minilib.c
@@ -12,8 +12,9 @@
#include <rtthread.h>
#ifdef RT_USING_HEAP /* Memory routine */
-void *
-_malloc_r (struct _reent *ptr, size_t size)
+#include <sys/errno.h>
+
+void * _malloc_r (struct _reent *ptr, size_t size)
{
void* result;
@@ -26,8 +27,7 @@ _malloc_r (struct _reent *ptr, size_t size)
return result;
}
-void *
-_realloc_r (struct _reent *ptr, void *old, size_t newlen)
+void * _realloc_r (struct _reent *ptr, void *old, size_t newlen)
{
void* result;
@@ -53,15 +53,13 @@ void *_calloc_r (struct _reent *ptr, size_t size, size_t len)
return result;
}
-void
-_free_r (struct _reent *ptr, void *addr)
+void _free_r (struct _reent *ptr, void *addr)
{
rt_free (addr);
}
#else
-void *
-_sbrk_r(struct _reent *ptr, ptrdiff_t incr)
+void * _sbrk_r(struct _reent *ptr, ptrdiff_t incr)
{
return RT_NULL;
}
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/signal/posix_signal.c b/components/libc/signal/posix_signal.c
index b06fe12685..1cb561d428 100644
--- a/components/libc/signal/posix_signal.c
+++ b/components/libc/signal/posix_signal.c
@@ -10,7 +10,8 @@
#include <rthw.h>
#include <rtthread.h>
-#include <time.h>
+#include <sys/time.h>
+#include <sys/errno.h>
#include "posix_signal.h"
#define sig_valid(sig_no) (sig_no >= 0 && sig_no < RT_SIG_MAX)
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..c312f50df5 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
@@ -54,24 +54,18 @@ typedef uintptr_t mem_ptr_t;
#define S32_F "ld"
#define X32_F "lx"
-#ifdef RT_USING_LIBC
-#if !defined(__CC_ARM) && !defined(__IAR_SYSTEMS_ICC__)
-
+#include <sys/errno.h>
/* some errno not defined in newlib */
+#ifndef ENSRNOTFOUND
#define ENSRNOTFOUND 163 /* Domain name not found */
/* WARNING: ESHUTDOWN also not defined in newlib. We chose
180 here because the number "108" which is used
in arch.h has been assigned to another error code. */
-#define ESHUTDOWN 180
-#endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
#endif
-#if defined(RT_USING_LIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
+/* LWIP_TIMEVAL_PRIVATE: provided by <sys/time.h> */
#include <sys/time.h>
#define LWIP_TIMEVAL_PRIVATE 0
-#else
-#define LWIP_TIMEVAL_PRIVATE 1
-#endif
#if defined(__CC_ARM) /* ARMCC compiler */
#define PACK_STRUCT_FIELD(x) x
@@ -105,7 +99,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-1.4.1/src/lwipopts.h b/components/net/lwip-1.4.1/src/lwipopts.h
index a23a167970..0b7e092d6c 100644
--- a/components/net/lwip-1.4.1/src/lwipopts.h
+++ b/components/net/lwip-1.4.1/src/lwipopts.h
@@ -3,7 +3,7 @@
#include <rtconfig.h>
-#define ERRNO 1
+#define ERRNO
#define NO_SYS 0
#define LWIP_SOCKET 1
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..4829f5b2e5 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
@@ -45,12 +45,18 @@
#define S32_F "ld"
#define X32_F "lx"
-#if defined(RT_USING_LIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
+#include <sys/errno.h>
+/* some errno not defined in newlib */
+#ifndef ENSRNOTFOUND
+#define ENSRNOTFOUND 163 /* Domain name not found */
+/* WARNING: ESHUTDOWN also not defined in newlib. We chose
+ 180 here because the number "108" which is used
+ in arch.h has been assigned to another error code. */
+#endif
+
+/* LWIP_TIMEVAL_PRIVATE: provided by <sys/time.h> */
#include <sys/time.h>
#define LWIP_TIMEVAL_PRIVATE 0
-#else
-#define LWIP_TIMEVAL_PRIVATE 1
-#endif
#if defined(__CC_ARM) /* ARMCC compiler */
#define PACK_STRUCT_FIELD(x) x
@@ -84,7 +90,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..d559684c02 100644
--- a/components/net/lwip-2.0.2/src/lwipopts.h
+++ b/components/net/lwip-2.0.2/src/lwipopts.h
@@ -3,7 +3,7 @@
#include <rtconfig.h>
-#define ERRNO 1
+#define LWIP_ERRNO_STDINCLUDE
#define LWIP_IPV4 1
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..8e98013412 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
@@ -45,25 +45,18 @@
#define S32_F "ld"
#define X32_F "lx"
-#ifdef RT_USING_LIBC
-#include <errno.h>
+#include <sys/errno.h>
+/* some errno not defined in newlib */
#ifndef ENSRNOTFOUND
#define ENSRNOTFOUND 163 /* Domain name not found */
-#endif
-#ifndef ESHUTDOWN
/* WARNING: ESHUTDOWN also not defined in newlib. We chose
180 here because the number "108" which is used
in arch.h has been assigned to another error code. */
-#define ESHUTDOWN 180
#endif
-#endif /* RT_USING_LIBC */
-#if defined(RT_USING_LIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
+/* LWIP_TIMEVAL_PRIVATE: provided by <sys/time.h> */
#include <sys/time.h>
#define LWIP_TIMEVAL_PRIVATE 0
-#else
-#define LWIP_TIMEVAL_PRIVATE 1
-#endif
#if defined(__CC_ARM) /* ARMCC compiler */
#define PACK_STRUCT_FIELD(x) x
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..2cd7cb023a 100644
--- a/components/net/lwip-2.1.2/src/lwipopts.h
+++ b/components/net/lwip-2.1.2/src/lwipopts.h
@@ -3,8 +3,7 @@
#include <rtconfig.h>
-#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)
diff --git a/examples/libc/ex3.c b/examples/libc/ex3.c
index 1697e7145b..615ed8f35c 100644
--- a/examples/libc/ex3.c
+++ b/examples/libc/ex3.c
@@ -9,7 +9,7 @@
/* Multi-thread searching.
Illustrates: thread cancellation, cleanup handlers. */
-#include <errno.h>
+#include <sys/errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
diff --git a/examples/libc/ex6.c b/examples/libc/ex6.c
index ac6319d74c..ba687aa46f 100644
--- a/examples/libc/ex6.c
+++ b/examples/libc/ex6.c
@@ -6,7 +6,7 @@
* Change Logs:
* Date Author Notes
*/
-#include <errno.h>
+#include <sys/errno.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
diff --git a/examples/libc/ex7.c b/examples/libc/ex7.c
index e885f79c57..d1f05dbdcd 100644
--- a/examples/libc/ex7.c
+++ b/examples/libc/ex7.c
@@ -11,7 +11,7 @@
* Test case that illustrates a timed wait on a condition variable.
*/
-#include <errno.h>
+#include <sys/errno.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
diff --git a/examples/libc/file.c b/examples/libc/file.c
index 79cdce3092..878d3a98d7 100644
--- a/examples/libc/file.c
+++ b/examples/libc/file.c
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <finsh.h>
-#include <errno.h>
+#include <sys/errno.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
diff --git a/examples/libc/memory.c b/examples/libc/memory.c
index 063d90cfdc..4a31b69017 100644
--- a/examples/libc/memory.c
+++ b/examples/libc/memory.c
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <finsh.h>
-#include <errno.h>
+#include <sys/errno.h>
static int errors = 0;
static void merror(const char *msg)
diff --git a/include/libc/libc_limits.h b/include/libc/libc_limits.h
deleted file mode 100644
index 36b8dbb202..0000000000
--- a/include/libc/libc_limits.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2006-2021, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2020-09-05 Meco Man the first version
- */
-
-#ifndef LIBC_LIMITS_H__
-#define LIBC_LIMITS_H__
-
-#include <limits.h>
-#include <rtconfig.h>
-
-#ifdef RT_USING_POSIX
-
-#ifndef SSIZE_MAX
-# define SSIZE_MAX LONG_MAX
-#endif
-
-#endif
-
-#endif
diff --git a/include/rtlibc.h b/include/rtlibc.h
index 50bddc6ee8..a62051e157 100644
--- a/include/rtlibc.h
+++ b/include/rtlibc.h
@@ -13,14 +13,12 @@
/* definitions for libc if toolchain has no these definitions */
#include "libc/libc_stat.h"
-#include "libc/libc_errno.h"
#include "libc/libc_fcntl.h"
#include "libc/libc_ioctl.h"
#include "libc/libc_dirent.h"
#include "libc/libc_signal.h"
#include "libc/libc_fdset.h"
-#include "libc/libc_limits.h"
#include "libc/libc_stdio.h"
#ifndef RT_USING_LIBC