/* * Copyright (c) 2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include namespace Kernel { AnonymousFile::AnonymousFile(NonnullRefPtr vmobject) : m_vmobject(move(vmobject)) { } AnonymousFile::~AnonymousFile() { } KResultOr AnonymousFile::mmap(Process& process, FileDescription&, const Range& range, u64 offset, int prot, bool shared) { if (offset != 0) return EINVAL; if (range.size() != m_vmobject->size()) return EINVAL; return process.space().allocate_region_with_vmobject(range, m_vmobject, offset, {}, prot, shared); } }