From b0a2572577af0132bd3a9408ea05219fa093a79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Tue, 5 Apr 2022 14:24:53 +0200 Subject: [PATCH] Kernel: Don't require AnonymousFiles to be mmap'd completely AnonymousFile always allocates in multiples of a page size when created with anon_create. This is especially an issue if we use AnonymousFile shared memory to store a shared data structure that isn't exactly a multiple of a page in size. Therefore, we can just allow mmaps of AnonymousFile to map only an initial part of the shared memory. This makes SharedSingleProducerCircularQueue work when it's introduced later. --- Kernel/FileSystem/AnonymousFile.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Kernel/FileSystem/AnonymousFile.cpp b/Kernel/FileSystem/AnonymousFile.cpp index 5d46a5e6fb..11d7e42345 100644 --- a/Kernel/FileSystem/AnonymousFile.cpp +++ b/Kernel/FileSystem/AnonymousFile.cpp @@ -22,9 +22,6 @@ ErrorOr AnonymousFile::mmap(Process& process, OpenFileDescripti if (offset != 0) return EINVAL; - if (range.size() != m_vmobject->size()) - return EINVAL; - return process.address_space().allocate_region_with_vmobject(range, m_vmobject, offset, {}, prot, shared); }