From 6eb62a3f9de3e45abe91fec03ff45f1a011f48bd Mon Sep 17 00:00:00 2001 From: mysterywolf <920369182@qq.com> Date: Sat, 5 Sep 2020 17:50:54 +0800 Subject: 将unistd.c不再放在common中,分散到各个库中 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/unistd.c | 29 +++++++++++++++++++++++++++++ components/libc/compilers/common/unistd.c | 25 ------------------------- components/libc/compilers/dlib/unistd.c | 29 +++++++++++++++++++++++++++++ components/libc/compilers/newlib/unistd.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 25 deletions(-) create mode 100644 components/libc/compilers/armlibc/unistd.c delete mode 100644 components/libc/compilers/common/unistd.c create mode 100644 components/libc/compilers/dlib/unistd.c create mode 100644 components/libc/compilers/newlib/unistd.c (limited to 'components') diff --git a/components/libc/compilers/armlibc/unistd.c b/components/libc/compilers/armlibc/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/armlibc/unistd.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include +#include + +#ifdef RT_USING_POSIX + +#ifdef RT_USING_POSIX_TERMIOS +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} + +#endif diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c deleted file mode 100644 index 04a0886655..0000000000 --- a/components/libc/compilers/common/unistd.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-09-01 Meco Man First Version - */ - -#include -#include - -#ifdef RT_USING_POSIX_TERMIOS -int isatty(int fd) -{ - struct termios ts; - return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ -} -#endif - -char *ttyname(int fd) -{ - return "/dev/tty0"; /*TODO: need to add more specific*/ -} diff --git a/components/libc/compilers/dlib/unistd.c b/components/libc/compilers/dlib/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/dlib/unistd.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include +#include + +#ifdef RT_USING_POSIX + +#ifdef RT_USING_POSIX_TERMIOS +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} + +#endif diff --git a/components/libc/compilers/newlib/unistd.c b/components/libc/compilers/newlib/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/newlib/unistd.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include +#include + +#ifdef RT_USING_POSIX + +#ifdef RT_USING_POSIX_TERMIOS +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} + +#endif -- cgit v1.3.1