diff --git a/components/libc/compilers/armlibc/fcntl.h b/components/libc/compilers/armlibc/fcntl.h index 80cf1b440910ca4bc57e64621eb3f025d783ef17..3e650a8471b6095e97363138316b624dca07498b 100644 --- a/components/libc/compilers/armlibc/fcntl.h +++ b/components/libc/compilers/armlibc/fcntl.h @@ -9,6 +9,8 @@ #ifndef FCNTL_H__ #define FCNTL_H__ +#include + #ifdef RT_USING_DFS #include #endif diff --git a/components/libc/compilers/armlibc/sys/ioctl.h b/components/libc/compilers/armlibc/sys/ioctl.h new file mode 100644 index 0000000000000000000000000000000000000000..033a57014a0491d21290d79264311704721c9fea --- /dev/null +++ b/components/libc/compilers/armlibc/sys/ioctl.h @@ -0,0 +1,15 @@ +/* + * 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 + */ +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + + + +#endif diff --git a/components/libc/compilers/armlibc/sys/unistd.h b/components/libc/compilers/armlibc/sys/unistd.h index 33f0561e7260f01c8e08fd4969bb929bd06ac99d..3199b01e0eaf69439f9103a7ca9ee449f96d66bb 100644 --- a/components/libc/compilers/armlibc/sys/unistd.h +++ b/components/libc/compilers/armlibc/sys/unistd.h @@ -46,4 +46,8 @@ #define O_SYNC _FSYNC #endif + +int isatty (int fd); +char * ttyname (int desc); + #endif /* _SYS_UNISTD_H */ diff --git a/components/libc/compilers/armlibc/unistd.h b/components/libc/compilers/armlibc/unistd.h index 70187722d88c1b6fe288ec79b2faaac6b8877f9c..736fc219a8ea149000c712f1ef741cb8e87a91a5 100644 --- a/components/libc/compilers/armlibc/unistd.h +++ b/components/libc/compilers/armlibc/unistd.h @@ -7,3 +7,4 @@ * Date Author Notes */ #include "sys/unistd.h" + diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c new file mode 100644 index 0000000000000000000000000000000000000000..04a0886655d37002a8fe943c7940c01cc51af9ec --- /dev/null +++ b/components/libc/compilers/common/unistd.c @@ -0,0 +1,25 @@ +/* + * 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/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h index 29f68f24f8288728d3521c2f2c2c92cb5a5e478f..9564daba8d261fb684b9745411cbbb5b06b04aac 100644 --- a/components/libc/compilers/dlib/sys/unistd.h +++ b/components/libc/compilers/dlib/sys/unistd.h @@ -36,4 +36,8 @@ #endif + +int isatty (int fd); +char * ttyname (int desc); + #endif /* _SYS_UNISTD_H */ diff --git a/components/libc/termios/posix_termios.c b/components/libc/termios/posix_termios.c index 75c876dd33ad759b044cd99e8a246436fcf9efc9..9c736c3184bed6f03c31c62fb02142abb0dbc3cb 100644 --- a/components/libc/termios/posix_termios.c +++ b/components/libc/termios/posix_termios.c @@ -5,7 +5,7 @@ * * Change Logs: * Date Author Notes - * 2017/08/30 Bernard The first version + * 2017/08/30 Bernard The first version */ #include #include @@ -111,13 +111,6 @@ int tcdrain(int fd) return 0; } -int isatty (int fd) -{ - struct termios term; - - return tcgetattr (fd, &term) == 0; -} - #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) void cfmakeraw(struct termios *t) { diff --git a/components/libc/termios/posix_termios.h b/components/libc/termios/posix_termios.h index 6d4be129ffcfda2873254b8c132269ed2dfb8510..c61191b7dcf5d6b0980e6f502f4f7520487d01ff 100644 --- a/components/libc/termios/posix_termios.h +++ b/components/libc/termios/posix_termios.h @@ -5,13 +5,13 @@ * * Change Logs: * Date Author Notes - * 2017/08/30 Bernard The first version + * 2017/08/30 Bernard The first version */ #ifndef TERMIOS_H__ #define TERMIOS_H__ #include -#include +#include #ifdef __cplusplus extern "C" {