6#ifndef SHAREDMEMORY_HPP_INCLUDE
7#define SHAREDMEMORY_HPP_INCLUDE
35 virtual std::string
key(
void)
const = 0;
39 virtual size_t size(
void)
const = 0;
62 static std::unique_ptr<SharedMemory>
make_unique_user(
const std::string &shm_key,
unsigned int timeout);
65 virtual void chown(
const unsigned int uid,
const unsigned int gid)
const = 0;
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.
static void cleanup_shmem(void)
Definition SharedMemory.cpp:29
virtual size_t size(void) const =0
Retrieve the size of the shared memory region.
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.
Definition SharedMemory.cpp:87
SharedMemory & operator=(const SharedMemory &other)=default
SharedMemory(const SharedMemory &other)=default
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 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.
Definition SharedMemory.cpp:80
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.
Definition SharedMemory.cpp:94
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 unl...
virtual ~SharedMemory()=default
virtual void unlink(void)=0
Unlink the shared memory region.
#define GEOPM_PUBLIC
Definition geopm_public.h:10