pstore2
Classes | Functions
memory_mapper.hpp File Reference

Provides a portable interface for memory mapping portions of a file or for treating regions of memory as though they were memory-mapped files, which is useful for unit testing. More...

#include "pstore/os/file.hpp"
Include dependency graph for memory_mapper.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pstore::system_page_size_interface
 An interface for accessing the fundamental virtual memory page size on the host. More...
 
class  pstore::system_page_size
 
class  pstore::memory_mapper_base
 
class  pstore::memory_mapper
 memory_mapper provides an operating system independent interface for memory mapping of files. More...
 
class  pstore::in_memory_mapper
 

Functions

std::shared_ptr< std::uint8_t > pstore::aligned_valloc (std::size_t size, unsigned align)
 Allocates memory whose start address is a multiple of 'align'. More...
 
std::ostream & pstore::operator<< (std::ostream &os, memory_mapper_base const &mm)
 

Detailed Description

Provides a portable interface for memory mapping portions of a file or for treating regions of memory as though they were memory-mapped files, which is useful for unit testing.

Function Documentation

◆ aligned_valloc()

std::shared_ptr< std::uint8_t > pstore::aligned_valloc ( std::size_t  size,
unsigned  align 
)

Allocates memory whose start address is a multiple of 'align'.

This function uses the O/S memory allocation API directly and bypasses operator new/malloc(). This is to ensure that the library can safely change the memory permission (with mprotect() or equivalent).