mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-27 01:28:23 +00:00
sync branch rt-smart. (#6641)
* Synchronize the code of the rt mart branch to the master branch.
* TTY device
* Add lwP code from rt-smart
* Add vnode in DFS, but DFS will be re-write for rt-smart
* There are three libcpu for rt-smart:
* arm/cortex-a, arm/aarch64
* riscv64
Co-authored-by: Rbb666 <zhangbingru@rt-thread.com>
Co-authored-by: zhkag <zhkag@foxmail.com>
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
#define STDIO_DEVICE_NAME_MAX 32
|
||||
|
||||
int sys_dup2(int oldfd, int new);
|
||||
|
||||
int libc_system_init(void)
|
||||
{
|
||||
#ifdef RT_USING_POSIX_STDIO
|
||||
@@ -28,7 +30,15 @@ int libc_system_init(void)
|
||||
dev_console = rt_console_get_device();
|
||||
if (dev_console)
|
||||
{
|
||||
libc_stdio_set_console(dev_console->parent.name, O_RDWR);
|
||||
int fd = libc_stdio_set_console(dev_console->parent.name, O_RDWR);
|
||||
if (fd < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
/* set fd (0, 1, 2) */
|
||||
sys_dup2(fd, 0);
|
||||
sys_dup2(fd, 1);
|
||||
sys_dup2(fd, 2);
|
||||
}
|
||||
#endif /* RT_USING_POSIX_STDIO */
|
||||
return 0;
|
||||
@@ -112,7 +122,6 @@ int libc_stdio_get_console(void)
|
||||
#elif defined(RT_USING_POSIX_STDIO) && defined(RT_USING_MUSLLIBC)
|
||||
|
||||
static FILE* std_console = NULL;
|
||||
int sys_dup2(int oldfd, int new);
|
||||
|
||||
int libc_stdio_set_console(const char* device_name, int mode)
|
||||
{
|
||||
@@ -144,10 +153,6 @@ int libc_stdio_set_console(const char* device_name, int mode)
|
||||
{
|
||||
int fd = fileno(std_console);
|
||||
|
||||
// /* set fd (0, 1, 2) */
|
||||
// sys_dup2(fd, 0);
|
||||
// sys_dup2(fd, 1);
|
||||
// sys_dup2(fd, 2);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user