提交 0a799653 编写于 作者: mysterywolf's avatar mysterywolf

[libc][syscalls]将在libc初始化之前调用printf的行为下调为警告级别

上级 37d4abb8
......@@ -152,8 +152,8 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode)
#ifdef RT_USING_POSIX
if (libc_stdio_get_console() < 0)
{
LOG_E("invoke standard output before initializing libc");
return -1;
LOG_W("Do not invoke standard output before initializing libc");
return 0;
}
size = read(STDIN_FILENO, buf, len);
return len - size;
......@@ -197,8 +197,8 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode)
#ifdef RT_USING_POSIX
if (libc_stdio_get_console() < 0)
{
LOG_E("invoke standard input before initializing libc");
return -1;
LOG_W("Do not invoke standard input before initializing libc");
return 0;
}
size = write(STDOUT_FILENO, buf, len);
return len - size;
......
......@@ -31,8 +31,8 @@ size_t __read(int handle, unsigned char *buf, size_t len)
#ifdef RT_USING_POSIX
if (libc_stdio_get_console() < 0)
{
LOG_E("invoke standard input before initializing libc");
return _LLIO_ERROR;
LOG_W("Do not invoke standard input before initializing libc");
return 0;
}
return read(STDIN_FILENO, buf, len);
#else
......
......@@ -36,8 +36,8 @@ size_t __write(int handle, const unsigned char *buf, size_t len)
#ifdef RT_USING_POSIX
if (libc_stdio_get_console() < 0)
{
LOG_E("invoke standard output before initializing libc");
return _LLIO_ERROR;
LOG_W("Do not invoke standard output before initializing libc");
return 0;
}
return write(STDOUT_FILENO, (void*)buf, len);
#else
......
......@@ -227,8 +227,8 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes)
_ssize_t rc;
if (libc_stdio_get_console() < 0 && fd == STDIN_FILENO)
{
LOG_E("invoke standard input before initializing libc");
return -1;
LOG_W("Do not invoke standard input before initializing libc");
return 0;
}
rc = read(fd, buf, nbytes);
return rc;
......@@ -303,8 +303,8 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
_ssize_t rc;
if (libc_stdio_get_console() < 0 && fd == STDOUT_FILENO)
{
LOG_E("invoke standard output before initializing libc");
return -1;
LOG_W("Do not invoke standard output before initializing libc");
return 0;
}
rc = write(fd, buf, nbytes);
return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册