#include <Memory_Pool.h>
Inheritance diagram for ACE_MMAP_Memory_Pool:
Public Types | |
typedef ACE_MMAP_Memory_Pool_Options | OPTIONS |
Public Methods | |
ACE_MMAP_Memory_Pool (const ACE_TCHAR *backing_store_name=0, const OPTIONS *options=0) | |
Initialize the pool. | |
virtual | ~ACE_MMAP_Memory_Pool (void) |
Destructor. | |
virtual void * | init_acquire (size_t nbytes, size_t &rounded_bytes, int &first_time) |
Ask system for initial chunk of shared memory. | |
virtual void * | acquire (size_t nbytes, size_t &rounded_bytes) |
virtual int | release (int destroy=1) |
Instruct the memory pool to release all of its resources. | |
virtual int | sync (ssize_t len=-1, int flags=MS_SYNC) |
virtual int | sync (void *addr, size_t len, int flags=MS_SYNC) |
Sync the memory region to the backing store starting at <addr_>. | |
virtual int | protect (ssize_t len=-1, int prot=PROT_RDWR) |
virtual int | protect (void *addr, size_t len, int prot=PROT_RDWR) |
virtual int | seh_selector (void *) |
virtual int | remap (void *addr) |
virtual void * | base_addr (void) const |
Return the base address of this memory pool. | |
virtual void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Methods | |
virtual size_t | round_up (size_t nbytes) |
virtual int | commit_backing_store_name (size_t rounded_bytes, off_t &map_size) |
virtual int | map_file (off_t map_size) |
Memory map the file up to <map_size> bytes. | |
virtual int | handle_signal (int signum, siginfo_t *, ucontext_t *) |
Protected Attributes | |
ACE_Sig_Handler | signal_handler_ |
Handles SIGSEGV. | |
ACE_Mem_Map | mmap_ |
Memory-mapping object. | |
void * | base_addr_ |
int | use_fixed_addr_ |
Must we use the <base_addr_> or can we let mmap(2) select it? | |
int | flags_ |
Flags passed into <ACE_OS::mmap>. | |
int | write_each_page_ |
off_t | minimum_bytes_ |
What the minimum bytes of the initial segment should be. | |
ACE_TCHAR | backing_store_name_ [MAXPATHLEN+1] |
Name of the backing store where the shared memory pool is kept. | |
int | guess_on_fault_ |
LPSECURITY_ATTRIBUTES | sa_ |
Security attributes object, only used on NT. | |
mode_t | file_mode_ |
Protection mode for mmaped file. |
|
|
|
Initialize the pool.
|
|
Destructor.
|
|
Acquire at least <nbytes> from the memory pool. <rounded_bytes> is the actual number of bytes allocated. Also acquires an internal semaphore that ensures proper serialization of <ACE_MMAP_Memory_Pool> initialization across processes. |
|
Return the base address of this memory pool.
|
|
Compute the new <map_size> of the backing store and commit the memory. |
|
Dump the state of an object.
|
|
Handle SIGSEGV and SIGBUS signals to remap shared memory properly. Reimplemented from ACE_Event_Handler. |
|
Ask system for initial chunk of shared memory.
|
|
Memory map the file up to <map_size> bytes.
|
|
Change the protection of the pages of the mapped region to <prot> starting at <addr> up to <len> bytes. |
|
Change the protection of the pages of the mapped region to <prot> starting at <this->base_addr_> up to <len> bytes. If <len> == -1 then change protection of all pages in the mapped region. |
|
Instruct the memory pool to release all of its resources.
|
|
Try to extend the virtual address space so that <addr> is now covered by the address mapping. The method succeeds and returns 0 if the backing store has adequate memory to cover this address. Otherwise, it returns -1. This method is typically called by a UNIX signal handler for SIGSEGV or a Win32 structured exception when another process has grown the backing store (and its mapping) and our process now incurs a fault because our mapping isn't in range (yet). |
|
Implement the algorithm for rounding up the request to an appropriate chunksize. |
|
Win32 Structural exception selector. The return value decides how to handle memory pool related structural exceptions. Returns 1, 0, or , -1. |
|
Sync the memory region to the backing store starting at <addr_>.
Reimplemented in ACE_Lite_MMAP_Memory_Pool. |
|
Sync the memory region to the backing store starting at <this->base_addr_>. Reimplemented in ACE_Lite_MMAP_Memory_Pool. |
|
Declare the dynamic allocation hooks.
|
|
Name of the backing store where the shared memory pool is kept.
|
|
Base of mapped region. If this has the value of 0 then the OS is free to select any address to map the file, otherwise this value is what the OS must try to use to mmap the file. |
|
Protection mode for mmaped file.
|
|
Flags passed into <ACE_OS::mmap>.
|
|
Try to remap without knowing the faulting address. This parameter is ignored on platforms that know the faulting address (UNIX with SI_ADDR and Win32). |
|
What the minimum bytes of the initial segment should be.
|
|
Memory-mapping object.
|
|
Security attributes object, only used on NT.
|
|
Handles SIGSEGV.
|
|
Must we use the <base_addr_> or can we let mmap(2) select it?
|
|
Should we write a byte to each page to forceably allocate memory for this backing store? |