Browse Source

[libc] Fix the _EXFUN issue in newlib

Bernard Xiong 6 years ago
parent
commit
e108dfe4a5
3 changed files with 14 additions and 12 deletions
  1. 3 1
      components/dfs/include/dfs_posix.h
  2. 2 2
      components/dfs/src/dfs_posix.c
  3. 9 9
      include/libc/libc_signal.h

+ 3 - 1
components/dfs/include/dfs_posix.h

@@ -41,13 +41,15 @@ int closedir(DIR* d);
 /* file api*/
 int open(const char *file, int flags, ...);
 int close(int d);
-#ifdef RT_USING_NEWLIB
+
+#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
 _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte));
 _READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte));
 #else
 int read(int fd, void *buf, size_t len);
 int write(int fd, const void *buf, size_t len);
 #endif
+
 off_t lseek(int fd, off_t offset, int whence);
 int rename(const char *from, const char *to);
 int unlink(const char *pathname);

+ 2 - 2
components/dfs/src/dfs_posix.c

@@ -110,7 +110,7 @@ RTM_EXPORT(close);
  * @return the actual read data buffer length. If the returned value is 0, it
  * may be reach the end of file, please check errno.
  */
-#ifdef RT_USING_NEWLIB
+#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
 _READ_WRITE_RETURN_TYPE _EXFUN(read, (int fd, void *buf, size_t len))
 #else
 int read(int fd, void *buf, size_t len)
@@ -154,7 +154,7 @@ RTM_EXPORT(read);
  *
  * @return the actual written data buffer length.
  */
-#ifdef RT_USING_NEWLIB
+#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
 _READ_WRITE_RETURN_TYPE _EXFUN(write, (int fd, const void *buf, size_t len))
 #else
 int write(int fd, const void *buf, size_t len)

+ 9 - 9
include/libc/libc_signal.h

@@ -76,20 +76,20 @@ typedef struct siginfo siginfo_t;
 typedef unsigned long sigset_t;
 
 #define SIGHUP       1
-// #define SIGINT       2
+/* #define SIGINT       2 */
 #define SIGQUIT      3
-// #define SIGILL       4
+/* #define SIGILL       4 */
 #define SIGTRAP      5
-// #define SIGABRT      6
+/* #define SIGABRT      6 */
 #define SIGEMT       7
-// #define SIGFPE       8
+/* #define SIGFPE       8 */
 #define SIGKILL      9
 #define SIGBUS      10
-// #define SIGSEGV     11
+/* #define SIGSEGV     11 */
 #define SIGSYS      12
 #define SIGPIPE     13
 #define SIGALRM     14
-// #define SIGTERM     15
+/* #define SIGTERM     15 */
 #define SIGURG      16
 #define SIGSTOP     17
 #define SIGTSTP     18
@@ -99,8 +99,8 @@ typedef unsigned long sigset_t;
 #define SIGTTOU     22
 #define SIGPOLL     23
 #define SIGWINCH    24
-// #define SIGUSR1     25
-// #define SIGUSR2     26
+/* #define SIGUSR1     25 */
+/* #define SIGUSR2     26 */
 #define SIGRTMIN    27
 #define SIGRTMAX    31
 #define NSIG        32
@@ -136,7 +136,7 @@ typedef unsigned long sigset_t;
 #define SIGQUIT      3
 #define SIGILL       4
 #define SIGTRAP      5
-// #define SIGABRT      6
+/* #define SIGABRT      6 */
 #define SIGEMT       7
 #define SIGFPE       8
 #define SIGKILL      9