mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
Kernel: Use KBuffers for ProcFS and SynthFS
Instead of generating ByteBuffers and keeping those lying around, have these filesystems generate KBuffers instead. These are way less spooky to leave around for a while. Since FileDescription will keep a generated file buffer around until userspace has read the whole thing, this prevents trivially exhausting the kmalloc heap by opening many files in /proc for example. The code responsible for generating each /proc file is not perfectly efficient and many of them still use ByteBuffers internally but they at least go away when we return now. :^)
This commit is contained in:
parent
6b6b86fbf3
commit
79e22acb22
7 changed files with 58 additions and 43 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/FileSystem/InodeMetadata.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/KBuffer.h>
|
||||
#include <Kernel/Net/Socket.h>
|
||||
#include <Kernel/VM/VirtualAddress.h>
|
||||
|
||||
|
@ -90,7 +91,7 @@ public:
|
|||
SharedMemory* shared_memory();
|
||||
const SharedMemory* shared_memory() const;
|
||||
|
||||
ByteBuffer& generator_cache() { return m_generator_cache; }
|
||||
Optional<KBuffer>& generator_cache() { return m_generator_cache; }
|
||||
|
||||
void set_original_inode(Badge<VFS>, NonnullRefPtr<Inode>&& inode) { m_inode = move(inode); }
|
||||
|
||||
|
@ -114,7 +115,7 @@ private:
|
|||
|
||||
off_t m_current_offset { 0 };
|
||||
|
||||
ByteBuffer m_generator_cache;
|
||||
Optional<KBuffer> m_generator_cache;
|
||||
|
||||
u32 m_file_flags { 0 };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue