mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 22:12:44 +00:00 
			
		
		
		
	 1682f0b760
			
		
	
	
		1682f0b760
		
	
	
	
	
		
			
			SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
		
			
				
	
	
		
			33 lines
		
	
	
	
		
			747 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			747 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <Kernel/FileSystem/AnonymousFile.h>
 | |
| #include <Kernel/Process.h>
 | |
| #include <Kernel/VM/AnonymousVMObject.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| AnonymousFile::AnonymousFile(NonnullRefPtr<AnonymousVMObject> vmobject)
 | |
|     : m_vmobject(move(vmobject))
 | |
| {
 | |
| }
 | |
| 
 | |
| AnonymousFile::~AnonymousFile()
 | |
| {
 | |
| }
 | |
| 
 | |
| KResultOr<Region*> 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);
 | |
| }
 | |
| 
 | |
| }
 |