瀏覽代碼

Merge pull request #2567 from zhaojuntao/fix-libc&errno

Fix libc&errno
Bernard Xiong 6 年之前
父節點
當前提交
16e8f34e46

+ 8 - 0
components/libc/compilers/newlib/syscalls.c

@@ -27,6 +27,14 @@
 
 
 /* Reentrant versions of system calls.  */
 /* Reentrant versions of system calls.  */
 
 
+#ifndef _REENT_ONLY
+int *
+__errno ()
+{
+  return _rt_errno();
+}
+#endif
+
 int
 int
 _close_r(struct _reent *ptr, int fd)
 _close_r(struct _reent *ptr, int fd)
 {
 {

+ 2 - 6
components/net/lwip-1.4.1/src/arch/include/arch/cc.h

@@ -55,10 +55,8 @@ typedef uintptr_t mem_ptr_t;
 #define X32_F "lx"
 #define X32_F "lx"
 
 
 #ifdef RT_USING_LIBC
 #ifdef RT_USING_LIBC
-#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
-#include <sys/errno.h>
-#else
-#include <errno.h>
+#if !defined(__CC_ARM) && !defined(__IAR_SYSTEMS_ICC__)
+
 /* some errno not defined in newlib */
 /* some errno not defined in newlib */
 #define ENSRNOTFOUND 163  /* Domain name not found */
 #define ENSRNOTFOUND 163  /* Domain name not found */
 /* WARNING: ESHUTDOWN also not defined in newlib. We chose
 /* WARNING: ESHUTDOWN also not defined in newlib. We chose
@@ -66,8 +64,6 @@ typedef uintptr_t mem_ptr_t;
 			in arch.h has been assigned to another error code. */
 			in arch.h has been assigned to another error code. */
 #define ESHUTDOWN 180
 #define ESHUTDOWN 180
 #endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
 #endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
-#else
-#define LWIP_PROVIDE_ERRNO
 #endif
 #endif
 
 
 #if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC)
 #if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC)

+ 1 - 1
include/libc/libc_errno.h

@@ -13,7 +13,7 @@
 
 
 #include <rtconfig.h>
 #include <rtconfig.h>
 
 
-#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
+#if defined(RT_USING_NEWLIB) || defined(_WIN32)
 /* use errno.h file in toolchains */
 /* use errno.h file in toolchains */
 #include <errno.h>
 #include <errno.h>
 #endif
 #endif