summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2021-12-12 13:01:13 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-12 22:32:35 +0100
commit8dd11ae717c2b720c3108805d3fb4bcae0d3b6f9 (patch)
treeff7414bdaa7c9df883fc06be71bc2d26c4d07639 /Userland
parent7ca23156592b6abc0f6d40e96364170f3f90b05a (diff)
downloadserenity-8dd11ae717c2b720c3108805d3fb4bcae0d3b6f9.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Services/SystemServer/main.cpp5
1 files changed, 5 insertions, 0 deletions
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);