1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

Implement /proc/PID/vm.

Refactored SyntheticFileSystem to maintain an arbitrary directory structure.
ProcFileSystem creates a directory entry in /proc for each new process.
This commit is contained in:
Andreas Kling 2018-10-26 17:42:12 +02:00
parent 10347b9ae8
commit a32b3a3ddf
15 changed files with 217 additions and 39 deletions

View file

@ -8,7 +8,7 @@ template<typename T>
class DoublyLinkedList {
private:
struct Node {
explicit Node(T&& v) : value(v) { }
explicit Node(T&& v) : value(move(v)) { }
T value;
Node* next { nullptr };
Node* prev { nullptr };
@ -62,7 +62,8 @@ public:
class Iterator {
public:
bool operator!=(const Iterator& other) { return m_node != other.m_node; }
bool operator!=(const Iterator& other) const { return m_node != other.m_node; }
bool operator==(const Iterator& other) const { return m_node == other.m_node; }
Iterator& operator++() { m_node = m_node->next; return *this; }
T& operator*() { return m_node->value; }
bool isEnd() const { return !m_node; }
@ -78,7 +79,8 @@ public:
class ConstIterator {
public:
bool operator!=(const ConstIterator& other) { return m_node != other.m_node; }
bool operator!=(const ConstIterator& other) const { return m_node != other.m_node; }
bool operator==(const ConstIterator& other) const { return m_node == other.m_node; }
ConstIterator& operator++() { m_node = m_node->next; return *this; }
const T& operator*() const { return m_node->value; }
bool isEnd() const { return !m_node; }