diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 393f93a58a3..1320d5ddaef 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -1845,6 +1845,8 @@ int Process::sys$fcntl(int fd, int cmd, u32 arg) case F_SETFL: description->set_file_flags(arg); break; + case F_ISTTY: + return description->is_tty(); default: return -EINVAL; } diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h index a8923b20324..c9197931e94 100644 --- a/Kernel/UnixTypes.h +++ b/Kernel/UnixTypes.h @@ -74,6 +74,7 @@ #define F_SETFD 2 #define F_GETFL 3 #define F_SETFL 4 +#define F_ISTTY 5 #define FD_CLOEXEC 1 diff --git a/Libraries/LibC/fcntl.h b/Libraries/LibC/fcntl.h index d56dae85f52..1aa6e6cd09a 100644 --- a/Libraries/LibC/fcntl.h +++ b/Libraries/LibC/fcntl.h @@ -36,6 +36,7 @@ __BEGIN_DECLS #define F_SETFD 2 #define F_GETFL 3 #define F_SETFL 4 +#define F_ISTTY 5 #define FD_CLOEXEC 1 diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp index 652eaabe43c..ec01ad1be4d 100644 --- a/Libraries/LibC/unistd.cpp +++ b/Libraries/LibC/unistd.cpp @@ -413,8 +413,7 @@ int rmdir(const char* pathname) int isatty(int fd) { - struct termios dummy; - return tcgetattr(fd, &dummy) == 0; + return fcntl(fd, F_ISTTY); } int dup(int old_fd)