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

Kernel: Make it possible to look up FIFO's by ID.

This will be useful when implementing the /proc/PID/fd/N links where N is
a file descriptor referring to a FIFO.
This commit is contained in:
Andreas Kling 2019-04-25 13:52:07 +02:00
parent eadcf720c0
commit d5578826af
4 changed files with 43 additions and 8 deletions

View file

@ -11,7 +11,12 @@ public:
Neither, Reader, Writer
};
static Retained<FIFO> create();
static RetainPtr<FIFO> from_fifo_id(dword);
static Retained<FIFO> create(uid_t);
~FIFO();
uid_t uid() const { return m_uid; }
void open(Direction);
void close(Direction);
@ -23,9 +28,11 @@ public:
bool can_write() const;
private:
FIFO();
explicit FIFO(uid_t);
unsigned m_writers { 0 };
unsigned m_readers { 0 };
DoubleBuffer m_buffer;
uid_t m_uid { 0 };
};