From 8dd11ae717c2b720c3108805d3fb4bcae0d3b6f9 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Sun, 12 Dec 2021 13:01:13 +0100 Subject: Kernel+SystemServer: Add /dev/tty This file refers to the controlling terminal associated with the current process. It's specified by POSIX, and is used by ports like openssh to interface with the terminal even if the standard input/output is redirected to somewhere else. Our implementation leverages ProcFS's existing facilities to create process-specific symbolic links. In our setup, `/dev/tty` is a symbolic link to `/proc/self/tty`, which itself is a symlink to the appropriate `/dev/pts` entry. If no TTY is attached, `/dev/tty` is left dangling. --- Userland/Services/SystemServer/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Userland') diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index 962394865b..1b020eea60 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -363,6 +363,11 @@ static void prepare_synthetic_filesystems() VERIFY_NOT_REACHED(); } + rc = symlink("/proc/self/tty", "/dev/tty"); + if (rc < 0) { + VERIFY_NOT_REACHED(); + } + populate_devfs(); rc = mkdir("/dev/pts", 0755); -- cgit v1.2.3