POSIX shared memory segment.

#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

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

Definition at line 305 of file Segment.cc.

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

Definition at line 310 of file Segment.cc.

References debugs, HERE(), and NULL.

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

Member Function Documentation

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

Definition at line 362 of file Segment.cc.

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

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

Definition at line 327 of file Segment.cc.

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

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

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

Definition at line 321 of file Segment.cc.

References IamWorkerProcess(), and UsingSmp().

Referenced by MemStoreRr::finalizeConfig().

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

Definition at line 39 of file Segment.h.

References reserve().

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

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

Definition at line 37 of file Segment.h.

References theName.

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

Definition at line 345 of file Segment.cc.

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

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

Segment& Ipc::Mem::Segment::operator= ( const Segment )
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< Class >::New().

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

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

Definition at line 43 of file Segment.h.

Referenced by testRock::setUp().

bool Ipc::Mem::Segment::doUnlink

Definition at line 77 of file Segment.h.

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

Definition at line 74 of file Segment.h.

Referenced by open(), and reserve().

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

Definition at line 73 of file Segment.h.

Referenced by name().

off_t Ipc::Mem::Segment::theReserved

Definition at line 76 of file Segment.h.

Referenced by reserve().

off_t Ipc::Mem::Segment::theSize

Definition at line 75 of file Segment.h.

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

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






Web Site Translations