1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

Kernel: Add a way to print the pseudo name of attached TTY of a process

Contrary to the past, we don't attempt to assume the real name of a TTY
device, but instead, we generate a pseudo name only when needed to do so
which is still OK because we don't break abstraction layer rules and we
still can provide userspace with the required information.
This commit is contained in:
Liav A 2022-03-26 09:06:30 +03:00 committed by Andreas Kling
parent 1e23fd94b1
commit 7053d7ece3
6 changed files with 20 additions and 0 deletions

View file

@ -495,6 +495,12 @@ private:
TRY(process_object.add("uid", process.uid().value()));
TRY(process_object.add("gid", process.gid().value()));
TRY(process_object.add("ppid", process.ppid().value()));
if (process.tty()) {
auto tty_pseudo_name = TRY(process.tty()->pseudo_name());
TRY(process_object.add("tty", tty_pseudo_name->view()));
} else {
TRY(process_object.add("tty", ""));
}
TRY(process_object.add("nfds", process.fds().with_shared([](auto& fds) { return fds.open_count(); })));
TRY(process_object.add("name", process.name()));
TRY(process_object.add("executable", process.executable() ? TRY(process.executable()->try_serialize_absolute_path())->view() : ""sv));