diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-09 07:10:03 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-09 07:10:03 +0000 |
commit | 9b0486755ef661078d7225a73bf58ecf5fce52c2 (patch) | |
tree | c7068c45cba52cc292e217d18ce466805a70d77b /ace | |
parent | 29b0505c3a342e927a00207ec1e90313149c6db1 (diff) | |
download | ATCD-9b0486755ef661078d7225a73bf58ecf5fce52c2.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ACE.cpp | 14 | ||||
-rw-r--r-- | ace/ACE.h | 6 | ||||
-rw-r--r-- | ace/Asynch_IO.cpp | 12 | ||||
-rw-r--r-- | ace/High_Res_Timer.cpp | 1 | ||||
-rw-r--r-- | ace/Mem_Map.cpp | 27 | ||||
-rw-r--r-- | ace/OS.h | 1 | ||||
-rw-r--r-- | ace/OS.i | 14 | ||||
-rw-r--r-- | ace/Proactor.cpp | 6 |
8 files changed, 56 insertions, 25 deletions
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); @@ -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); @@ -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), |