summaryrefslogtreecommitdiff
path: root/ace/Mem_Map.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-09 07:10:03 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-09 07:10:03 +0000
commit170161defe3d8e87e6fec943edc2aacdd4a2a50e (patch)
treec7068c45cba52cc292e217d18ce466805a70d77b /ace/Mem_Map.cpp
parentf3c855d3fe7f985d0c7de60cf168c9cd331821cf (diff)
downloadATCD-170161defe3d8e87e6fec943edc2aacdd4a2a50e.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/Mem_Map.cpp')
-rw-r--r--ace/Mem_Map.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/ace/Mem_Map.cpp b/ace/Mem_Map.cpp
index 78886304bbe..af7657d7a7b 100644
--- a/ace/Mem_Map.cpp
+++ b/ace/Mem_Map.cpp
@@ -66,7 +66,7 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
if (file_len == -1)
return -1;
- if (this->length_ < ACE_static_cast(size_t, file_len))
+ if (this->length_ < ACE_static_cast (size_t, file_len))
{
// If the length of the mapped region is less than the length of
// the file then we force a complete new remapping by setting
@@ -76,22 +76,25 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
}
// At this point we know <file_len> is not negative...
- this->length_ = ACE_static_cast(size_t, file_len);
+ this->length_ = ACE_static_cast (size_t, file_len);
if (len_request == -1)
len_request = 0;
- if ((this->length_ == 0 && len_request > 0)
- || this->length_ < ACE_static_cast(size_t, len_request))
- {
- this->length_ = len_request;
+ // Check to see if we need to extend the backing store
+ int extend_backing_store = 0;
+ if (this->length_ < ACE_static_cast (size_t, len_request))
+ extend_backing_store = 1;
- // Extend the backing store.
- if (ACE_OS::pwrite (this->handle_, "", 1,
- len_request > 0 ? len_request - 1 : 0) == -1)
- return -1;
- }
+ // Set the correct length
+ this->length_ = len_request;
+ if (extend_backing_store)
+ // Extend the backing store.
+ if (ACE_OS::pwrite (this->handle_, "", 1,
+ this->length_ > 0 ? this->length_ - 1 : 0) == -1)
+ return -1;
+
#if defined (__Lynx__)
// Set flag that indicates whether PROT_WRITE has been enabled.
write_enabled_ = prot & PROT_WRITE ? 1 : 0;
@@ -102,7 +105,7 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
prot,
share,
this->handle_,
- off_t (ACE::round_to_pagesize (pos)),
+ off_t (ACE::round_to_allocation_granularity (pos)),
&this->file_mapping_,
sa);