feat: update isatty libc function to use SYS_TERMINAL_ATTACHED syscall

This commit is contained in:
2026-08-28 09:14:02 +02:00
parent c8264b92a9
commit dac12c22cd
+4 -1
View File
@@ -103,6 +103,7 @@ static inline long _zos_syscall4(long nr, long a1, long a2, long a3, long a4) {
#define SYS_GETMILLISECONDS 14 #define SYS_GETMILLISECONDS 14
#define SYS_GETCHAR 18 #define SYS_GETCHAR 18
#define SYS_GETCHAR_NB 166 #define SYS_GETCHAR_NB 166
#define SYS_TERMINAL_ATTACHED 177
#define SYS_SPAWN 20 #define SYS_SPAWN 20
#define SYS_WAITPID 23 #define SYS_WAITPID 23
#define SYS_GETARGS 25 #define SYS_GETARGS 25
@@ -2470,7 +2471,9 @@ char *getcwd(char *buf, size_t size) {
} }
int isatty(int fd) { int isatty(int fd) {
return fd >= 0 && fd <= 2; if (fd < STDIN_FILENO || fd > STDERR_FILENO)
return 0;
return _zos_syscall0(SYS_TERMINAL_ATTACHED) != 0;
} }
/* ======================================================================== /* ========================================================================