mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
Start adding a basic /proc filesystem and a "ps" utility.
This commit is contained in:
parent
98f76f0153
commit
ed2422d7af
13 changed files with 139 additions and 23 deletions
|
@ -4,7 +4,7 @@
|
|||
#include "UnixTypes.h"
|
||||
#include <AK/HashMap.h>
|
||||
|
||||
class SyntheticFileSystem final : public FileSystem {
|
||||
class SyntheticFileSystem : public FileSystem {
|
||||
public:
|
||||
virtual ~SyntheticFileSystem() override;
|
||||
static RetainPtr<SyntheticFileSystem> create();
|
||||
|
@ -20,18 +20,22 @@ public:
|
|||
virtual Unix::ssize_t readInodeBytes(InodeIdentifier, Unix::off_t offset, Unix::size_t count, byte* buffer) const override;
|
||||
virtual InodeIdentifier makeDirectory(InodeIdentifier parentInode, const String& name, Unix::mode_t) override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
SyntheticFileSystem();
|
||||
|
||||
struct File {
|
||||
String name;
|
||||
InodeMetadata metadata;
|
||||
ByteBuffer data;
|
||||
Function<ByteBuffer()> generator;
|
||||
};
|
||||
|
||||
OwnPtr<File> createTextFile(String&& name, String&& text);
|
||||
OwnPtr<File> createGeneratedFile(String&& name, Function<ByteBuffer()>&&);
|
||||
|
||||
void addFile(OwnPtr<File>&&);
|
||||
|
||||
private:
|
||||
Vector<OwnPtr<File>> m_files;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue