/* * 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() { } ErrorOr AnonymousFile::mmap(Process& process, OpenFileDescription&, Memory::VirtualRange const& range, u64 offset, int prot, bool shared) { 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); } ErrorOr> AnonymousFile::pseudo_path(const OpenFileDescription&) const { return KString::try_create(":anonymous-file:"sv); } }