summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-11-10 17:56:43 +0800
committerGitHub <[email protected]>2018-11-10 17:56:43 +0800
commit02f006d83f4438e209fdff4327037869787ec72d (patch)
treee416b6f1a80ff3245148e3ac27983a888854ec5f /components
parentb69baa965809420fc3fcd19dd55fc1126a68c08d (diff)
parente108dfe4a521355c454cf4d61b4297840264080b (diff)
Merge pull request #1964 from RT-Thread/fix_exfun
[libc] Fix the _EXFUN issue in newlib
Diffstat (limited to 'components')
-rw-r--r--components/dfs/include/dfs_posix.h4
-rw-r--r--components/dfs/src/dfs_posix.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h
index 79607fc8b4..bc8ff1c698 100644
--- a/components/dfs/include/dfs_posix.h
+++ b/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);
diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c
index 59acde1f8c..97531ad59c 100644
--- a/components/dfs/src/dfs_posix.c
+++ b/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)