1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

Kernel: More work towards POSIX SHM, also add ftruncate().

This commit is contained in:
Andreas Kling 2019-04-09 01:10:00 +02:00
parent 99f3cc26c3
commit 26a06f3fcd
10 changed files with 92 additions and 1 deletions

View file

@ -15,6 +15,7 @@ class MasterPTY;
class Process;
class Region;
class CharacterDevice;
class SharedMemory;
class FileDescriptor : public Retainable<FileDescriptor> {
public:
@ -85,6 +86,11 @@ public:
bool is_fifo() const { return m_fifo; }
FIFO::Direction fifo_direction() { return m_fifo_direction; }
bool is_file() const;
bool is_shared_memory() const { return m_shared_memory; }
SharedMemory* shared_memory() { return m_shared_memory.ptr(); }
const SharedMemory* shared_memory() const { return m_shared_memory.ptr(); }
ByteBuffer& generator_cache() { return m_generator_cache; }
void set_original_inode(Badge<VFS>, Retained<Inode>&& inode) { m_inode = move(inode); }
@ -92,6 +98,8 @@ public:
SocketRole socket_role() const { return m_socket_role; }
void set_socket_role(SocketRole);
KResult truncate(off_t);
private:
friend class VFS;
FileDescriptor(RetainPtr<Socket>&&, SocketRole);
@ -115,6 +123,8 @@ private:
RetainPtr<FIFO> m_fifo;
FIFO::Direction m_fifo_direction { FIFO::Neither };
RetainPtr<SharedMemory> m_shared_memory;
bool m_closed { false };
};