From c4078c377d74290ebe4e66da0b4975da91732376 Mon Sep 17 00:00:00 2001 From: "William R. Otte" Date: Tue, 4 Mar 2008 13:56:48 +0000 Subject: swap in externals for ACE and TAO --- ACE/ace/Mem_Map.inl | 238 ---------------------------------------------------- 1 file changed, 238 deletions(-) delete mode 100644 ACE/ace/Mem_Map.inl (limited to 'ACE/ace/Mem_Map.inl') diff --git a/ACE/ace/Mem_Map.inl b/ACE/ace/Mem_Map.inl deleted file mode 100644 index 78a99646a88..00000000000 --- a/ACE/ace/Mem_Map.inl +++ /dev/null @@ -1,238 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_mman.h" -#include "ace/OS_NS_sys_stat.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE ACE_HANDLE -ACE_Mem_Map::handle (void) const -{ - ACE_TRACE ("ACE_Mem_Map::handle"); - return this->handle_; -} - -// Return the name of file that is mapped (if any). - -ACE_INLINE const ACE_TCHAR * -ACE_Mem_Map::filename (void) const -{ - return this->filename_; -} - -ACE_INLINE int -ACE_Mem_Map::map (ACE_HANDLE handle, - size_t length, - int prot, - int share, - void *addr, - ACE_OFF_T offset, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_Mem_Map::map"); - return this->map_it (handle, length, prot, share, addr, offset, sa); -} - -// Remap the file associated with handle_>. - -ACE_INLINE int -ACE_Mem_Map::map (size_t length, - int prot, - int share, - void *addr, - ACE_OFF_T offset, - LPSECURITY_ATTRIBUTES sa) -{ - ACE_TRACE ("ACE_Mem_Map::map"); - // If we're already mapped at a particular location then try to - // remap the file using the same base address. - if (addr == 0 && this->base_addr_ != 0 && this->base_addr_ != MAP_FAILED) - { - share |= MAP_FIXED; - addr = this->base_addr_; - } - - return this->map_it (this->handle (), length, prot, - share, addr, offset, sa); -} - -// This operator passes back the starting address of the mapped file. - -ACE_INLINE int -ACE_Mem_Map::operator () (void *&addr) -{ - ACE_TRACE ("ACE_Mem_Map::operator"); - - if (this->base_addr_ == MAP_FAILED) - return -1; - else - { - addr = this->base_addr_; - return 0; - } -} - -// Return the base address. - -ACE_INLINE void * -ACE_Mem_Map::addr (void) const -{ - ACE_TRACE ("ACE_Mem_Map::addr"); - - return this->base_addr_; -} - -// This function returns the number of bytes currently mapped in the -// file. - -ACE_INLINE size_t -ACE_Mem_Map::size (void) const -{ - ACE_TRACE ("ACE_Mem_Map::size"); - return this->length_; -} - -ACE_INLINE int -ACE_Mem_Map::close_filemapping_handle (void) -{ - int result = 0; - - if (this->file_mapping_ != this->handle_ - && this->file_mapping_ != ACE_INVALID_HANDLE) - { - result = ACE_OS::close (this->file_mapping_); - this->file_mapping_ = ACE_INVALID_HANDLE; - } - - return result; -} - -// Unmap the region starting at base_addr_>. - -ACE_INLINE int -ACE_Mem_Map::unmap (ssize_t len) -{ - ACE_TRACE ("ACE_Mem_Map::unmap"); - - this->close_filemapping_handle (); - - if (this->base_addr_ != MAP_FAILED) - { - int const result = ACE_OS::munmap (this->base_addr_, - len < 0 ? this->length_ : len); - this->base_addr_ = MAP_FAILED; - return result; - } - else - return 0; -} - -// Unmap the region starting at . - -ACE_INLINE int -ACE_Mem_Map::unmap (void *addr, ssize_t len) -{ - ACE_TRACE ("ACE_Mem_Map::unmap"); - - this->close_filemapping_handle (); - - return ACE_OS::munmap (addr, - len < 0 ? this->length_ : len); -} - -// Sync bytes of the memory region to the backing store starting -// at base_addr_>. - -ACE_INLINE int -ACE_Mem_Map::sync (size_t len, int flags) -{ - ACE_TRACE ("ACE_Mem_Map::sync"); - return ACE_OS::msync (this->base_addr_, - len, - flags); -} - -// Sync the whole mapped region. -ACE_INLINE int -ACE_Mem_Map::sync (int flags) -{ - ACE_TRACE ("ACE_Mem_Map::sync"); - return ACE_OS::msync (this->base_addr_, - this->length_, - flags); -} - -// Sync bytes of the memory region to the backing store starting -// at . - -ACE_INLINE int -ACE_Mem_Map::sync (void *addr, size_t len, int flags) -{ - ACE_TRACE ("ACE_Mem_Map::sync"); - return ACE_OS::msync (addr, len, flags); -} - -// Change the protection of the pages of the mapped region to -// starting at base_addr_> up to bytes. - -ACE_INLINE int -ACE_Mem_Map::protect (size_t len, int prot) -{ - ACE_TRACE ("ACE_Mem_Map::protect"); - return ACE_OS::mprotect (this->base_addr_, len, prot); -} - - -// Change the protection of all the pages of the mapped region to -// starting at base_addr_>. - -ACE_INLINE int -ACE_Mem_Map::protect (int prot) -{ - ACE_TRACE ("ACE_Mem_Map::protect"); - return ACE_OS::mprotect (this->base_addr_, this->length_, prot); -} - -// Change the protection of the pages of the mapped region to -// starting at up to bytes. - -ACE_INLINE int -ACE_Mem_Map::protect (void *addr, size_t len, int prot) -{ - ACE_TRACE ("ACE_Mem_Map::protect"); - return ACE_OS::mprotect (addr, len, prot); -} - -// Hook into the underlying VM system. - -ACE_INLINE int -ACE_Mem_Map::advise (int behavior, int len) -{ - ACE_TRACE ("ACE_Mem_Map::advise"); - const size_t advise_len = - len < 0 ? this->length_ : static_cast (len); - - return ACE_OS::madvise ((caddr_t) this->base_addr_, - advise_len, - behavior); -} - -ACE_INLINE int -ACE_Mem_Map::close_handle (void) -{ - int result = 0; - - if (this->close_handle_) - { - this->close_handle_ = false; - result = ACE_OS::close (this->handle_); - this->handle_ = ACE_INVALID_HANDLE; - } - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL -- cgit v1.2.1