summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2019-08-11 16:28:18 +0300
committerAndreas Kling <awesomekling@gmail.com>2019-08-11 16:30:43 +0200
commitd46c3b0b5bc196bb987d3c77855be678849e2e09 (patch)
tree92714fa43c348133fcdce48841f478fc5ef3cb5f /Kernel/FileSystem
parent1606261c58599328ed509c356ca106b9dda59b95 (diff)
downloadserenity-d46c3b0b5bc196bb987d3c77855be678849e2e09.zip
Net: Simplify how LocalSocket tracks open fds
Now that there can't be multiple clones of the same fd, we only need to track whether or not an fd exists on each side. Also there's no point in tracking connecting fds.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/FileDescription.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index cf9d0a52b6..4b122bb256 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -33,6 +33,8 @@ FileDescription::FileDescription(File& file, SocketRole role)
if (file.is_inode())
m_inode = static_cast<InodeFile&>(file).inode();
set_socket_role(role);
+ if (is_socket())
+ socket()->attach(*this);
}
FileDescription::~FileDescription()
@@ -51,10 +53,7 @@ void FileDescription::set_socket_role(SocketRole role)
return;
ASSERT(is_socket());
- if (m_socket_role != SocketRole::None)
- socket()->detach(*this);
m_socket_role = role;
- socket()->attach(*this);
}
KResult FileDescription::fstat(stat& buffer)