From 3bf57e07486d513d31debd85949c3c003849251f Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 7 Dec 2024 01:37:40 +0200 Subject: [PATCH] Kernel: Add . and .. entries to /proc/ directories This allows to run `cd ..` in one of these directories --- kernel/kernel/FS/ProcFS/Inode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/kernel/FS/ProcFS/Inode.cpp b/kernel/kernel/FS/ProcFS/Inode.cpp index 4fe4465c..66d3fe28 100644 --- a/kernel/kernel/FS/ProcFS/Inode.cpp +++ b/kernel/kernel/FS/ProcFS/Inode.cpp @@ -12,6 +12,8 @@ namespace Kernel return BAN::Error::from_errno(ENOMEM); auto inode = BAN::RefPtr::adopt(inode_ptr); + TRY(inode->link_inode(*inode, "."_sv)); + TRY(inode->link_inode(static_cast(*fs.root_inode()), ".."_sv)); TRY(inode->link_inode(*MUST(ProcROProcessInode::create_new(process, &Process::proc_meminfo, fs, 0400)), "meminfo"_sv)); TRY(inode->link_inode(*MUST(ProcROProcessInode::create_new(process, &Process::proc_cmdline, fs, 0400)), "cmdline"_sv)); TRY(inode->link_inode(*MUST(ProcROProcessInode::create_new(process, &Process::proc_environ, fs, 0400)), "environ"_sv));