diff --git a/posix/subsystem/src/procfs.cpp b/posix/subsystem/src/procfs.cpp index d2fbb892f..1e4742644 100644 --- a/posix/subsystem/src/procfs.cpp +++ b/posix/subsystem/src/procfs.cpp @@ -234,6 +234,7 @@ std::shared_ptr DirectoryNode::createRootDirectory() { the_node->_entries.insert(std::move(self_thread_link)); the_node->directMkregular("uptime", std::make_shared()); + the_node->directMkregular("filesystems", std::make_shared()); return link; } @@ -358,6 +359,25 @@ async::result UptimeNode::store(std::string) { co_return; } +async::result FilesystemsNode::show() { + // See man 5 proc for more details. + // Based on the man page from Linux man-pages 6.01, updated on 2022-10-09. + std::stringstream stream; + stream << "nodev\tsysfs\n"; + stream << "nodev\ttmpfs\n"; + stream << "nodev\tproc\n"; + stream << "nodev\tdevpts\n"; + stream << "nodev\tdevtmpfs\n"; + stream << "\text2\n"; + co_return stream.str(); +} + +async::result FilesystemsNode::store(std::string) { + // TODO: proper error reporting. + std::cout << "posix: Can't store to a /proc/filesystems file" << std::endl; + co_return; +} + VfsType SelfLink::getType() { return VfsType::symlink; } diff --git a/posix/subsystem/src/procfs.hpp b/posix/subsystem/src/procfs.hpp index 194b3080d..6d03295af 100644 --- a/posix/subsystem/src/procfs.hpp +++ b/posix/subsystem/src/procfs.hpp @@ -219,6 +219,13 @@ struct UptimeNode final : RegularNode { async::result store(std::string) override; }; +struct FilesystemsNode final : RegularNode { + FilesystemsNode() {} + + async::result show() override; + async::result store(std::string) override; +}; + struct CommNode final : RegularNode { CommNode(Process *process) : _process(process)