From 0da663e05c93f2791d7166ece8d69a1be06a7924 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 25 Aug 2021 14:49:58 +0200 Subject: implement open() for FD_SPECIAL_TTY (`/tty`) --- src/kernel/fd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/kernel/fd.c') 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 -- cgit v1.2.3