diff options
author | Anton Kling <anton@kling.gg> | 2023-11-17 21:24:33 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-17 21:27:26 +0100 |
commit | 99e5c8e046dfff53c331eb35394bfbcab4629fd0 (patch) | |
tree | 690994f164306688bfb3346f218c79301c0f0452 /kernel/syscalls | |
parent | 6723c96863425bda541e321127f6944bf008446a (diff) |
Kernel: Add isatty syscall
Diffstat (limited to 'kernel/syscalls')
-rw-r--r-- | kernel/syscalls/isatty.c | 12 |
1 files changed, 12 insertions, 0 deletions
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 <fs/vfs.h> +#include <syscalls.h> +#include <errno.h> + +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; +} |