summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-98b36
-rw-r--r--ace/ACE.cpp14
-rw-r--r--ace/ACE.h6
-rw-r--r--ace/Asynch_IO.cpp12
-rw-r--r--ace/High_Res_Timer.cpp1
-rw-r--r--ace/Mem_Map.cpp27
-rw-r--r--ace/OS.h1
-rw-r--r--ace/OS.i14
-rw-r--r--ace/Proactor.cpp6
9 files changed, 86 insertions, 31 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b
index 368f52e5c88..ff7d0f5e055 100644
--- a/ChangeLog-98b
+++ b/ChangeLog-98b
@@ -1,12 +1,36 @@
+Fri Oct 09 00:44:21 1998 Irfan Pyarali <irfan@cs.wustl.edu>
+
+ * ace/OS.i (mmap): CreateFileMapping must be created with a length
+ of 0 (which will get translated to the size of the file). This
+ must not be <len> since <len> only deals with the mapping of the
+ view and not with the file mapping object. It is ok to use 0
+ since we are trying to emulate UNIX's mmap.
+
+ * ace/ACE.cpp (round_to_allocation_granularity):
+ ace/OS.i (allocation_granularity):
+
+ New methods. We need allocation granularity when rounding off
+ the offset in mmap and not the page size. Only on Win32,
+ allocation granularity is different from pagesize.
+
+ * ace/High_Res_Timer.cpp: Added the inclusion of Object_Manager.h.
+ Otherwise, NT was picking up the definition of
+ ACE_Static_Object_Lock.
+
+ * ace/Mem_Map.cpp (map_it): Fixed the problem where a requested
+ length of less than the filesize was being ignored. Also,
+ changed round_to_pagesize() to round_to_allocation_granularity().
+ Thanks to Jonathan Reis <reis@minniemouse.cemax.com> for
+ pointing this bug out.
+
Fri Oct 09 00:02:01 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu>
- * ace/Asynch_IO.cpp: Another problem with doing multiple
- Asynch_Accepts have been fixed. Thanks very much James Hu for
- reporting this. I was calling reactor's resume_handlers and
- suspend_handlers instead of only for one handle. Thanks very much
- Irfan! for pointing this out.
+ * ace/Asynch_IO.cpp: The YET another problem with doing multiple
+ Asynch_Accepts have been fixed. Thanks very much James Hu for
+ reporting this. I was calling reactor's resume_handlers and
+ suspend_handlers instead of only for one handle. Thanks very
+ much Irfan! for pointing this out.
-
Thu Oct 08 23:06:20 1998 David L. Levine <levine@cs.wustl.edu>
* config-linux-common.h: on Alpha only, added ACE_POLL_IS_BROKEN.
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 23177ec7683..3988b925d47 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -26,6 +26,9 @@ const char ACE::hex_chars_[] = "0123456789abcdef";
// Size of a VM page.
size_t ACE::pagesize_ = 0;
+// Size of allocation granularity.
+size_t ACE::allocation_granularity_ = 0;
+
int
ACE::init (void)
{
@@ -1540,6 +1543,17 @@ ACE::round_to_pagesize (off_t len)
return (len + (ACE::pagesize_ - 1)) & ~(ACE::pagesize_ - 1);
}
+size_t
+ACE::round_to_allocation_granularity (off_t len)
+{
+ ACE_TRACE ("ACE::round_to_allocation_granularity");
+
+ if (ACE::allocation_granularity_ == 0)
+ ACE::allocation_granularity_ = ACE_OS::allocation_granularity ();
+
+ return (len + (ACE::allocation_granularity_ - 1)) & ~(ACE::allocation_granularity_ - 1);
+}
+
ACE_HANDLE
ACE::handle_timed_complete (ACE_HANDLE h,
ACE_Time_Value *timeout,
diff --git a/ace/ACE.h b/ace/ACE.h
index badcaa2ace1..75be22a6b0b 100644
--- a/ace/ACE.h
+++ b/ace/ACE.h
@@ -546,6 +546,9 @@ public:
static size_t round_to_pagesize (off_t length);
// Rounds the request to a multiple of the page size.
+ static size_t round_to_allocation_granularity (off_t len);
+ // Rounds the request to a multiple of the allocation granularity.
+
static int format_hexdump (const char *buffer, int size,
ASYS_TCHAR *obuf, int obuf_sz);
// Format buffer into printable format. This is useful for
@@ -647,6 +650,9 @@ private:
static size_t pagesize_;
// Size of a VM page.
+ static size_t allocation_granularity_;
+ // Size of allocation granularity.
+
static u_long crc_table_[];
// CRC table.
diff --git a/ace/Asynch_IO.cpp b/ace/Asynch_IO.cpp
index 2a9f545e497..3d0287db1ea 100644
--- a/ace/Asynch_IO.cpp
+++ b/ace/Asynch_IO.cpp
@@ -18,9 +18,6 @@ ACE_RCSID(ace, Asynch_IO, "$Id$")
#include "ace/Asynch_IO.i"
#endif /* __ACE_INLINE__ */
-
-
-
ACE_Asynch_Result::ACE_Asynch_Result (ACE_Handler &handler,
const void* act,
ACE_HANDLE event,
@@ -840,9 +837,9 @@ ACE_Asynch_Accept_Handler::register_accept_call (ACE_Asynch_Accept::Result* resu
{
ACE_DEBUG ((LM_DEBUG, "ACE_Asynch_Accept_Handler::register_accept_call called\n"));
- // The queue is updated by main thread in the register function call and
- // thru the auxillary thread in the deregister fun. So let us mutex
- // it.
+ // The queue is updated by main thread in the register function call
+ // and thru the auxillary thread in the deregister fun. So let us
+ // mutex it.
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
// Insert this result to the queue.
@@ -882,8 +879,7 @@ ACE_Asynch_Accept_Handler::deregister_accept_call (void)
ACE_ASSERT (result != 0);
- // Disable the <handle> in the reactor if no <accept>'s are
- // pending.
+ // Disable the <handle> in the reactor if no <accept>'s are pending.
if (this->result_queue_.size () == 0)
{
int return_val = this->reactor_->suspend_handler (result->listen_handle ());
diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp
index a4be3741547..3a664298596 100644
--- a/ace/High_Res_Timer.cpp
+++ b/ace/High_Res_Timer.cpp
@@ -8,6 +8,7 @@
#endif /* __ACE_INLINE__ */
#include "ace/Stats.h"
+#include "ace/Object_Manager.h"
ACE_RCSID(ace, High_Res_Timer, "$Id$")
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);
diff --git a/ace/OS.h b/ace/OS.h
index cb8e2231e09..e1d9bc56ded 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -4568,6 +4568,7 @@ public:
// NT. argv[0] must be the full path name to the executable.
static int getpagesize (void);
+ static int allocation_granularity (void);
static gid_t getgid (void);
static pid_t getpid (void);
static pid_t getpgid (pid_t pid);
diff --git a/ace/OS.i b/ace/OS.i
index e4228308b7f..971b074e047 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -7440,7 +7440,7 @@ ACE_OS::mmap (void *addr,
ACE_OS::default_win32_security_attributes (sa),
prot,
0,
- len,
+ 0,
0);
if (*file_mapping == 0)
ACE_FAIL_RETURN (MAP_FAILED);
@@ -8728,6 +8728,18 @@ ACE_OS::getpagesize (void)
#endif /* ACE_WIN32 */
}
+ACE_INLINE int
+ACE_OS::allocation_granularity (void)
+{
+#if defined (ACE_WIN32)
+ SYSTEM_INFO sys_info;
+ ::GetSystemInfo (&sys_info);
+ return (int) sys_info.dwAllocationGranularity;
+#else
+ return ACE_OS::getpagesize ();
+#endif /* ACE_WIN32 */
+}
+
ACE_INLINE pid_t
ACE_OS::getpid (void)
{
diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp
index 35e015ad32e..60d5091c2cf 100644
--- a/ace/Proactor.cpp
+++ b/ace/Proactor.cpp
@@ -18,8 +18,8 @@ ACE_RCSID(ace, Proactor, "$Id$")
#include "ace/Proactor.i"
#endif /* __ACE_INLINE__ */
- // Process-wide ACE_Proactor.
- ACE_Proactor *ACE_Proactor::proactor_ = 0;
+// Process-wide ACE_Proactor.
+ACE_Proactor *ACE_Proactor::proactor_ = 0;
// Controls whether the Proactor is deleted when we shut down (we can
// only delete it safely if we created it!)
@@ -68,8 +68,6 @@ class ACE_Export ACE_Proactor_Timer_Handler : public ACE_Task <ACE_NULL_SYNCH>
// Flag used to indicate when we are shutting down.
};
-
-
ACE_Proactor_Timer_Handler::ACE_Proactor_Timer_Handler (ACE_Proactor &proactor)
: ACE_Task <ACE_NULL_SYNCH> (&proactor.thr_mgr_),
proactor_ (proactor),