shm_mmap Class Reference

Persistent shared memory with backing file. More...

#include <shm_mmap.h>

List of all members.

Public Member Functions

 shm_mmap (char *file)
int * mmapIntArray (char *file)
int prepareFile (char *file)
int * initMap (void)

Private Attributes

long long id
char * file
void * base
size_t size
int rights
int publication
int last_errno


Detailed Description

Persistent shared memory with backing file.

Mapped memory file class

shmptr = mmap(0, // system assigns address b, // size of shared memory segment (PROT_READ | PROT_WRITE), // access rights, can be rwx (MAP_ANON | MAP_SHARED), // anonymous, shared 0, // file descriptor (not used) 0); // file offset (not used)

Note : offset should be a multiple of the page size as returned by getpagesize(2).

A file is mapped in multiples of the page size. For a file that is not a multiple of the page size, the remaining memory is zeroed when mapped, and writes to that region are not written out to the file. The effect of changing the size of the underlying file of a mapping on the pages that correspond to added or removed regions of the file is unspecified.

Definition at line 52 of file shm_mmap.h.


Constructor & Destructor Documentation

shm_mmap::shm_mmap ( char *  file  )  [inline]

Definition at line 55 of file shm_mmap.h.

References base, mmapIntArray(), and prepareFile().

Here is the call graph for this function:


Member Function Documentation

int * shm_mmap::mmapIntArray ( char *  file  ) 

map a file as an Int array

Definition at line 106 of file shm_mmap.h.

References MAPSIZE.

Referenced by initMap(), and shm_mmap().

int shm_mmap::prepareFile ( char *  file  ) 

prepare file for memory mapping

Definition at line 140 of file shm_mmap.h.

References MAPSIZE.

Referenced by initMap(), and shm_mmap().

int * shm_mmap::initMap ( void   ) 

initialize a mapped file as an int array

Definition at line 179 of file shm_mmap.h.

References FORKED_FILE, FORKED_SIZE, mmapIntArray(), and prepareFile().

Here is the call graph for this function:


Member Data Documentation

long long shm_mmap::id [private]

Definition at line 77 of file shm_mmap.h.

char* shm_mmap::file [private]

Definition at line 78 of file shm_mmap.h.

void* shm_mmap::base [private]

system assigned address attach point for memory.

Definition at line 81 of file shm_mmap.h.

Referenced by shm_mmap().

size_t shm_mmap::size [private]

size of shared memory segment in bytes

Definition at line 84 of file shm_mmap.h.

int shm_mmap::rights [private]

access rights, can be rwx

Definition at line 87 of file shm_mmap.h.

int shm_mmap::publication [private]

publication limits (anonymous, shared)

Definition at line 90 of file shm_mmap.h.

int shm_mmap::last_errno [private]

last error code from mmap

Definition at line 93 of file shm_mmap.h.


The documentation for this class was generated from the following file:
Project shmq hosted by   SourceForge.net
Documentation generated on Sat Sep 2 10:07:40 2006 for shmq by   doxygen.org 1.4.6