diff options
| author | Meco Man <[email protected]> | 2021-11-12 16:47:32 -0500 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2021-11-12 16:47:32 -0500 |
| commit | 3a3b7ee63288456a7e80e42a3480ea19d4bd645b (patch) | |
| tree | 063c61781f83e477a5fb98dab2717be52ac036a8 /components/libc/compilers/dlib/syscall_read.c | |
| parent | cb8d5c5d9d3fed61114ed1824b6f0615c31e86c3 (diff) | |
完善IAR KEIL的read write桩函数
Diffstat (limited to 'components/libc/compilers/dlib/syscall_read.c')
| -rw-r--r-- | components/libc/compilers/dlib/syscall_read.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/components/libc/compilers/dlib/syscall_read.c b/components/libc/compilers/dlib/syscall_read.c index c926c577b5..0df9766df2 100644 --- a/components/libc/compilers/dlib/syscall_read.c +++ b/components/libc/compilers/dlib/syscall_read.c @@ -9,7 +9,7 @@ */ #include <rtthread.h> -#include <yfuns.h> +#include <LowLevelIOInterface.h> #include <unistd.h> #ifdef RT_USING_POSIX_STDIO #include "libc.h" @@ -22,17 +22,21 @@ #pragma module_name = "?__read" size_t __read(int handle, unsigned char *buf, size_t len) { -#ifdef RT_USING_POSIX_STDIO +#ifdef RT_USING_POSIX int size; if (handle == _LLIO_STDIN) { +#ifdef RT_USING_POSIX_STDIO if (libc_stdio_get_console() < 0) { LOG_W("Do not invoke standard input before initializing libc"); - return 0; + return 0; /* error, but keep going */ } - return read(STDIN_FILENO, buf, len); + return read(STDIN_FILENO, buf, len); /* return the length of the data read */ +#else + return _LLIO_ERROR; +#endif /* RT_USING_POSIX_STDIO */ } else if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR)) { @@ -40,7 +44,7 @@ size_t __read(int handle, unsigned char *buf, size_t len) } size = read(handle, buf, len); - return size; + return size; /* return the length of the data read */ #else return _LLIO_ERROR; #endif /* RT_USING_POSIX */ |
