From 99e5c8e046dfff53c331eb35394bfbcab4629fd0 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Fri, 17 Nov 2023 21:24:33 +0100 Subject: Kernel: Add isatty syscall --- kernel/syscalls/isatty.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 kernel/syscalls/isatty.c (limited to 'kernel/syscalls/isatty.c') diff --git a/kernel/syscalls/isatty.c b/kernel/syscalls/isatty.c new file mode 100644 index 0000000..64649e2 --- /dev/null +++ b/kernel/syscalls/isatty.c @@ -0,0 +1,12 @@ +#include +#include +#include + +int syscall_isatty(int fd) { + vfs_fd_t *fd_ptr = get_vfs_fd(fd); + if (!fd_ptr) + return -EBADF; + if (!fd_ptr->is_tty) + return -ENOTTY; + return 1; +} -- cgit v1.2.3