ladybird/Kernel/ProcFileSystem.h

32 lines
752 B
C
Raw Normal View History

#pragma once
#include <AK/Types.h>
2019-01-23 02:13:17 -02:00
#include <Kernel/SyntheticFileSystem.h>
class Process;
class ProcFS final : public SynthFS {
public:
static ProcFS& the() PURE;
virtual ~ProcFS() override;
static RetainPtr<ProcFS> create();
virtual bool initialize() override;
2018-11-15 12:36:35 -02:00
virtual const char* class_name() const override;
2018-12-02 21:39:25 -02:00
void add_process(Process&);
void remove_process(Process&);
void add_sys_file(String&&, Function<ByteBuffer(SynthFSInode&)>&& read_callback, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&& write_callback);
void add_sys_bool(String&&, bool*, Function<void()>&& change_callback = nullptr);
private:
ProcFS();
HashMap<pid_t, InodeIndex> m_pid2inode;
InodeIdentifier m_sys_dir;
};