geopm 3.1.1.dev453+g1f4a5a13
GEOPM - Global Extensible Open Power Manager
|
This class encapsulates an inter-process shared memory region. More...
#include <SharedMemory.hpp>
Public Member Functions | |
SharedMemory ()=default | |
SharedMemory (const SharedMemory &other)=default | |
SharedMemory & | operator= (const SharedMemory &other)=default |
virtual | ~SharedMemory ()=default |
virtual void * | pointer (void) const =0 |
Retrieve a pointer to the shared memory region. | |
virtual std::string | key (void) const =0 |
Retrieve the key to the shared memory region. | |
virtual size_t | size (void) const =0 |
Retrieve the size of the shared memory region. | |
virtual void | unlink (void)=0 |
Unlink the shared memory region. | |
virtual std::unique_ptr< SharedMemoryScopedLock > | get_scoped_lock (void)=0 |
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. | |
virtual void | chown (const unsigned int uid, const unsigned int gid) const =0 |
Modifies the shared memory to be owned by the specified gid. | |
Static Public Member Functions | |
static std::unique_ptr< SharedMemory > | make_unique_owner (const std::string &shm_key, size_t size) |
Creates a shared memory region with the given key and size. | |
static std::unique_ptr< SharedMemory > | make_unique_owner_secure (const std::string &shm_key, size_t size) |
Creates a shared memory region with the given key and size without group or world permissions. | |
static std::unique_ptr< SharedMemory > | make_unique_user (const std::string &shm_key, unsigned int timeout) |
Attaches to the shared memory region with the given key. | |
static void | cleanup_shmem (void) |
This class encapsulates an inter-process shared memory region.
|
default |
|
default |
|
virtualdefault |
|
pure virtual |
Modifies the shared memory to be owned by the specified gid.
Implemented in geopm::SharedMemoryImp.
|
pure virtual |
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.
Retrieve the key to the shared memory region.
Implemented in geopm::SharedMemoryImp.
|
static |
Creates a shared memory region with the given key and size.
|
static |
Creates a shared memory region with the given key and size without group or world permissions.
|
static |
Attaches to the shared memory region with the given key.
If | it cannot attach within the timeout, throws an exception. |
|
default |
Retrieve a pointer to the shared memory region.
Implemented in geopm::SharedMemoryImp.
|
pure virtual |
Retrieve the size of the shared memory region.
Implemented in geopm::SharedMemoryImp.
Unlink the shared memory region.
Implemented in geopm::SharedMemoryImp.