9#ifndef SQUID_SRC_IPC_MEM_SEGMENT_H
10#define SQUID_SRC_IPC_MEM_SEGMENT_H
34 void create(
const off_t aSize);
37 void open(
const bool unlinkWhenDone);
42 void *
reserve(
size_t chunkSize);
48 static SBuf Name(
const SBuf &prefix,
const char *suffix);
58 bool createFresh(
int &err);
63 off_t statSize(
const char *context)
const;
65 static String GenerateName(
const char *
id);
void useConfig() override
virtual void create()=0
called when the runner should create a new memory segment
POSIX shared memory segment.
bool doUnlink
whether the segment should be unlinked on destruction
off_t theReserved
the total number of reserve()d bytes
Segment & operator=(const Segment &)
off_t theSize
shared memory segment size
void open(const bool unlinkWhenDone)
static const char * BasePath
common path of all segment names in path-based environments
static bool Enabled()
Whether shared memory support is available.
void * mem()
pointer to the next chunk
static SBuf Name(const SBuf &prefix, const char *suffix)
concatenates parts of a name to form a complete name (or its prefix)
void * theMem
pointer to mmapped shared memory segment
void * reserve(size_t chunkSize)
reserve and return the next chunk
const String theName
shared memory segment file name
void checkSupport(const char *const context)
void create(const off_t aSize)
Create a new shared memory segment. Unlinks the segment on destruction.
off_t size()
shared memory segment size
const String & name()
shared memory segment name