summaryrefslogtreecommitdiff
path: root/src/kernel/fd.c
diff options
context:
space:
mode:
authordzwdz2021-08-25 14:49:58 +0200
committerdzwdz2021-08-25 14:49:58 +0200
commit0da663e05c93f2791d7166ece8d69a1be06a7924 (patch)
tree05dd2c16b04a3fd2e6ecf491da217b2686d8ec35 /src/kernel/fd.c
parentab5150478dd14c1c5b28ca50b36b35e8224df54b (diff)
implement open() for FD_SPECIAL_TTY (`/tty`)
Diffstat (limited to 'src/kernel/fd.c')
-rw-r--r--src/kernel/fd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/kernel/fd.c b/src/kernel/fd.c
index 810cdb7..e875061 100644
--- a/src/kernel/fd.c
+++ b/src/kernel/fd.c
@@ -24,6 +24,16 @@ static int fdop_special_tty(struct fdop_args *args) {
case FDOP_MOUNT:
return 0; // no special action needed
+ case FDOP_OPEN:
+ /* don't allow anything after the mount point
+ * this is a file, not a directory
+ * for example: open("/tty") is allowed. open("/tty/smth") isn't */
+ if (args->open.len == 0) {
+ args->open.target->type = FD_SPECIAL_TTY;
+ return 0;
+ }
+ return -1;
+
case FDOP_READ:
return -1; // input not implemented yet