From 48a0b76a773ff6748a79c0b5e654a5d0b68832a1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 6 Sep 2020 18:46:46 +0200 Subject: [PATCH] Kernel: Make File weakable This will be useful for some things. This also removes the need for TCPSocket to be special about this. --- Kernel/FileSystem/File.h | 5 ++++- Kernel/Net/TCPSocket.h | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index 9d3a1c6073..150f04f518 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -64,7 +65,9 @@ namespace Kernel { // - Called by mmap() when userspace wants to memory-map this File somewhere. // - Should create a Region in the Process and return it if successful. -class File : public RefCounted { +class File + : public RefCounted + , public Weakable { public: virtual ~File(); diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h index 44e444eec9..bff5ac14c2 100644 --- a/Kernel/Net/TCPSocket.h +++ b/Kernel/Net/TCPSocket.h @@ -34,8 +34,7 @@ namespace Kernel { -class TCPSocket final : public IPv4Socket - , public Weakable { +class TCPSocket final : public IPv4Socket { public: static void for_each(Function); static NonnullRefPtr create(int protocol);