Fawkes API
Fawkes Development Version
|
24 #ifndef _UTILS_IPC_SHM_REGISTRY_H_
25 #define _UTILS_IPC_SHM_REGISTRY_H_
28 #include <semaphore.h>
30 #define MAGIC_TOKEN_SIZE 16
31 #define MAXNUM_SHM_SEGMS 64
32 #define DEFAULT_SHM_NAME "/fawkes-shmem-registry"
33 #define USER_SHM_NAME "/fawkes-shmem-registry-%s"
44 char magic_token[MAGIC_TOKEN_SIZE];
51 std::list<SharedMemoryRegistry::SharedMemID>
get_snapshot()
const;
53 std::list<SharedMemoryRegistry::SharedMemID>
find_segments(
const char *magic_token)
const;
55 void add_segment(
int shmid,
const char *magic_token);
58 static void cleanup(
const char *name = 0);
std::list< SharedMemoryRegistry::SharedMemID > get_snapshot() const
Get a snapshot of currently registered segments.
Shared memory identifier.
~SharedMemoryRegistry()
Destructor.
static void cleanup(const char *name=0)
Cleanup existing shared memory segments.
int shmid
SysV IPC shared memory ID.
SharedMemoryRegistry(const char *name=0)
Constructor.
void remove_segment(int shmid)
Remove segment.
std::list< SharedMemoryRegistry::SharedMemID > find_segments(const char *magic_token) const
Find segments with particular magic token.
void add_segment(int shmid, const char *magic_token)
Register a segment.