summaryrefslogtreecommitdiff
path: root/components/libc/compilers/gcc
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-11-07 21:40:19 -0500
committerMeco Man <[email protected]>2021-11-07 23:41:16 -0500
commitf8388c572ef9969105b895cba3c55ba8d24efeda (patch)
treeae71b5dace91c0217740a80eb8a7d99133f1e088 /components/libc/compilers/gcc
parent251e17b41ac56a877e0278394588aa6b129b66b1 (diff)
add RT_USING_POSIX_STDIO
Diffstat (limited to 'components/libc/compilers/gcc')
-rw-r--r--components/libc/compilers/gcc/newlib/syscalls.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/components/libc/compilers/gcc/newlib/syscalls.c b/components/libc/compilers/gcc/newlib/syscalls.c
index f95e695a85..e957aaf003 100644
--- a/components/libc/compilers/gcc/newlib/syscalls.c
+++ b/components/libc/compilers/gcc/newlib/syscalls.c
@@ -20,7 +20,7 @@
#include <unistd.h>
#include <sys/errno.h>
#include <sys/stat.h>
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_STDIO
#include "libc.h"
#endif
#ifdef RT_USING_MODULE
@@ -216,7 +216,7 @@ int _open_r(struct _reent *ptr, const char *file, int flags, int mode)
_ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes)
{
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_STDIO
_ssize_t rc;
if (libc_stdio_get_console() < 0 && fd == STDIN_FILENO)
{
@@ -271,11 +271,13 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
{
#ifdef RT_USING_POSIX
_ssize_t rc;
+#ifdef RT_USING_POSIX_STDIO
if (libc_stdio_get_console() < 0 && fd == STDOUT_FILENO)
{
LOG_W("Do not invoke standard output before initializing libc");
return 0;
}
+#endif /* RT_USING_POSIX_STDIO */
rc = write(fd, buf, nbytes);
return rc;
#elif defined(RT_USING_CONSOLE)