From 36bb1cab5c95fc1228b1df5c869baa47eb259554 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 15 Oct 2022 11:16:18 +0200 Subject: [PATCH] FileDescriptor: add operator=() so that the fcntl(F_DUPFD syscall compiles :) --- kernel/include/fs/FileDescriptor.h | 2 ++ kernel/src/fs/FileDescriptor.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/kernel/include/fs/FileDescriptor.h b/kernel/include/fs/FileDescriptor.h index d9ff1480..b6ee909b 100644 --- a/kernel/include/fs/FileDescriptor.h +++ b/kernel/include/fs/FileDescriptor.h @@ -43,6 +43,8 @@ struct Descriptor Descriptor(const Descriptor& other); Descriptor(); + const Descriptor& operator=(const Descriptor& other); + private: bool m_is_open; bool m_can_read; diff --git a/kernel/src/fs/FileDescriptor.cpp b/kernel/src/fs/FileDescriptor.cpp index d45d41b6..eb4e2da9 100644 --- a/kernel/src/fs/FileDescriptor.cpp +++ b/kernel/src/fs/FileDescriptor.cpp @@ -40,4 +40,14 @@ int Descriptor::seek(long offset) return -EINVAL; // FIXME: Support seeking beyond the current file's length. m_offset = (uint64_t)offset; return 0; +} + +const Descriptor& Descriptor::operator=(const Descriptor& other) +{ + m_is_open = other.m_is_open; + m_can_read = other.m_can_read; + m_can_write = other.m_can_write; + m_offset = other.m_offset; + m_node = other.m_node; + return other; } \ No newline at end of file