summaryrefslogtreecommitdiff
path: root/components/libc/compilers/dlib/syscall_write.c
diff options
context:
space:
mode:
authorguo <[email protected]>2021-10-27 12:22:35 +0800
committerGitHub <[email protected]>2021-10-27 12:22:35 +0800
commit4d256eb308f4e9f7abc1644dda3fd675e560d518 (patch)
tree4da0b0458ca8749c4fcee2ede8681304641ba89d /components/libc/compilers/dlib/syscall_write.c
parent31bf735d2159995358315036be1529523ac96d7d (diff)
parenta9910a780edc43df6b64bcd13c37785a15ec3428 (diff)
Merge pull request #5228 from mysterywolf/posix
Diffstat (limited to 'components/libc/compilers/dlib/syscall_write.c')
-rw-r--r--components/libc/compilers/dlib/syscall_write.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/components/libc/compilers/dlib/syscall_write.c b/components/libc/compilers/dlib/syscall_write.c
index ffee51882d..af47d64a3e 100644
--- a/components/libc/compilers/dlib/syscall_write.c
+++ b/components/libc/compilers/dlib/syscall_write.c
@@ -9,10 +9,8 @@
*/
#include <rtthread.h>
-#ifdef RT_USING_DFS
-#include <dfs_posix.h>
-#endif
#include <yfuns.h>
+#include <unistd.h>
#include "libc.h"
#define DBG_TAG "dlib.syscall_write"
@@ -23,24 +21,20 @@
size_t __write(int handle, const unsigned char *buf, size_t len)
{
-#ifdef RT_USING_DFS
+#ifdef RT_LIBC_USING_FILEIO
int size;
-#endif
+#endif /* RT_LIBC_USING_FILEIO */
if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR))
{
-#ifndef RT_USING_CONSOLE
- return _LLIO_ERROR;
-#else
-
-#ifdef RT_USING_POSIX
+#ifdef RT_LIBC_USING_FILEIO
if (libc_stdio_get_console() < 0)
{
LOG_W("Do not invoke standard output before initializing libc");
return 0;
}
return write(STDOUT_FILENO, (void*)buf, len);
-#else
+#elif defined(RT_USING_CONSOLE)
rt_device_t console_device;
console_device = rt_console_get_device();
@@ -50,19 +44,19 @@ size_t __write(int handle, const unsigned char *buf, size_t len)
}
return len;
-#endif
-#endif
+#else
+ return _LLIO_ERROR;
+#endif /* RT_LIBC_USING_FILEIO */
}
else if (handle == _LLIO_STDIN)
{
return _LLIO_ERROR;
}
-#ifndef RT_USING_DFS
- return _LLIO_ERROR;
-#else
+#ifdef RT_LIBC_USING_FILEIO
size = write(handle, buf, len);
return size;
-#endif
+#else
+ return _LLIO_ERROR;
+#endif /* RT_LIBC_USING_FILEIO */
}
-