This class encapsulates an inter-process shared memory region.
More...
#include <SharedMemory.hpp>
This class encapsulates an inter-process shared memory region.
◆ SharedMemory() [1/2]
geopm::SharedMemory::SharedMemory |
( |
| ) |
|
|
default |
◆ SharedMemory() [2/2]
geopm::SharedMemory::SharedMemory |
( |
const SharedMemory & |
other | ) |
|
|
default |
◆ ~SharedMemory()
virtual geopm::SharedMemory::~SharedMemory |
( |
| ) |
|
|
virtualdefault |
◆ chown()
virtual void geopm::SharedMemory::chown |
( |
const unsigned int |
uid, |
|
|
const unsigned int |
gid |
|
) |
| const |
|
pure virtual |
◆ cleanup_shmem()
void geopm::SharedMemory::cleanup_shmem |
( |
void |
| ) |
|
|
static |
◆ get_scoped_lock()
Attempt to lock the mutex for the shared memory region and return a scoped mutex object that will unlock the mutex when it goes out of scope.
This method should be called before accessing the memory with pointer()
Implemented in geopm::SharedMemoryImp.
◆ key()
virtual std::string geopm::SharedMemory::key |
( |
void |
| ) |
const |
|
pure virtual |
Retrieve the key to the shared memory region.
- Returns
- Key to the shared memory region.
Implemented in geopm::SharedMemoryImp.
◆ make_unique_owner()
std::unique_ptr< SharedMemory > geopm::SharedMemory::make_unique_owner |
( |
const std::string & |
shm_key, |
|
|
size_t |
size |
|
) |
| |
|
static |
Creates a shared memory region with the given key and size.
- Returns
- a pointer to a SharedMemory object managing the region.
◆ make_unique_owner_secure()
std::unique_ptr< SharedMemory > geopm::SharedMemory::make_unique_owner_secure |
( |
const std::string & |
shm_key, |
|
|
size_t |
size |
|
) |
| |
|
static |
Creates a shared memory region with the given key and size without group or world permissions.
- Returns
- a pointer to a SharedMemory object managing the region.
◆ make_unique_user()
std::unique_ptr< SharedMemory > geopm::SharedMemory::make_unique_user |
( |
const std::string & |
shm_key, |
|
|
unsigned int |
timeout |
|
) |
| |
|
static |
Attaches to the shared memory region with the given key.
- Returns
- a pointer to a SharedMemory object managing the region.
- Exceptions
-
If | it cannot attach within the timeout, throws an exception. |
◆ operator=()
◆ pointer()
virtual void* geopm::SharedMemory::pointer |
( |
void |
| ) |
const |
|
pure virtual |
Retrieve a pointer to the shared memory region.
- Returns
- Void pointer to the shared memory region.
Implemented in geopm::SharedMemoryImp.
◆ size()
virtual size_t geopm::SharedMemory::size |
( |
void |
| ) |
const |
|
pure virtual |
Retrieve the size of the shared memory region.
- Returns
- Size of the shared memory region.
Implemented in geopm::SharedMemoryImp.
◆ unlink()
virtual void geopm::SharedMemory::unlink |
( |
void |
| ) |
|
|
pure virtual |
The documentation for this class was generated from the following files: