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 ()
 Open an existing shared memory segment. More...
const Stringname ()
 shared memory segment name More...
off_t size ()
 shared memory segment size More...
void * mem ()
 pointer to the next chunk More...
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 305 of file Segment.cc.

Referenced by Name().

◆ ~Segment()

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

Definition at line 310 of file Segment.cc.

References debugs, doUnlink, HERE(), NULL, Segments, theMem, and theName.

Referenced by Name().

◆ 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 362 of file Segment.cc.

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

Referenced by create(), and open().

◆ create()

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

◆ Enabled()

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

Definition at line 321 of file Segment.cc.

References IamWorkerProcess(), and UsingSmp().

Referenced by checkSupport(), MemStoreRr::finalizeConfig(), and Name().

◆ mem()

void* Ipc::Mem::Segment::mem ( )

Definition at line 39 of file Segment.h.

References reserve().

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

◆ name()

const String& Ipc::Mem::Segment::name ( )

Definition at line 37 of file Segment.h.

References theName.

Referenced by Name().

◆ Name()

◆ open()

void Ipc::Mem::Segment::open ( )

◆ 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 mem(), and Ipc::Mem::Owner< Ipc::MultiQueue::Metadata >::New().

◆ size()

off_t Ipc::Mem::Segment::size ( )

Definition at line 38 of file Segment.h.

References theSize.

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

Member Data Documentation

◆ BasePath

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

Definition at line 43 of file Segment.h.

Referenced by Name(), and testRock::setUp().

◆ doUnlink

bool Ipc::Mem::Segment::doUnlink

Definition at line 77 of file Segment.h.

Referenced by create(), Name(), and ~Segment().

◆ theMem

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

Definition at line 74 of file Segment.h.

Referenced by create(), Name(), open(), reserve(), and ~Segment().

◆ theName

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

Definition at line 73 of file Segment.h.

Referenced by create(), name(), Name(), open(), and ~Segment().

◆ theReserved

off_t Ipc::Mem::Segment::theReserved

Definition at line 76 of file Segment.h.

Referenced by Name(), and reserve().

◆ theSize

off_t Ipc::Mem::Segment::theSize

Definition at line 75 of file Segment.h.

Referenced by create(), Name(), open(), reserve(), and size().

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






Web Site Translations