mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 17:52:34 -10:00
This is more useful than passing a reference to the Process, which can be easily obtained with Process::current(). Only KCOVDevice previously used this argument. We will need this new argument in the next commit.
37 lines
913 B
C++
37 lines
913 B
C++
/*
|
|
* Copyright (c) 2021-2022, Andreas Kling <[email protected]>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/FileSystem/AnonymousFile.h>
|
|
#include <Kernel/Memory/AnonymousVMObject.h>
|
|
#include <Kernel/Tasks/Process.h>
|
|
|
|
namespace Kernel {
|
|
|
|
AnonymousFile::AnonymousFile(NonnullLockRefPtr<Memory::AnonymousVMObject> vmobject)
|
|
: m_vmobject(move(vmobject))
|
|
{
|
|
}
|
|
|
|
AnonymousFile::~AnonymousFile() = default;
|
|
|
|
ErrorOr<File::VMObjectAndMemoryType> AnonymousFile::vmobject_and_memory_type_for_mmap(OpenFileDescription&, Memory::VirtualRange const&, u64& offset, bool)
|
|
{
|
|
if (offset != 0)
|
|
return EINVAL;
|
|
|
|
return VMObjectAndMemoryType {
|
|
.vmobject = m_vmobject,
|
|
.memory_type = Memory::MemoryType::Normal,
|
|
};
|
|
}
|
|
|
|
ErrorOr<NonnullOwnPtr<KString>> AnonymousFile::pseudo_path(OpenFileDescription const&) const
|
|
{
|
|
return KString::try_create(":anonymous-file:"sv);
|
|
}
|
|
|
|
}
|