summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/FileDescriptor.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-09 01:10:00 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-09 01:10:00 +0200
commit26a06f3fcd688651cb6da2e5a25602ca7e5e9de3 (patch)
tree2a4d6173243b264e21eb443f32e480a465ee73fc /Kernel/FileSystem/FileDescriptor.h
parent99f3cc26c3e69b0ad7f104cd20189cd6fd4c3cf1 (diff)
downloadserenity-26a06f3fcd688651cb6da2e5a25602ca7e5e9de3.zip
Kernel: More work towards POSIX SHM, also add ftruncate().
Diffstat (limited to 'Kernel/FileSystem/FileDescriptor.h')
-rw-r--r--Kernel/FileSystem/FileDescriptor.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Kernel/FileSystem/FileDescriptor.h b/Kernel/FileSystem/FileDescriptor.h
index fb0a4b6f31..65361712bc 100644
--- a/Kernel/FileSystem/FileDescriptor.h
+++ b/Kernel/FileSystem/FileDescriptor.h
@@ -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 };
};