mmap(2). This implementation allows memory to be shared between processes.  
More...
#include <MMAP_Memory_Pool.h>
Inheritance diagram for ACE_MMAP_Memory_Pool:


| Public Types | |
| typedef ACE_MMAP_Memory_Pool_Options | OPTIONS | 
| Public Member Functions | |
| 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 (size_t len, int flags=MS_SYNC) | 
| virtual int | sync (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 (size_t len, int prot=PROT_RDWR) | 
| virtual int | protect (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. | |
| ACE_Mem_Map const & | mmap (void) const | 
| Get reference to underlying ACE_Mem_Map object. | |
| ACE_Mem_Map & | mmap (void) | 
| Get reference to underlying ACE_Mem_Map object. | |
| Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
| Protected Member Functions | |
| virtual size_t | round_up (size_t nbytes) | 
| virtual int | commit_backing_store_name (size_t rounded_bytes, size_t &map_size) | 
| virtual int | map_file (size_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_ | 
| size_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. | |
| bool | guess_on_fault_ | 
| LPSECURITY_ATTRIBUTES | sa_ | 
| Security attributes object, only used on NT. | |
| mode_t | file_mode_ | 
| Protection mode for mmaped file. | |
mmap(2). This implementation allows memory to be shared between processes. 
Definition at line 132 of file MMAP_Memory_Pool.h.
| 
 | 
| 
 Definition at line 135 of file MMAP_Memory_Pool.h. | 
| 
 | ||||||||||||
| Initialize the pool. 
 Definition at line 116 of file MMAP_Memory_Pool.cpp. References ACE_DEFAULT_FILE_PERMS, ACE_ERROR, ACE_SET_BITS, ACE_TCHAR, ACE_TEXT, ACE_TRACE, backing_store_name_, ACE::get_temp_dir(), LM_ERROR, MAP_FIXED, MAP_SHARED, MAXPATHLEN, ACE_OS::mktemp(), ACE_Sig_Handler::register_handler(), signal_handler_, SIGSEGV, ACE_OS::strcat(), ACE_OS::strcpy(), and ACE_OS::strsncpy(). 
 00119 : base_addr_ (0), 00120 use_fixed_addr_(0), 00121 flags_ (MAP_SHARED), 00122 write_each_page_ (0), 00123 minimum_bytes_ (0), 00124 sa_ (0), 00125 file_mode_ (ACE_DEFAULT_FILE_PERMS) 00126 { 00127 ACE_TRACE ("ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool"); 00128 00129 #if (defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR)) || defined (ACE_WIN32) 00130 // For plaforms that give the faulting address. 00131 guess_on_fault_ = false; 00132 #else 00133 // For plaforms that do NOT give the faulting address, let the 00134 // options decide whether to guess or not. 00135 if (options) 00136 guess_on_fault_ = options->guess_on_fault_; 00137 else 00138 // If no options are specified, default to true. 00139 guess_on_fault_ = true; 00140 #endif /* (defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR)) || defined (ACE_WIN32) */ 00141 00142 // Only change the defaults if <options> != 0. 00143 if (options) 00144 { 00145 if (options->flags_ != 0) 00146 this->flags_ = options->flags_; 00147 use_fixed_addr_ = options->use_fixed_addr_; 00148 00149 if (use_fixed_addr_ == ACE_MMAP_Memory_Pool_Options::ALWAYS_FIXED) 00150 { 00151 this->base_addr_ = const_cast<void *> (options->base_addr_); 00152 ACE_SET_BITS (flags_, MAP_FIXED); 00153 } 00154 this->write_each_page_ = options->write_each_page_; 00155 this->minimum_bytes_ = options->minimum_bytes_; 00156 if (options->sa_ != 0) 00157 this->sa_ = options->sa_; 00158 this->file_mode_ = options->file_mode_; 00159 } 00160 00161 if (backing_store_name == 0) 00162 { 00163 // Only create a new unique filename for the backing store file 00164 // if the user didn't supply one... 00165 #if defined (ACE_DEFAULT_BACKING_STORE) 00166 // Create a temporary file. 00167 ACE_OS::strcpy (this->backing_store_name_, 00168 ACE_DEFAULT_BACKING_STORE); 00169 #else /* ACE_DEFAULT_BACKING_STORE */ 00170 if (ACE::get_temp_dir (this->backing_store_name_, 00171 MAXPATHLEN - 17) == -1) 00172 // -17 for ace-malloc-XXXXXX 00173 { 00174 ACE_ERROR ((LM_ERROR, 00175 ACE_TEXT ("Temporary path too long, ") 00176 ACE_TEXT ("defaulting to current directory\n"))); 00177 this->backing_store_name_[0] = 0; 00178 } 00179 00180 // Add the filename to the end 00181 ACE_OS::strcat (this->backing_store_name_, 00182 ACE_TEXT ("ace-malloc-XXXXXX")); 00183 00184 // If requested an unique filename, use mktemp to get a random file. 00185 if (options && options->unique_) 00186 ACE_OS::mktemp(this->backing_store_name_); 00187 #endif /* ACE_DEFAULT_BACKING_STORE */ 00188 } 00189 else 00190 ACE_OS::strsncpy (this->backing_store_name_, 00191 backing_store_name, 00192 (sizeof this->backing_store_name_ / sizeof (ACE_TCHAR))); 00193 00194 #if !defined (ACE_WIN32) 00195 if (this->signal_handler_.register_handler (SIGSEGV, this) == -1) 00196 ACE_ERROR ((LM_ERROR, 00197 "%p\n", this->backing_store_name_)); 00198 #endif /* ACE_WIN32 */ 00199 } | 
| 
 | 
| Destructor. 
 Definition at line 201 of file MMAP_Memory_Pool.cpp. 
 00202 {
00203 }
 | 
| 
 | ||||||||||||
| 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. Definition at line 323 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, ACE_Mem_Map::addr(), commit_backing_store_name(), map_file(), round_up(), and ACE_Mem_Map::size(). Referenced by init_acquire(). 
 00325 {
00326   ACE_TRACE ("ACE_MMAP_Memory_Pool::acquire");
00327   rounded_bytes = this->round_up (nbytes);
00328 
00329   // ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquiring more chunks, nbytes =
00330   // %B, rounded_bytes = %B\n", nbytes, rounded_bytes));
00331 
00332   size_t map_size;
00333 
00334   if (this->commit_backing_store_name (rounded_bytes,
00335                                        map_size) == -1)
00336     return 0;
00337   else if (this->map_file (map_size) == -1)
00338     return 0;
00339 
00340   // ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquired more chunks, nbytes = %B,
00341   // rounded_bytes = %B, map_size = %B\n", nbytes, rounded_bytes,
00342   // map_size));
00343 
00344   return (void *) ((char *) this->mmap_.addr () + (this->mmap_.size () - rounded_bytes));
00345 }
 | 
| 
 | 
| Return the base address of this memory pool. 
 Definition at line 531 of file MMAP_Memory_Pool.cpp. References ACE_TRACE. 
 00532 {
00533   ACE_TRACE ("ACE_MMAP_Memory_Pool::base_addr");
00534   return this->base_addr_;
00535 }
 | 
| 
 | ||||||||||||
| Compute the new map_size of the backing store and commit the memory. Definition at line 208 of file MMAP_Memory_Pool.cpp. References ACE_ERROR_RETURN, ACE_TEXT, ACE_TRACE, ACE_Mem_Map::handle(), LM_ERROR, ACE_OS::lseek(), round_up(), and ACE_OS::write(). Referenced by acquire(). 
 00210 {
00211   ACE_TRACE ("ACE_MMAP_Memory_Pool::commit_backing_store_name");
00212 
00213 #if defined (__Lynx__)
00214   map_size = rounded_bytes;
00215 #else
00216   size_t seek_len;
00217 
00218   if (this->write_each_page_)
00219     // Write to the end of every block to ensure that we have enough
00220     // space in the backing store.
00221     seek_len = this->round_up (1); // round_up(1) is one page.
00222   else
00223     // We're willing to risk it all in the name of efficiency...
00224     seek_len = rounded_bytes;
00225 
00226   // The following loop will execute multiple times (if
00227   // this->write_each_page == 1) or just once (if
00228   // this->write_each_page == 0).
00229 
00230   for (size_t cur_block = 0;
00231        cur_block < rounded_bytes;
00232        cur_block += seek_len)
00233     {
00234       map_size =
00235         ACE_Utils::truncate_cast<size_t> (
00236           ACE_OS::lseek (this->mmap_.handle (),
00237                          static_cast<ACE_OFF_T> (seek_len - 1),
00238                          SEEK_END));
00239 
00240       if (map_size == static_cast<size_t> (-1)
00241           || ACE_OS::write (this->mmap_.handle (),
00242                             "",
00243                             1) == -1)
00244         ACE_ERROR_RETURN ((LM_ERROR,
00245                            ACE_TEXT ("(%P|%t) %p\n"),
00246                            this->backing_store_name_),
00247                           -1);
00248     }
00249 
00250 #if defined (ACE_OPENVMS)
00251   ::fsync(this->mmap_.handle());
00252 #endif
00253 
00254   // Increment by one to put us at the beginning of the next chunk...
00255   ++map_size;
00256 #endif /* __Lynx__ */
00257   return 0;
00258 }
 | 
| 
 | 
| Dump the state of an object. 
 Definition at line 30 of file MMAP_Memory_Pool.cpp. References ACE_TRACE. 
 00031 {
00032 #if defined (ACE_HAS_DUMP)
00033   ACE_TRACE ("ACE_MMAP_Memory_Pool::dump");
00034 #endif /* ACE_HAS_DUMP */
00035 }
 | 
| 
 | ||||||||||||||||
| Handle SIGSEGV and SIGBUS signals to remap shared memory properly. Reimplemented from ACE_Event_Handler. Definition at line 475 of file MMAP_Memory_Pool.cpp. References ACE_DEBUG, ACE_TEXT, ACE_OS::filesize(), LM_DEBUG, map_file(), remap(), ACE_Sig_Handler::remove_handler(), signal_handler_, SIGSEGV, ACE_Mem_Map::size(), and ucontext_t. 
 00476 {
00477   if (signum != SIGSEGV)
00478     return -1;
00479 #if 0
00480   else
00481     ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("(%P|%t) received %S\n"), signum));
00482 #endif
00483   // ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("(%P|%t) new mapping address = %@\n"), (char *) this->base_addr_ + current_map_size));
00484 
00485 #if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR)
00486   // Make sure that the pointer causing the problem is within the
00487   // range of the backing store.
00488 
00489   if (siginfo != 0)
00490     {
00491       // ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("(%P|%t) si_signo = %d, si_code = %d, addr = %@\n"), siginfo->si_signo, siginfo->si_code, siginfo->si_addr));
00492       if (this->remap ((void *) siginfo->si_addr) == -1)
00493         return -1;
00494       // ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) address %@ out of range\n",
00495       // siginfo->si_addr), -1);
00496       return 0;
00497     }
00498 #else
00499   ACE_UNUSED_ARG(siginfo);
00500 #endif /* ACE_HAS_SIGINFO_T && !defined ACE_LACKS_SI_ADDR */
00501   // If guess_on_fault_ is true, then we want to try to remap without
00502   // knowing the faulting address.  guess_on_fault_ can only be true
00503   // on platforms that do not provide the faulting address through
00504   // signals or exceptions.  We check to see if the mapping is up to
00505   // date. If it is, then this fault isn't due to this mapping and we
00506   // pass it on.
00507   if (guess_on_fault_)
00508     {
00509       // Check if the current mapping is up to date.
00510       size_t const current_map_size =
00511         ACE_Utils::truncate_cast<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
00512 
00513       if (static_cast<size_t> (current_map_size) == this->mmap_.size ())
00514         {
00515           // The mapping is up to date so this really is a bad
00516           // address.  Thus, remove current signal handler so process
00517           // will fail with default action and core file will be
00518           // written.
00519           this->signal_handler_.remove_handler (SIGSEGV);
00520           return 0;
00521         }
00522 
00523       // Extend the mapping to cover the size of the backing store.
00524       return this->map_file (current_map_size);
00525     }
00526   else
00527     return -1;
00528 }
 | 
| 
 | ||||||||||||||||
| Ask system for initial chunk of shared memory. 
 Definition at line 350 of file MMAP_Memory_Pool.cpp. References ACE_ERROR_RETURN, ACE_TEXT, ACE_TRACE, acquire(), ACE_Mem_Map::addr(), LM_ERROR, ACE_Mem_Map::map(), ACE_Mem_Map::open(), PROT_RDWR, and ACE_Mem_Map::size(). 
 00353 {
00354   ACE_TRACE ("ACE_MMAP_Memory_Pool::init_acquire");
00355 
00356   first_time = 0;
00357 
00358   if (nbytes < static_cast <size_t> (this->minimum_bytes_))
00359     nbytes = static_cast <size_t> (this->minimum_bytes_);
00360 
00361   if (this->mmap_.open (this->backing_store_name_,
00362                         O_RDWR | O_CREAT | O_TRUNC | O_EXCL,
00363                         this->file_mode_, this->sa_) != -1)
00364     {
00365       // First time in, so need to acquire memory.
00366       first_time = 1;
00367       return this->acquire (nbytes, rounded_bytes);
00368     }
00369   else if (errno == EEXIST)
00370     {
00371       errno = 0;
00372       // Reopen file *without* using O_EXCL...
00373       if (this->mmap_.map (this->backing_store_name_,
00374                            static_cast<size_t> (-1),
00375                            O_RDWR,
00376                            this->file_mode_,
00377                            PROT_RDWR,
00378                            this->flags_,
00379                            this->base_addr_,
00380                            0,
00381                            this->sa_) == -1)
00382         ACE_ERROR_RETURN ((LM_ERROR,
00383                            ACE_TEXT ("%p\n"),
00384                            ACE_TEXT ("MMAP_Memory_Pool::init_acquire, EEXIST")),
00385                           0);
00386 
00387 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
00388       // Update the mapped segment information
00389       ACE_BASED_POINTER_REPOSITORY::instance ()->bind (this->mmap_.addr(),
00390                                                        this->mmap_.size());
00391 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
00392 
00393       return this->mmap_.addr ();
00394     }
00395   else
00396     ACE_ERROR_RETURN ((LM_ERROR,
00397                        ACE_TEXT ("%p\n"),
00398                        ACE_TEXT ("MMAP_Memory_Pool::init_acquire")),
00399                       0);
00400 }
 | 
| 
 | 
| Memory map the file up to map_size bytes. 
 Definition at line 263 of file MMAP_Memory_Pool.cpp. References ACE_ERROR, ACE_TEXT, ACE_TRACE, ACE_Mem_Map::addr(), backing_store_name_, LM_ERROR, ACE_Mem_Map::map(), PROT_RDWR, and ACE_Mem_Map::unmap(). Referenced by acquire(), handle_signal(), and remap(). 
 00264 {
00265   ACE_TRACE ("ACE_MMAP_Memory_Pool::map_file");
00266 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
00267     void* obase_addr = this->base_addr_;
00268 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
00269 
00270   // Unmap the existing mapping.
00271   this->mmap_.unmap ();
00272 
00273 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
00274   if (use_fixed_addr_ == ACE_MMAP_Memory_Pool_Options::NEVER_FIXED)
00275     this->base_addr_ = 0;
00276 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
00277 
00278   // Remap the file; try to stay at the same location as a previous mapping
00279   // but do not force it with MAP_FIXED. Doing so will give the OS permission
00280   // to map locations currently holding other things (such as the heap, or
00281   // the C library) into the map file, producing very unexpected results.
00282   if (this->mmap_.map (map_size,
00283                        PROT_RDWR,
00284                        this->flags_,
00285                        this->base_addr_,
00286                        0,
00287                        this->sa_) == -1
00288       || this->base_addr_ != 0
00289 #ifdef ACE_HAS_WINCE
00290       && this->mmap_.addr () == 0)  // WinCE does not allow users to specify alloc addr.
00291 #else
00292       && this->mmap_.addr () != this->base_addr_)
00293 #endif  // ACE_HAS_WINCE
00294     {
00295 #if 0
00296       ACE_ERROR ((LM_ERROR,
00297                   ACE_TEXT ("(%P|%t) addr = %@, base_addr = %@, map_size = %B, %p\n"),
00298                   this->mmap_.addr (),
00299                   this->base_addr_,
00300                   map_size,
00301                   this->backing_store_name_));
00302 #endif /* 0 */
00303       return -1;
00304     }
00305   else
00306     {
00307 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
00308       this->base_addr_ = this->mmap_.addr ();
00309       if(obase_addr && this->base_addr_ != obase_addr)
00310          ACE_BASED_POINTER_REPOSITORY::instance ()->unbind (obase_addr);
00311       ACE_BASED_POINTER_REPOSITORY::instance ()->bind (this->base_addr_,
00312                                                        map_size);
00313 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
00314       return 0;
00315     }
00316 }
 | 
| 
 | 
| Get reference to underlying ACE_Mem_Map object. 
 Definition at line 16 of file MMAP_Memory_Pool.inl. 
 00017 {
00018   return mmap_;
00019 }
 | 
| 
 | 
| Get reference to underlying ACE_Mem_Map object. 
 Definition at line 9 of file MMAP_Memory_Pool.inl. 
 00010 {
00011   return mmap_;
00012 }
 | 
| 
 | ||||||||||||||||
| Change the protection of the pages of the mapped region to prot starting at addr up to len bytes. Definition at line 110 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, and ACE_OS::mprotect(). 
 00111 {
00112   ACE_TRACE ("ACE_MMAP_Memory_Pool::protect");
00113   return ACE_OS::mprotect (addr, len, prot);
00114 }
 | 
| 
 | 
| Change the protection of all the pages of the mapped region to prot starting at <this->base_addr_>. Definition at line 95 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, ACE_OS::lseek(), and ACE_Mem_Map::protect(). 
 00096 {
00097   ACE_TRACE ("ACE_MMAP_Memory_Pool::protect");
00098 
00099   size_t const len = ACE_Utils::truncate_cast<size_t> (
00100     ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END));
00101 
00102   return this->mmap_.protect (len, prot);
00103 }
 | 
| 
 | ||||||||||||
| 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. Definition at line 87 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, and ACE_Mem_Map::protect(). 
 | 
| 
 | 
| Instruct the memory pool to release all of its resources. 
 Definition at line 38 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, ACE_Mem_Map::close(), and ACE_Mem_Map::remove(). 
 00039 {
00040   ACE_TRACE ("ACE_MMAP_Memory_Pool::release");
00041 
00042 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
00043   ACE_BASED_POINTER_REPOSITORY::instance ()->unbind (this->mmap_.addr ());
00044 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
00045 
00046   if (destroy)
00047   this->mmap_.remove ();
00048   else
00049     this->mmap_.close ();
00050   return 0;
00051 }
 | 
| 
 | 
| 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). Definition at line 422 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, ACE_Mem_Map::addr(), ACE_OS::filesize(), and map_file(). Referenced by handle_signal(), and seh_selector(). 
 00423 {
00424   ACE_TRACE ("ACE_MMAP_Memory_Pool::remap");
00425   //  ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("Remapping with fault address at: %@\n"), addr));
00426   size_t const current_map_size =
00427     ACE_Utils::truncate_cast<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
00428   // ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END);
00429 
00430   if (!(addr < (void *) ((char *) this->mmap_.addr () + current_map_size)
00431         && addr >= this->mmap_.addr ()))
00432     return -1;
00433 
00434   // Extend the mapping to cover the size of the backing store.
00435   return this->map_file (current_map_size);
00436 }
 | 
| 
 | 
| Implement the algorithm for rounding up the request to an appropriate chunksize. Definition at line 538 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, and ACE::round_to_pagesize(). Referenced by acquire(), and commit_backing_store_name(). 
 00539 {
00540   ACE_TRACE ("ACE_MMAP_Memory_Pool::round_up");
00541   return ACE::round_to_pagesize (nbytes);
00542 }
 | 
| 
 | 
| Win32 Structural exception selector. The return value decides how to handle memory pool related structural exceptions. Returns 1, 0, or , -1. Definition at line 404 of file MMAP_Memory_Pool.cpp. References remap(). 
 00405 {
00406   DWORD const ecode = ((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionCode;
00407 
00408   if (ecode == EXCEPTION_ACCESS_VIOLATION)
00409     {
00410       void * fault_addr = (void *)
00411         ((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionInformation[1];
00412 
00413       if (this->remap (fault_addr) == 0)
00414         return 1;
00415     }
00416 
00417   return 0;
00418 }
 | 
| 
 | ||||||||||||||||
| Sync the memory region to the backing store starting at addr. 
 Reimplemented in ACE_Lite_MMAP_Memory_Pool. Definition at line 76 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, and ACE_OS::msync(). 
 00077 {
00078   ACE_TRACE ("ACE_MMAP_Memory_Pool::sync");
00079   return ACE_OS::msync (addr, len, flags);
00080 }
 | 
| 
 | 
| 
Sync the memory region to the backing store starting at  Reimplemented in ACE_Lite_MMAP_Memory_Pool. Definition at line 62 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, ACE_OS::lseek(), and ACE_Mem_Map::sync(). 
 00063 {
00064   ACE_TRACE ("ACE_MMAP_Memory_Pool::sync");
00065 
00066   size_t const len = ACE_Utils::truncate_cast<size_t> (
00067     ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END));
00068 
00069   return this->mmap_.sync (len, flags);
00070 }
 | 
| 
 | ||||||||||||
| 
Sync the memory region to the backing store starting at  Reimplemented in ACE_Lite_MMAP_Memory_Pool. Definition at line 54 of file MMAP_Memory_Pool.cpp. References ACE_TRACE, and ACE_Mem_Map::sync(). 
 | 
| 
 | 
| Declare the dynamic allocation hooks. 
 Definition at line 226 of file MMAP_Memory_Pool.h. | 
| 
 | 
| Name of the backing store where the shared memory pool is kept. 
 Definition at line 272 of file MMAP_Memory_Pool.h. Referenced by ACE_MMAP_Memory_Pool(), and map_file(). | 
| 
 | 
| 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. Definition at line 256 of file MMAP_Memory_Pool.h. | 
| 
 | 
| Protection mode for mmaped file. 
 Definition at line 285 of file MMAP_Memory_Pool.h. | 
| 
 | 
| Flags passed into <ACE_OS::mmap>. 
 Definition at line 262 of file MMAP_Memory_Pool.h. | 
| 
 | 
| 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). Definition at line 279 of file MMAP_Memory_Pool.h. | 
| 
 | 
| What the minimum bytes of the initial segment should be. 
 Definition at line 269 of file MMAP_Memory_Pool.h. | 
| 
 | 
| Memory-mapping object. 
 Definition at line 249 of file MMAP_Memory_Pool.h. | 
| 
 | 
| Security attributes object, only used on NT. 
 Definition at line 282 of file MMAP_Memory_Pool.h. | 
| 
 | 
| Handles SIGSEGV. 
 Definition at line 246 of file MMAP_Memory_Pool.h. Referenced by ACE_MMAP_Memory_Pool(), and handle_signal(). | 
| 
 | 
| 
Must we use the  
 Definition at line 259 of file MMAP_Memory_Pool.h. | 
| 
 | 
| Should we write a byte to each page to forceably allocate memory for this backing store? Definition at line 266 of file MMAP_Memory_Pool.h. | 
 1.3.6
 
1.3.6