Creates the shared memory based on a provided configuration.
More...
#include <iceoryx_posh/roudi/memory/posix_shm_memory_provider.hpp>
|
cxx::expected< void *, MemoryProviderError > | createMemory (const uint64_t size, const uint64_t alignment) noexcept |
| This function needs to be implemented to provide the actual memory, e.g. in case of POSIX SHM, shm_open and mmap would need to be called in the implementation of this function.
|
|
cxx::expected< MemoryProviderError > | destroyMemory () noexcept |
| This function needs to be implemented to free the actual memory, e.g. in case of POSIX SHM, shm_unlink and munmap would need to be called in the implementation of this function.
|
|
Creates the shared memory based on a provided configuration.
◆ PosixShmMemoryProvider()
iox::roudi::PosixShmMemoryProvider::PosixShmMemoryProvider |
( |
const ShmName_t & |
shmName, |
|
|
const posix::AccessMode |
accessMode, |
|
|
const posix::OpenMode |
openMode |
|
) |
| |
|
noexcept |
Constructs a PosixShmMemoryProvider which can be used to request memory via MemoryBlocks.
- Parameters
-
[in] | shmName | is the name of the posix share memory |
[in] | accessMode | defines the read and write access to the memory |
[in] | openMode | defines the creation/open mode of the shared memory. |
◆ createMemory()
cxx::expected< void *, MemoryProviderError > iox::roudi::PosixShmMemoryProvider::createMemory |
( |
const uint64_t |
size, |
|
|
const uint64_t |
alignment |
|
) |
| |
|
protectedvirtualnoexcept |
This function needs to be implemented to provide the actual memory, e.g. in case of POSIX SHM, shm_open and mmap would need to be called in the implementation of this function.
- Parameters
-
[in] | size | is the size in bytes for the requested memory, the size should already be calculated according to the alignment requirements |
[in] | alignment | the required alignment for the memory |
- Returns
- the pointer of the begin of the created memory or a MemoryProviderError if the memory could not be created
- Note
- This creates and maps a POSIX shared memory to the address space of the application
Implements iox::roudi::MemoryProvider.
◆ destroyMemory()
This function needs to be implemented to free the actual memory, e.g. in case of POSIX SHM, shm_unlink and munmap would need to be called in the implementation of this function.
- Returns
- a MemoryProviderError if the destruction failed, otherwise success
- Note
- This closes and unmaps a POSIX shared memory
Implements iox::roudi::MemoryProvider.
The documentation for this class was generated from the following file: