POSIX shared memory segment. More...

#include <Segment.h>

Collaboration diagram for Ipc::Mem::Segment:

Public Member Functions

 Segment (const char *const id)
 Create a shared memory segment. More...
 ~Segment ()
void create (const off_t aSize)
 Create a new shared memory segment. Unlinks the segment on destruction. More...
void open (const bool unlinkWhenDone)
void * reserve (size_t chunkSize)
 reserve and return the next chunk More...

Static Public Member Functions

static bool Enabled ()
 Whether shared memory support is available. More...
static SBuf Name (const SBuf &prefix, const char *suffix)
 concatenates parts of a name to form a complete name (or its prefix) More...

Static Public Attributes

static const char * BasePath = DEFAULT_STATEDIR
 common path of all segment names in path-based environments More...

Private Member Functions

 Segment (const Segment &)
Segmentoperator= (const Segment &)
void checkSupport (const char *const context)

Private Attributes

const String theName
 shared memory segment file name More...
void * theMem
 pointer to mmapped shared memory segment More...
off_t theSize
 shared memory segment size More...
off_t theReserved
 the total number of reserve()d bytes More...
bool doUnlink
 whether the segment should be unlinked on destruction More...

Detailed Description

Definition at line 23 of file Segment.h.

Constructor & Destructor Documentation

◆ Segment() [1/2]

Ipc::Mem::Segment::Segment ( const char *const  id)

Definition at line 306 of file Segment.cc.

◆ ~Segment()

Ipc::Mem::Segment::~Segment ( )

Definition at line 311 of file Segment.cc.

References debugs, HERE(), NULL, and Segments.

◆ Segment() [2/2]

Ipc::Mem::Segment::Segment ( const Segment )

Member Function Documentation

◆ checkSupport()

void Ipc::Mem::Segment::checkSupport ( const char *const  context)

Definition at line 363 of file Segment.cc.

References debugs, fatalf(), and HERE().

◆ create()

void Ipc::Mem::Segment::create ( const off_t  aSize)

Definition at line 328 of file Segment.cc.

References assert, debugs, fatalf(), HERE(), and Segments.

◆ Enabled()

bool Ipc::Mem::Segment::Enabled ( )

Definition at line 322 of file Segment.cc.

References IamWorkerProcess(), and UsingSmp().

Referenced by MemStoreRr::finalizeConfig().

◆ Name()

SBuf Ipc::Mem::Segment::Name ( const SBuf prefix,
const char *  suffix 

◆ open()

void Ipc::Mem::Segment::open ( const bool  unlinkWhenDone)

opens an existing shared memory segment

unlinkWhenDonewhether to delete the segment on destruction

Definition at line 346 of file Segment.cc.

References assert, debugs, fatalf(), HERE(), Segments, theMem, and theSize.

Referenced by Ipc::Mem::Object< Class >::Object().

◆ operator=()

Segment& Ipc::Mem::Segment::operator= ( const Segment )

◆ reserve()

void * Ipc::Mem::Segment::reserve ( size_t  chunkSize)

Definition at line 38 of file Segment.cc.

References assert, Must, theMem, theReserved, and theSize.

Referenced by Ipc::Mem::Owner< Ipc::MultiQueue::Metadata >::New().

Member Data Documentation

◆ BasePath

const char * Ipc::Mem::Segment::BasePath = DEFAULT_STATEDIR

Definition at line 45 of file Segment.h.

Referenced by testRock::setUp().

◆ doUnlink

bool Ipc::Mem::Segment::doUnlink

Definition at line 79 of file Segment.h.

◆ theMem

void* Ipc::Mem::Segment::theMem

Definition at line 76 of file Segment.h.

Referenced by open(), and reserve().

◆ theName

const String Ipc::Mem::Segment::theName

Definition at line 75 of file Segment.h.

◆ theReserved

off_t Ipc::Mem::Segment::theReserved

Definition at line 78 of file Segment.h.

Referenced by reserve().

◆ theSize

off_t Ipc::Mem::Segment::theSize

Definition at line 77 of file Segment.h.

Referenced by open(), and reserve().

The documentation for this class was generated from the following files:






Web Site Translations