POSIX shared memory segment. More...
#include <Segment.h>
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) |
const String & | name () |
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 &) | |
Segment & | operator= (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
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.
◆ Segment() [2/2]
|
private |
Member Function Documentation
◆ checkSupport()
|
private |
Definition at line 363 of file Segment.cc.
◆ create()
void Ipc::Mem::Segment::create | ( | const off_t | aSize | ) |
Definition at line 328 of file Segment.cc.
References assert, debugs, fatalf(), and Segments.
Referenced by Ipc::Mem::Owner< Class >::Owner().
◆ Enabled()
|
static |
Definition at line 322 of file Segment.cc.
References IamWorkerProcess(), and UsingSmp().
Referenced by MemStoreRr::finalizeConfig().
◆ mem()
|
inline |
Definition at line 41 of file Segment.h.
References reserve().
Referenced by Ipc::Mem::Object< Class >::Object(), and Ipc::Mem::Owner< Class >::Owner().
◆ name()
|
inline |
◆ Name()
Definition at line 52 of file Segment.cc.
References SBuf::append().
Referenced by createOwner(), Rock::SwapDir::inodeMapPath(), Rock::Rebuild::Stats::Path(), StoreMapAnchorsId(), StoreMapFileNosId(), and StoreMapSlicesId().
◆ open()
void Ipc::Mem::Segment::open | ( | const bool | unlinkWhenDone | ) |
opens an existing shared memory segment
- Parameters
-
unlinkWhenDone whether to delete the segment on destruction
Definition at line 346 of file Segment.cc.
References assert, debugs, fatalf(), Segments, theMem, and theSize.
Referenced by Ipc::Mem::Object< Class >::Object(), and Ipc::Mem::Owner< Class >::Owner().
◆ operator=()
◆ 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< Class >::New().
◆ size()
|
inline |
Definition at line 40 of file Segment.h.
References theSize.
Referenced by Ipc::Mem::Object< Class >::Object().
Member Data Documentation
◆ BasePath
|
static |
◆ doUnlink
◆ theMem
|
private |
◆ theName
|
private |
◆ theReserved
|
private |
◆ theSize
|
private |
The documentation for this class was generated from the following files:
- src/ipc/mem/Segment.h
- src/ipc/mem/Segment.cc