mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-10-18 18:34:20 +08:00
[libc][syscall]移除libc_stdio_read/write函数,优化syscall
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#define STDIO_DEVICE_NAME_MAX 32
|
||||
|
||||
static int std_fd = -1;
|
||||
|
||||
int libc_stdio_set_console(const char* device_name, int mode)
|
||||
{
|
||||
int fd;
|
||||
@@ -47,29 +48,4 @@ int libc_stdio_get_console(void)
|
||||
return std_fd;
|
||||
}
|
||||
|
||||
int libc_stdio_read(void *buffer, size_t size)
|
||||
{
|
||||
if (std_fd >= 0)
|
||||
{
|
||||
return read(std_fd, buffer, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("Illegal stdio input!\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int libc_stdio_write(const void *buffer, size_t size)
|
||||
{
|
||||
if (std_fd >= 0)
|
||||
{
|
||||
return write(std_fd, buffer, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("Illegal stdio output!\n");
|
||||
return size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user