Skip to content

Commit b84a0fe

Browse files
evgeniy-paltsevgalak
authored andcommitted
ARC: MWDT: LIB: implement _istty hook
Implement _istty hook as it is required for proper setup of STDIN/STDOUT/STDERR buffering. Signed-off-by: Eugeniy Paltsev <[email protected]> Signed-off-by: Evgeniy Paltsev <[email protected]>
1 parent cfed642 commit b84a0fe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/libc/arcmwdt/libc-hooks.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <syscall_handler.h>
1111
#include <string.h>
1212
#include <sys/errno_private.h>
13+
#include <unistd.h>
1314
#include <errno.h>
1415

1516
static int _stdout_hook_default(int c)
@@ -58,6 +59,19 @@ int _write(int fd, const char *buf, unsigned int nbytes)
5859
}
5960
#endif
6061

62+
/*
63+
* It's require to implement _isatty to have STDIN/STDOUT/STDERR buffered
64+
* properly.
65+
*/
66+
int _isatty(int file)
67+
{
68+
if (file == STDIN_FILENO || file == STDOUT_FILENO || file == STDERR_FILENO) {
69+
return 1;
70+
}
71+
72+
return 0;
73+
}
74+
6175
int *___errno(void)
6276
{
6377
return z_errno();

0 commit comments

Comments
 (0)