diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-26 05:49:05 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-26 05:49:05 +0000 |
commit | c156e4165414878488df7295ed6e766a3b1c6160 (patch) | |
tree | 68f9518e2e6e275d3caac90b6b99f5c2d49820f7 /ace | |
parent | e6481c380f40e557fc010b984915d840f42fa585 (diff) | |
download | ATCD-c156e4165414878488df7295ed6e766a3b1c6160.tar.gz |
rock and roll!
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Local_Name_Space_T.cpp | 9 | ||||
-rw-r--r-- | ace/Malloc_T.cpp | 185 | ||||
-rw-r--r-- | ace/Malloc_T.h | 49 | ||||
-rw-r--r-- | ace/Malloc_T.i | 28 | ||||
-rw-r--r-- | ace/Memory_Pool.cpp | 68 | ||||
-rw-r--r-- | ace/Memory_Pool.h | 90 | ||||
-rw-r--r-- | ace/Naming_Context.cpp | 40 | ||||
-rw-r--r-- | ace/Naming_Context.h | 7 | ||||
-rw-r--r-- | ace/OS.h | 100 | ||||
-rw-r--r-- | ace/SOCK.h | 15 | ||||
-rw-r--r-- | ace/SPIPE.h | 21 | ||||
-rw-r--r-- | ace/Svc_Handler.h | 12 | ||||
-rw-r--r-- | ace/TLI.h | 15 | ||||
-rw-r--r-- | ace/config-win32-msvc4.0.h | 3 |
14 files changed, 440 insertions, 202 deletions
diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp index 557ed0888d6..2a03ef5a338 100644 --- a/ace/Local_Name_Space_T.cpp +++ b/ace/Local_Name_Space_T.cpp @@ -350,8 +350,15 @@ ACE_Local_Name_Space<MEM_POOL, LOCK>::create_manager (void) ACE_DEBUG ((LM_DEBUG, "contextfile is %s\n", this->context_file_)); - +#if defined (ACE_HAS_NESTED_TRAITS) + ALLOCATOR::ALLOCATOR::MEMORY_POOL::Options options (this->name_options_->base_address ()); + ACE_NEW_RETURN (this->allocator_, ALLOCATOR (options, this->context_file_), -1); +#else ACE_NEW_RETURN (this->allocator_, ALLOCATOR (this->context_file_), -1); +#endif /* ACE_HAS_NESTED_TRAITS */ + + if (ACE_LOG_MSG->errnum ()) + ACE_ERROR_RETURN ((LM_ERROR, "Allocator::Allocator\n"), -1); // Now check if the backing store has been created successfully if (ACE_OS::access (this->context_file_, F_OK) != 0) diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp index 52390601baa..8c79cf07c5a 100644 --- a/ace/Malloc_T.cpp +++ b/ace/Malloc_T.cpp @@ -14,6 +14,23 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Malloc) template <class MALLOC> +ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter (const MEMORY_POOL_OPTIONS &options, + const char *pool_name, + const char *lock_name) + : allocator_ (options, pool_name, lock_name) +{ + ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter"); +} + +template <class MALLOC> +ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter (const MEMORY_POOL_OPTIONS &options, + const char *pool_name) + : allocator_ (options, pool_name) +{ + ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter"); +} + +template <class MALLOC> ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter (const char *pool_name, const char *lock_name) : allocator_ (pool_name, lock_name) @@ -35,10 +52,10 @@ ACE_Allocator_Adapter<MALLOC>::dump (void) const this->allocator_.dump (); } -template <class MEM_POOL, class LOCK> void -ACE_Malloc<MEM_POOL, LOCK>::dump (void) const +template <ACE_MEM_POOL_1, class LOCK> void +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::dump (void) const { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::dump"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); this->memory_pool_.dump (); @@ -52,10 +69,10 @@ ACE_Malloc<MEM_POOL, LOCK>::dump (void) const #if defined (ACE_MALLOC_STATS) -template <class MEM_POOL, class LOCK> void -ACE_Malloc<MEM_POOL, LOCK>::print_stats (void) +template <ACE_MEM_POOL_1, class LOCK> void +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::print_stats (void) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::print_stats"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::print_stats"); ACE_GUARD (LOCK, ace_mon, this->lock_); this->cb_ptr_->malloc_stats_.print (); @@ -77,10 +94,10 @@ ACE_Malloc<MEM_POOL, LOCK>::print_stats (void) // Put block AP in the free list (locked version). -template<class MEM_POOL, class LOCK> void -ACE_Malloc<MEM_POOL, LOCK>::free (void *ap) +template<ACE_MEM_POOL_1, class LOCK> void +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::free (void *ap) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::free"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::free"); ACE_GUARD (LOCK, ace_mon, this->lock_); this->shared_free (ap); @@ -93,10 +110,10 @@ ACE_Malloc<MEM_POOL, LOCK>::free (void *ap) // vs. local) subsequent calls from other processes will only // initialize the control block pointer. -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::open (void) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::open (void) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::open"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::open"); ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, -1); size_t rounded_bytes = 0; @@ -151,34 +168,54 @@ ACE_Malloc<MEM_POOL, LOCK>::open (void) return 0; } -template <class MEM_POOL, class LOCK> -ACE_Malloc<MEM_POOL, LOCK>::ACE_Malloc (const char *pool_name) +template <ACE_MEM_POOL_1, class LOCK> +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::ACE_Malloc (const char *pool_name) : memory_pool_ (pool_name), lock_ (pool_name == 0 ? 0 : ACE::basename (pool_name, ACE_DIRECTORY_SEPARATOR_CHAR)) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::ACE_Malloc"); - + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::ACE_Malloc"); this->open (); } -template <class MEM_POOL, class LOCK> -ACE_Malloc<MEM_POOL, LOCK>::ACE_Malloc (const char *pool_name, +template <ACE_MEM_POOL_1, class LOCK> +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::ACE_Malloc (const char *pool_name, const char *lock_name) : memory_pool_ (pool_name), lock_ (lock_name) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::ACE_Malloc"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::ACE_Malloc"); + this->open (); +} +template <ACE_MEM_POOL_1, class LOCK> +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::ACE_Malloc (const ACE_MEM_POOL_OPTIONS &options, + const char *pool_name, + const char *lock_name) + : memory_pool_ (options, pool_name), + lock_ (lock_name) +{ + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::ACE_Malloc"); + this->open (); +} + +template <ACE_MEM_POOL_1, class LOCK> +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::ACE_Malloc (const ACE_MEM_POOL_OPTIONS &options, + const char *pool_name) + : memory_pool_ (options, pool_name), + lock_ (pool_name == 0 ? 0 : ACE::basename (pool_name, + ACE_DIRECTORY_SEPARATOR_CHAR)) +{ + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::ACE_Malloc"); this->open (); } // Clean up the resources allocated by ACE_Malloc. -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::remove (void) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::remove (void) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::remove"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::remove"); // ACE_DEBUG ((LM_DEBUG, "(%P|%t) destroying ACE_Malloc\n")); int result = 0; @@ -197,10 +234,10 @@ ACE_Malloc<MEM_POOL, LOCK>::remove (void) // General-purpose memory allocator. Assumes caller holds the locks. -template <class MEM_POOL, class LOCK> void * -ACE_Malloc<MEM_POOL, LOCK>::shared_malloc (size_t nbytes) +template <ACE_MEM_POOL_1, class LOCK> void * +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::shared_malloc (size_t nbytes) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::shared_malloc"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::shared_malloc"); // Round up request to a multiple of the ACE_Malloc_Header size. size_t nunits = (nbytes + sizeof (ACE_Malloc_Header) - 1) @@ -265,10 +302,10 @@ ACE_Malloc<MEM_POOL, LOCK>::shared_malloc (size_t nbytes) // General-purpose memory allocator. -template <class MEM_POOL, class LOCK> void * -ACE_Malloc<MEM_POOL, LOCK>::malloc (size_t nbytes) +template <ACE_MEM_POOL_1, class LOCK> void * +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::malloc (size_t nbytes) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::malloc"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::malloc"); ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, 0); return this->shared_malloc (nbytes); @@ -276,11 +313,11 @@ ACE_Malloc<MEM_POOL, LOCK>::malloc (size_t nbytes) // General-purpose memory allocator. -template <class MEM_POOL, class LOCK> void * -ACE_Malloc<MEM_POOL, LOCK>::calloc (size_t nbytes, +template <ACE_MEM_POOL_1, class LOCK> void * +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::calloc (size_t nbytes, char initial_value) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::calloc"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::calloc"); void *ptr = this->malloc (nbytes); if (ptr != 0) @@ -291,10 +328,10 @@ ACE_Malloc<MEM_POOL, LOCK>::calloc (size_t nbytes, // Put block AP in the free list (must be called with locks held!) -template <class MEM_POOL, class LOCK> void -ACE_Malloc<MEM_POOL, LOCK>::shared_free (void *ap) +template <ACE_MEM_POOL_1, class LOCK> void +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::shared_free (void *ap) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::shared_free"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::shared_free"); if (ap == 0) return; @@ -343,10 +380,10 @@ ACE_Malloc<MEM_POOL, LOCK>::shared_free (void *ap) // No locks held here, caller must acquire/release lock. -template <class MEM_POOL, class LOCK> ACE_Name_Node * -ACE_Malloc<MEM_POOL, LOCK>::shared_find (const char *name) +template <ACE_MEM_POOL_1, class LOCK> ACE_Name_Node * +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::shared_find (const char *name) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::shared_find"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::shared_find"); for (ACE_Name_Node *node = this->cb_ptr_->name_head_; node != 0; @@ -357,8 +394,8 @@ ACE_Malloc<MEM_POOL, LOCK>::shared_find (const char *name) return 0; } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::shared_bind (const char *name, +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::shared_bind (const char *name, void *pointer) { // Combine the two allocations into one to avoid overhead... @@ -380,11 +417,11 @@ ACE_Malloc<MEM_POOL, LOCK>::shared_bind (const char *name, return 0; } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::trybind (const char *name, +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::trybind (const char *name, void *&pointer) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::trybind"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::trybind"); ACE_Write_Guard<LOCK> mon (this->lock_); ACE_Name_Node *node = this->shared_find (name); @@ -399,12 +436,12 @@ ACE_Malloc<MEM_POOL, LOCK>::trybind (const char *name, } } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::bind (const char *name, +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::bind (const char *name, void *pointer, int duplicates) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::bind"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::bind"); ACE_Write_Guard<LOCK> mon (this->lock_); if (duplicates == 0 && this->shared_find (name) != 0) @@ -418,10 +455,10 @@ ACE_Malloc<MEM_POOL, LOCK>::bind (const char *name, return this->shared_bind (name, pointer); } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::find (const char *name, void *&pointer) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::find (const char *name, void *&pointer) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::find"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::find"); ACE_Read_Guard<LOCK> mon (this->lock_); @@ -436,19 +473,19 @@ ACE_Malloc<MEM_POOL, LOCK>::find (const char *name, void *&pointer) } } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::find (const char *name) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::find (const char *name) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::find"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::find"); ACE_Read_Guard<LOCK> mon (this->lock_); return this->shared_find (name) == 0 ? -1 : 0; } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::unbind (const char *name, void *&pointer) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::unbind (const char *name, void *&pointer) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::unbind"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::unbind"); ACE_Write_Guard<LOCK> mon (this->lock_); ACE_Name_Node *prev = 0; @@ -478,19 +515,19 @@ ACE_Malloc<MEM_POOL, LOCK>::unbind (const char *name, void *&pointer) return -1; } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::unbind (const char *name) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::unbind (const char *name) { - ACE_TRACE ("ACE_Malloc<MEM_POOL, LOCK>::unbind"); + ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, LOCK>::unbind"); void *temp = 0; return this->unbind (name, temp); } -template <class MEM_POOL, class LOCK> void -ACE_Malloc_Iterator<MEM_POOL, LOCK>::dump (void) const +template <ACE_MEM_POOL_1, class LOCK> void +ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::dump (void) const { - ACE_TRACE ("ACE_Malloc_Iterator<MEM_POOL, LOCK>::dump"); + ACE_TRACE ("ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); this->curr_->dump (); @@ -500,15 +537,15 @@ ACE_Malloc_Iterator<MEM_POOL, LOCK>::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -template <class MEM_POOL, class LOCK> -ACE_Malloc_Iterator<MEM_POOL, LOCK>::ACE_Malloc_Iterator (ACE_Malloc<MEM_POOL, LOCK> &malloc, +template <ACE_MEM_POOL_1, class LOCK> +ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::ACE_Malloc_Iterator (ACE_Malloc<ACE_MEM_POOL_2, LOCK> &malloc, const char *name) : malloc_ (malloc), guard_ (malloc_.lock_), curr_ (0), name_ (name != 0 ? ACE_OS::strdup (name) : 0) { - ACE_TRACE ("ACE_Malloc_Iterator<MEM_POOL, LOCK>::ACE_Malloc_Iterator"); + ACE_TRACE ("ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::ACE_Malloc_Iterator"); // Cheap trick to make code simple. ACE_Name_Node temp; this->curr_ = &temp; @@ -517,17 +554,17 @@ ACE_Malloc_Iterator<MEM_POOL, LOCK>::ACE_Malloc_Iterator (ACE_Malloc<MEM_POOL, L this->advance(); } -template <class MEM_POOL, class LOCK> -ACE_Malloc_Iterator<MEM_POOL, LOCK>::~ACE_Malloc_Iterator (void) +template <ACE_MEM_POOL_1, class LOCK> +ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::~ACE_Malloc_Iterator (void) { ACE_OS::free ((void *) this->name_); } -template <class MEM_POOL, class LOCK> int -ACE_Malloc_Iterator<MEM_POOL, LOCK>::next (void *&next_entry, +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::next (void *&next_entry, char *&name) { - ACE_TRACE ("ACE_Malloc_Iterator<MEM_POOL, LOCK>::next"); + ACE_TRACE ("ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::next"); if (curr_ != 0) { @@ -539,10 +576,10 @@ ACE_Malloc_Iterator<MEM_POOL, LOCK>::next (void *&next_entry, return 0; } -template <class MEM_POOL, class LOCK> int -ACE_Malloc_Iterator<MEM_POOL, LOCK>::next (void *&next_entry) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::next (void *&next_entry) { - ACE_TRACE ("ACE_Malloc_Iterator<MEM_POOL, LOCK>::next"); + ACE_TRACE ("ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::next"); if (curr_ != 0) { @@ -553,10 +590,10 @@ ACE_Malloc_Iterator<MEM_POOL, LOCK>::next (void *&next_entry) return 0; } -template <class MEM_POOL, class LOCK> int -ACE_Malloc_Iterator<MEM_POOL, LOCK>::advance (void) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::advance (void) { - ACE_TRACE ("ACE_Malloc_Iterator<MEM_POOL, LOCK>::advance"); + ACE_TRACE ("ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>::advance"); this->curr_ = this->curr_->next_; diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h index 89434879f31..a86199bc850 100644 --- a/ace/Malloc_T.h +++ b/ace/Malloc_T.h @@ -32,12 +32,22 @@ class ACE_Allocator_Adapter : public ACE_Allocator public: // Trait. typedef MALLOC ALLOCATOR; + typedef ALLOCATOR::MEMORY_POOL_OPTIONS MEMORY_POOL_OPTIONS; // = Initialization. - ACE_Allocator_Adapter (const char *pool_name = ACE_DEFAULT_MUTEX); + ACE_Allocator_Adapter (const char *pool_name = 0); + // Constructor. ACE_Allocator_Adapter (const char *pool_name, const char *lock_name); // Constructor. + ACE_Allocator_Adapter (const MEMORY_POOL_OPTIONS &options, + const char *pool_name, + const char *lock_name); + // Constructor. + + ACE_Allocator_Adapter (const MEMORY_POOL_OPTIONS &options, + const char *pool_name = 0); + // Constructor. // = Memory Management @@ -121,10 +131,10 @@ private: }; // Forward declaration. -template <class MEM_POOL, class LOCK> +template <ACE_MEM_POOL_1, class LOCK> class ACE_Malloc_Iterator; -template <class MEM_POOL, class LOCK> +template <ACE_MEM_POOL_1, class LOCK> class ACE_Malloc // = TITLE // Define a C++ class that uses parameterized types to provide @@ -136,9 +146,10 @@ class ACE_Malloc // MEMORY_POOL strategies and different types of LOCK // strategies. { -friend class ACE_Malloc_Iterator<MEM_POOL, LOCK>; +friend class ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>; public: - typedef MEM_POOL MEMORY_POOL; + typedef ACE_MEM_POOL MEMORY_POOL; + typedef ACE_MEM_POOL_OPTIONS MEMORY_POOL_OPTIONS; // = Initialization and termination methods. ACE_Malloc (const char *pool_name = 0); @@ -154,6 +165,21 @@ public: // extract out the name used for the underlying lock name (if // necessary). + ACE_Malloc (const ACE_MEM_POOL_OPTIONS &options, + const char *pool_name, + const char *lock_name); + // Initialize ACE_Malloc. This constructor passes <pool_name> to + // initialize the memory pool, and uses <lock_name> to automatically + // extract out the name used for the underlying lock name (if + // necessary). In addition, <options> is passed through to + // initialize the underlying memory pool. + + ACE_Malloc (const ACE_MEM_POOL_OPTIONS &options, + const char *pool_name = 0); + // Initialize ACE_Malloc. This constructor passes <pool_name> to + // initialize the memory pool. In addition, <options> is passed + // through to initialize the underlying memory pool. + int remove (void); // Releases resources allocated by ACE_Malloc. @@ -261,18 +287,19 @@ private: void shared_free (void *ptr); // Deallocate memory. Assumes that locks are held by callers. - MEMORY_POOL memory_pool_; - // Pool of memory used by ACE_Malloc - ACE_Control_Block *cb_ptr_; // Pointer to the control block (stored in memory controlled by // MEMORY_POOL). + MEMORY_POOL memory_pool_; + // Pool of memory used by ACE_Malloc + LOCK lock_; // Local that ensures mutual exclusion. + }; -template <class MEM_POOL, class LOCK> +template <ACE_MEM_POOL_1, class LOCK> class ACE_Malloc_Iterator // = TITLE // Iterator for names stored in Malloc'd memory. @@ -282,7 +309,7 @@ class ACE_Malloc_Iterator { public: // = Initialization method. - ACE_Malloc_Iterator (ACE_Malloc<MEM_POOL, LOCK> &malloc, const char *name = 0); + ACE_Malloc_Iterator (ACE_Malloc<ACE_MEM_POOL_2, LOCK> &malloc, const char *name = 0); // if <name> = 0 it will iterate through everything else only // through those entries whose <name> match @@ -309,7 +336,7 @@ public: // Declare the dynamic allocation hooks. private: - ACE_Malloc<MEM_POOL, LOCK> &malloc_; + ACE_Malloc<ACE_MEM_POOL_2, LOCK> &malloc_; // Malloc we are iterating over. ACE_Name_Node *curr_; diff --git a/ace/Malloc_T.i b/ace/Malloc_T.i index a66cb7ef7fd..7d1f507b278 100644 --- a/ace/Malloc_T.i +++ b/ace/Malloc_T.i @@ -88,61 +88,61 @@ ACE_Allocator_Adapter<MALLOC>::unbind (const char *name) template <class MALLOC> ACE_INLINE int ACE_Allocator_Adapter<MALLOC>::sync (ssize_t len, int flags) { - ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::sync"); + ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::sync"); return this->allocator_.sync (len, flags); } template <class MALLOC> ACE_INLINE int ACE_Allocator_Adapter<MALLOC>::sync (void *addr, size_t len, int flags) { - ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::sync"); + ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::sync"); return this->allocator_.sync (addr, len, flags); } template <class MALLOC> ACE_INLINE int ACE_Allocator_Adapter<MALLOC>::protect (ssize_t len, int flags) { - ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::protect"); + ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::protect"); return this->allocator_.protect (len, flags); } template <class MALLOC> ACE_INLINE int ACE_Allocator_Adapter<MALLOC>::protect (void *addr, size_t len, int flags) { - ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::protect"); + ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::protect"); return this->allocator_.protect (addr, len, flags); } -template <class MEM_POOL, class LOCK> MEM_POOL & -ACE_Malloc<MEM_POOL, LOCK>::memory_pool (void) +template <ACE_MEM_POOL_1, class LOCK> ACE_MEM_POOL & +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::memory_pool (void) { ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::memory_pool"); return this->memory_pool_; } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::sync (ssize_t len, int flags) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::sync (ssize_t len, int flags) { ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::sync"); return this->memory_pool_.sync (len, flags); } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::sync (void *addr, size_t len, int flags) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::sync (void *addr, size_t len, int flags) { ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::sync"); return this->memory_pool_.sync (addr, len, flags); } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::protect (ssize_t len, int flags) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::protect (ssize_t len, int flags) { ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::protect"); return this->memory_pool_.protect (len, flags); } -template <class MEM_POOL, class LOCK> int -ACE_Malloc<MEM_POOL, LOCK>::protect (void *addr, size_t len, int flags) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::protect (void *addr, size_t len, int flags) { ACE_TRACE ("ACE_Malloc<MEMORY_POOL, LOCK>::protect"); return this->memory_pool_.protect (addr, len, flags); diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp index 2ec2b76c6a9..6224420cf7d 100644 --- a/ace/Memory_Pool.cpp +++ b/ace/Memory_Pool.cpp @@ -23,6 +23,12 @@ ACE_Local_Memory_Pool::ACE_Local_Memory_Pool (const char *) ACE_TRACE ("ACE_Local_Memory_Pool::ACE_Local_Memory_Pool"); } +ACE_Local_Memory_Pool::ACE_Local_Memory_Pool (const OPTIONS &, + const char *) +{ + ACE_TRACE ("ACE_Local_Memory_Pool::ACE_Local_Memory_Pool"); +} + void * ACE_Local_Memory_Pool::acquire (size_t nbytes, size_t &rounded_bytes) @@ -102,13 +108,30 @@ ACE_MMAP_Memory_Pool::protect (void *addr, size_t len, int prot) return ACE_OS::mprotect (addr, len, prot); } -ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (const char *pool_name, - int use_fixed_addr, - int write_each_page, - char *base_addr) - : base_addr_ (use_fixed_addr ? base_addr : 0), - flags_ (MAP_SHARED | (use_fixed_addr ? MAP_FIXED : 0)), - write_each_page_ (write_each_page) +ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (const char *pool_name) + : base_addr_ (ACE_DEFAULT_BACKING_STORE), + flags_ (MAP_SHARED | MAP_FIXED), + write_each_page_ (1) +{ + ACE_TRACE ("ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool"); + + if (pool_name == 0) + // Only create a new unique filename for the backing store file + // if the user didn't supply one... + pool_name = ACE_DEFAULT_BACKING_STORE; // from "ace/OS.h" + + ACE_OS::strncpy (this->backing_store_, pool_name, + sizeof this->backing_store_); + + if (this->signal_handler_.register_handler (SIGSEGV, this) == -1) + ACE_ERROR ((LM_ERROR, "%p\n", this->backing_store_)); +} + +ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (const OPTIONS &options, + const char *pool_name) + : base_addr_ (options.use_fixed_addr_ ? options.base_addr_ : 0), + flags_ (MAP_SHARED | (options.use_fixed_addr_ ? MAP_FIXED : 0)), + write_each_page_ (options.write_each_page_) { ACE_TRACE ("ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool"); @@ -126,7 +149,6 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (const char *pool_name, // Compute the new file_offset of the backing store and commit the // memory. - int ACE_MMAP_Memory_Pool::commit_backing_store (size_t rounded_bytes, off_t &file_offset) @@ -234,6 +256,7 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes, } else if (errno == EEXIST) { + errno = 0; // Reopen file *without* using O_EXCL... if (this->mmap_.map (this->backing_store_, -1, @@ -312,11 +335,15 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t ACE_ALLOC_HOOK_DEFINE(ACE_Lite_MMAP_Memory_Pool) -ACE_Lite_MMAP_Memory_Pool::ACE_Lite_MMAP_Memory_Pool (const char *pool_name, - int use_fixed_addr, - int write_each_page, - char *base_addr) - : ACE_MMAP_Memory_Pool (pool_name, use_fixed_addr, write_each_page, base_addr) +ACE_Lite_MMAP_Memory_Pool::ACE_Lite_MMAP_Memory_Pool (const char *pool_name) + : ACE_MMAP_Memory_Pool (pool_name) +{ + ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::ACE_Lite_MMAP_Memory_Pool"); +} + +ACE_Lite_MMAP_Memory_Pool::ACE_Lite_MMAP_Memory_Pool (const OPTIONS &options, + const char *pool_name) + : ACE_MMAP_Memory_Pool (options, pool_name) { ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::ACE_Lite_MMAP_Memory_Pool"); } @@ -366,6 +393,12 @@ ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool (const char *) { ACE_TRACE ("ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool"); } + +ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool (const OPTIONS &options, + const char *) +{ + ACE_TRACE ("ACE_Sbrk_Memory_Pool::ACE_Sbrk_Memory_Pool"); +} #endif /* !ACE_LACKS_SBRK */ #if !defined (ACE_LACKS_SYSV_SHMEM) @@ -467,6 +500,15 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *) return 0; } +ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (const OPTIONS &options, + const char *) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool"); + + if (this->signal_handler_.register_handler (SIGSEGV, this) == -1) + ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Sig_Handler::register_handler")); +} + ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (const char *pool_name) { ACE_TRACE ("ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool"); diff --git a/ace/Memory_Pool.h b/ace/Memory_Pool.h index de4c69126f8..ef264634089 100644 --- a/ace/Memory_Pool.h +++ b/ace/Memory_Pool.h @@ -27,14 +27,29 @@ #endif /* !ACE_WIN32 */ #if !defined (ACE_LACKS_SBRK) +class ACE_Export ACE_Sbrk_Memory_Pool_Options + // = TITLE + // Helper class for constructor options. + // + // = DESCRIPTION + // This should be a nested class, but that breaks too many + // compilers. +{}; + class ACE_Export ACE_Sbrk_Memory_Pool // = TITLE // Make a memory pool that is based on <sbrk(2)>. { public: + typedef ACE_Sbrk_Memory_Pool_Options OPTIONS; + ACE_Sbrk_Memory_Pool (const char *pool_name = 0); // Initialization constructor. + ACE_Sbrk_Memory_Pool (const OPTIONS &options, + const char *pool_name = 0); + // Initialize the pool via the options. + // = Implementor operations. virtual void *init_acquire (size_t nbytes, size_t &rounded_bytes, @@ -81,6 +96,15 @@ protected: #endif /* !ACE_LACKS_SBRK */ #if !defined (ACE_LACKS_SYSV_SHMEM) +class ACE_Export ACE_Shared_Memory_Pool_Options + // = TITLE + // Helper class for constructor options. + // + // = DESCRIPTION + // This should be a nested class, but that breaks too many + // compilers. +{}; + class ACE_Export ACE_Shared_Memory_Pool : public ACE_Event_Handler // = TITLE // Make a memory pool that is based on System V shared memory @@ -88,9 +112,15 @@ class ACE_Export ACE_Shared_Memory_Pool : public ACE_Event_Handler // shared between processes. { public: + typedef ACE_Shared_Memory_Pool_Options OPTIONS; + ACE_Shared_Memory_Pool (const char *pool_name = ACE_ITOA (ACE_DEFAULT_SHM_KEY)); // Initialization constructor. + ACE_Shared_Memory_Pool (const OPTIONS &options, + const char *pool_name = ACE_ITOA (ACE_DEFAULT_SHM_KEY)); + // Initialize the pool via the options. + virtual void *init_acquire (size_t nbytes, size_t &rounded_bytes, int &first_time); @@ -161,6 +191,15 @@ protected: }; #endif /* !ACE_LACKS_SYSV_SHMEM */ +class ACE_Export ACE_Local_Memory_Pool_Options + // = TITLE + // Helper class for constructor options. + // + // = DESCRIPTION + // This should be a nested class, but that breaks too many + // compilers. +{}; + class ACE_Export ACE_Local_Memory_Pool // = TITLE // Make a memory pool that is based on C++ new/delete. This is @@ -168,9 +207,15 @@ class ACE_Export ACE_Local_Memory_Pool // into the ACE Malloc scheme... { public: + typedef ACE_Local_Memory_Pool_Options OPTIONS; + ACE_Local_Memory_Pool (const char *pool_name = 0); // Initialization constructor. + ACE_Local_Memory_Pool (const OPTIONS &options, + const char *pool_name = 0); + // Initialize the pool via the options. + virtual void *init_acquire (size_t nbytes, size_t &rounded_bytes, int &first_time); @@ -215,18 +260,42 @@ protected: // appropriate chunksize. }; +class ACE_Export ACE_MMAP_Memory_Pool_Options + // = TITLE + // Helper class for constructor options. + // + // = DESCRIPTION + // This should be a nested class, but that breaks too many + // compilers. +{ +public: + ACE_MMAP_Memory_Pool_Options (char *base_addr = ACE_DEFAULT_BASE_ADDR, + int use_fixed_addr = 1, + int write_each_page = 1) + : base_addr_ (base_addr), + use_fixed_addr_ (use_fixed_addr), + write_each_page_ (write_each_page) {} + + int use_fixed_addr_; + int write_each_page_; + char *base_addr_; +}; + class ACE_Export ACE_MMAP_Memory_Pool : public ACE_Event_Handler // = TITLE // Make a memory pool that is based on <mmap(2)>. This // implementation allows memory to be shared between processes. { public: + typedef ACE_MMAP_Memory_Pool_Options OPTIONS; + // = Initialization and termination methods. - ACE_MMAP_Memory_Pool (const char *pool_name = 0, - int use_fixed_addr = 1, - int write_each_page = 1, - char *base_addr = ACE_DEFAULT_BASE_ADDR); - // Initialize the pool. + ACE_MMAP_Memory_Pool (const char *pool_name = 0); + // Default constructor. + + ACE_MMAP_Memory_Pool (const OPTIONS &options, + const char *pool_name = 0); + // Initialize the pool via the options. virtual void *init_acquire (size_t nbytes, size_t &rounded_bytes, @@ -328,11 +397,12 @@ class ACE_Export ACE_Lite_MMAP_Memory_Pool : public ACE_MMAP_Memory_Pool { public: // = Initialization and termination methods. - ACE_Lite_MMAP_Memory_Pool (const char *pool_name = 0, - int use_fixed_addr = 1, - int write_each_page = 1, - char *base_addr = ACE_DEFAULT_BASE_ADDR); - // Initialize the pool. + ACE_Lite_MMAP_Memory_Pool (const char *pool_name = 0); + // Default constructor. + + ACE_Lite_MMAP_Memory_Pool (const OPTIONS &options, + const char *pool_name = 0); + // Initialize the pool via the options. int sync (ssize_t len = -1, int flags = MS_SYNC); // Overwrite the default sync behavior with no-op diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp index 11f775a1498..356c041cfde 100644 --- a/ace/Naming_Context.cpp +++ b/ace/Naming_Context.cpp @@ -65,17 +65,24 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int light) // Name_Space subclass. if (scope_in == ACE_Naming_Context::NET_LOCAL && this->local () == 0) - // Use NET_LOCAL name space, set up connection with remote server. - ACE_NEW_RETURN (this->name_space_, - ACE_Remote_Name_Space (this->netnameserver_host_, - this->netnameserver_port_), - -1); + { + // Use NET_LOCAL name space, set up connection with remote server. + ACE_NEW_RETURN (this->name_space_, + ACE_Remote_Name_Space (this->netnameserver_host_, + this->netnameserver_port_), + -1); + if (ACE_LOG_MSG->errnum ()) + ACE_ERROR_RETURN ((LM_ERROR, "REMOTE_NAME_SPACE::REMOTE_NAME_SPACE\n"), -1); + } else // Use NODE_LOCAL or PROC_LOCAL name space. { if (light) ACE_NEW_RETURN (this->name_space_, LIGHT_LOCAL_NAME_SPACE (scope_in, this->name_options_), -1); else ACE_NEW_RETURN (this->name_space_, LOCAL_NAME_SPACE (scope_in, this->name_options_), -1); + + if (ACE_LOG_MSG->errnum ()) + ACE_ERROR_RETURN ((LM_ERROR, "LOCAL_NAME_SPACE::LOCAL_NAME_SPACE\n"), -1); } return 0; } @@ -333,7 +340,8 @@ ACE_Name_Options::ACE_Name_Options (void) nameserver_host_ (ACE_OS::strdup (ACE_DEFAULT_SERVER_HOST)), namespace_dir_ (ACE_OS::strdup (ACE_DEFAULT_NAMESPACE_DIR)), process_name_ (0), - database_ (0) + database_ (0), + base_address_ (ACE_DEFAULT_BASE_ADDR) { ACE_TRACE ("ACE_Name_Options::ACE_Name_Options"); } @@ -407,6 +415,20 @@ ACE_Name_Options::database (const char *db) this->database_ = ACE_OS::strdup (db); } +char * +ACE_Name_Options::base_address (void) +{ + ACE_TRACE ("ACE_Name_Options::database"); + return this->base_address_; +} + +void +ACE_Name_Options::base_address (char *base_address) +{ + ACE_TRACE ("ACE_Name_Options::base_address"); + this->base_address_ = base_address; +} + ACE_Naming_Context::Context_Scope_Type ACE_Name_Options::context (void) { @@ -464,7 +486,7 @@ ACE_Name_Options::parse_args (int argc, char *argv[]) // clean it up in the destructor). this->database (this->process_name ()); - ACE_Get_Opt get_opt (argc, argv, "c:dh:l:P:p:s:T:v"); + ACE_Get_Opt get_opt (argc, argv, "b:c:dh:l:P:p:s:T:v"); for (int c; (c = get_opt ()) != -1; ) switch (c) @@ -497,6 +519,9 @@ ACE_Name_Options::parse_args (int argc, char *argv[]) case 's': this->database (get_opt.optarg); break; + case 'b': + this->base_address (ACE_OS::atoi (get_opt.optarg)); + break; case 'T': if (ACE_OS::strcasecmp (get_opt.optarg, "ON") == 0) ACE_Trace::start_tracing (); @@ -514,6 +539,7 @@ ACE_Name_Options::parse_args (int argc, char *argv[]) "\t[-P processname]\n" "\t[-p nameserver port]\n" "\t[-s database name]\n" + "\t[-b base address]\n" "\t[-v] (verbose) \n", argv[0]); /* NOTREACHED */ diff --git a/ace/Naming_Context.h b/ace/Naming_Context.h index a1c483e855f..d705fe5ec5e 100644 --- a/ace/Naming_Context.h +++ b/ace/Naming_Context.h @@ -275,6 +275,10 @@ public: void database (const char *db); const char *database (void); + // = Set/Get base address of the underlying allocator + void base_address (char *address); + char *base_address (void); + int debug (void); // Return debug status @@ -303,6 +307,9 @@ private: const char *database_; // Name of the database that stores the name/value/type bindings. + char *base_address_; + // Base address of the underlying allocator + ACE_Naming_Context::Context_Scope_Type context_; // The context in which the naming database will be created. }; @@ -126,15 +126,97 @@ // most of this nastiness! #if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -#define ACE_SYNCH_1 class ACE_SYNCH -#define ACE_SYNCH_2 ACE_SYNCH -#define ACE_SYNCH_MUTEX ACE_SYNCH::ACE_MUTEX -#define ACE_SYNCH_CONDITION ACE_SYNCH::ACE_CONDITION -#else /* TEMPLATES are broken (must be a cfront-based compiler...) */ -#define ACE_SYNCH_1 class ACE_SYNCH_MUTEX, class ACE_SYNCH_CONDITION -#define ACE_SYNCH_2 ACE_SYNCH_MUTEX, ACE_SYNCH_CONDITION -#define ACE_SYNCH_MUTEX ACE_SYNCH_MUTEX -#define ACE_SYNCH_CONDITION ACE_SYNCH_CONDITION + +// Handle ACE_Message_Queue. +#define ACE_SYNCH_1 class _ACE_SYNCH +#define ACE_SYNCH_2 _ACE_SYNCH +#define ACE_SYNCH_MUTEX _ACE_SYNCH::ACE_MUTEX +#define ACE_SYNCH_CONDITION _ACE_SYNCH::ACE_CONDITION + +// Handle ACE_Malloc* +#define ACE_MEM_POOL_1 class _ACE_MEM_POOL +#define ACE_MEM_POOL_2 _ACE_MEM_POOL +#define ACE_MEM_POOL _ACE_MEM_POOL +#define ACE_MEM_POOL_OPTIONS _ACE_MEM_POOL::OPTIONS + +// Handle ACE_Svc_Handler +#define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM +#define ACE_PEER_STREAM_2 _ACE_PEER_STREAM +#define ACE_PEER_STREAM _ACE_PEER_STREAM +#define ACE_PEER_STREAM_ADDR _ACE_PEER_STREAM::PEER_ADDR + +// Handle ACE_SOCK_* +#define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor +#define ACE_SOCK_CONNECTOR ACE_SOCK_Connector +#define ACE_SOCK_STREAM ACE_SOCK_Stream + +// Handle ACE_TLI_* +#define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor +#define ACE_TLI_CONNECTOR ACE_TLI_Connector +#define ACE_TLI_STREAM ACE_TLI_Stream + +// Handle ACE_SPIPE_* +#define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor +#define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector +#define ACE_SPIPE_STREAM ACE_SPIPE_Stream + +// Handle ACE_UPIPE_* +#define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor +#define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector +#define ACE_UPIPE_STREAM ACE_UPIPE_Stream + +// Handle ACE_*_Memory_Pool. +#define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool +#define ACE_SBRK_MEMORY_POOL ACE_Sbrk_Memory_Pool +#define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool +#define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool + +#else /* TEMPLATES are broken */ + +// Handle ACE_Message_Queue. +#define ACE_SYNCH_1 class _ACE_SYNCH_MUTEX, class _ACE_SYNCH_CONDITION +#define ACE_SYNCH_2 _ACE_SYNCH_MUTEX, _ACE_SYNCH_CONDITION +#define ACE_SYNCH_MUTEX _ACE_SYNCH_MUTEX +#define ACE_SYNCH_CONDITION _ACE_SYNCH_CONDITION + +// Handle ACE_Malloc* +#define ACE_MEM_POOL_1 class _ACE_MEM_POOL, class _ACE_MEM_POOL_OPTIONS +#define ACE_MEM_POOL_2 _ACE_MEM_POOL, _ACE_MEM_POOL_OPTIONS +#define ACE_MEM_POOL _ACE_MEM_POOL +#define ACE_MEM_POOL_OPTIONS _ACE_MEM_POOL_OPTIONS + +// Handle ACE_Svc_Handler +#define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM, class _ACE_PEER_ADDR +#define ACE_PEER_STREAM_2 _ACE_PEER_STREAM, _ACE_PEER_ADDR +#define ACE_PEER_STREAM _ACE_PEER_STREAM +#define ACE_PEER_STREAM_ADDR _ACE_PEER_ADDR + +// Handle ACE_SOCK_* +#define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor, ACE_INET_Addr +#define ACE_SOCK_CONNECTOR ACE_SOCK_Connector, ACE_INET_Addr +#define ACE_SOCK_STREAM ACE_SOCK_Stream, ACE_INET_Addr + +// Handle ACE_TLI_* +#define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor, ACE_INET_Addr +#define ACE_TLI_CONNECTOR ACE_TLI_Connector, ACE_INET_Addr +#define ACE_TLI_STREAM ACE_TLI_Stream, ACE_INET_Addr + +// Handle ACE_SPIPE_* +#define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor, ACE_SPIPE_Addr +#define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector, ACE_SPIPE_Addr +#define ACE_SPIPE_STREAM ACE_SPIPE_Stream, ACE_SPIPE_Addr + +// Handle ACE_UPIPE_* +#define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor, ACE_SPIPE_Addr +#define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector, ACE_SPIPE_Addr +#define ACE_UPIPE_STREAM ACE_UPIPE_Stream, ACE_SPIPE_Addr + +// Handle ACE_*_Memory_Pool. +#define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options +#define ACE_SBRK_MEMORY_POOL ACE_Sbrk_Memory_Pool, ACE_Sbrk_Memory_Pool_Options +#define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool, ACE_Shared_Memory_Pool_Options +#define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool, ACE_Local_Memory_Pool_Options + #endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ // Increase the range of "address families". diff --git a/ace/SOCK.h b/ace/SOCK.h index 25f2b580cfe..fd0ef7789df 100644 --- a/ace/SOCK.h +++ b/ace/SOCK.h @@ -22,21 +22,6 @@ #include "ace/Addr.h" #include "ace/IPC_SAP.h" -// The following is necessary since many C++ compilers don't support -// typedef'd types inside of classes used as formal template -// arguments... ;-(. Luckily, using the C++ preprocessor I can hide -// most of this nastiness! - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -#define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor -#define ACE_SOCK_CONNECTOR ACE_SOCK_Connector -#define ACE_SOCK_STREAM ACE_SOCK_Stream -#else /* TEMPLATES are broken (must be a cfront-based compiler...) */ -#define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor, ACE_INET_Addr -#define ACE_SOCK_CONNECTOR ACE_SOCK_Connector, ACE_INET_Addr -#define ACE_SOCK_STREAM ACE_SOCK_Stream, ACE_INET_Addr -#endif /* ACE_TEMPLATE_TYPEDEFS */ - class ACE_Export ACE_SOCK : public ACE_IPC_SAP // = TITLE // Defines the member functions for the base class of the diff --git a/ace/SPIPE.h b/ace/SPIPE.h index 527e5388616..755d3bfa9e2 100644 --- a/ace/SPIPE.h +++ b/ace/SPIPE.h @@ -21,27 +21,6 @@ #include "ace/IPC_SAP.h" #include "ace/SPIPE_Addr.h" -// The following is necessary since many C++ compilers don't support -// typedef'd types inside of classes used as formal template -// arguments... ;-(. Luckily, using the C++ preprocessor I can hide -// most of this nastiness! - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -#define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor -#define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector -#define ACE_SPIPE_STREAM ACE_SPIPE_Stream -#define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor -#define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector -#define ACE_UPIPE_STREAM ACE_UPIPE_Stream -#else /* TEMPLATES are broken (must be a cfront-based compiler...) */ -#define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor, ACE_SPIPE_Addr -#define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector, ACE_SPIPE_Addr -#define ACE_SPIPE_STREAM ACE_SPIPE_Stream, ACE_SPIPE_Addr -#define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor, ACE_SPIPE_Addr -#define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector, ACE_SPIPE_Addr -#define ACE_UPIPE_STREAM ACE_UPIPE_Stream, ACE_SPIPE_Addr -#endif /* ACE_TEMPLATE_TYPEDEFS */ - class ACE_Export ACE_SPIPE : public ACE_IPC_SAP // = TITLE // Defines the member functions for the base class of the diff --git a/ace/Svc_Handler.h b/ace/Svc_Handler.h index 2862d1f2ad0..bd02389d0e2 100644 --- a/ace/Svc_Handler.h +++ b/ace/Svc_Handler.h @@ -23,18 +23,6 @@ #include "ace/Service_Config.h" #include "ace/Synch_T.h" -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -#define ACE_PEER_STREAM_1 class PEER_STREAM -#define ACE_PEER_STREAM_2 PEER_STREAM -#define ACE_PEER_STREAM PEER_STREAM -#define ACE_PEER_STREAM_ADDR PEER_STREAM::PEER_ADDR -#else -#define ACE_PEER_STREAM_1 class PEER_STREAM, class PEER_ADDR -#define ACE_PEER_STREAM_2 PEER_STREAM, PEER_ADDR -#define ACE_PEER_STREAM PEER_STREAM -#define ACE_PEER_STREAM_ADDR PEER_ADDR -#endif /* ACE_TEMPLATE_TYPEDEFS */ - // Forward decls. class ACE_Dynamic; diff --git a/ace/TLI.h b/ace/TLI.h index 0584a5b0c60..6ba333c9ca2 100644 --- a/ace/TLI.h +++ b/ace/TLI.h @@ -21,21 +21,6 @@ #include "ace/IPC_SAP.h" #include "ace/Addr.h" -// The following is necessary since many C++ compilers don't support -// typedef'd types inside of classes used as formal template -// arguments... ;-(. Luckily, using the C++ preprocessor I can hide -// most of this nastiness! - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -#define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor -#define ACE_TLI_CONNECTOR ACE_TLI_Connector -#define ACE_TLI_STREAM ACE_TLI_Stream -#else /* TEMPLATES are broken (must be a cfront-based compiler...) */ -#define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor, ACE_INET_Addr -#define ACE_TLI_CONNECTOR ACE_TLI_Connector, ACE_INET_Addr -#define ACE_TLI_STREAM ACE_TLI_Stream, ACE_INET_Addr -#endif /* ACE_TEMPLATE_TYPEDEFS */ - #if defined (ACE_HAS_TLI) class ACE_Export ACE_TLI : public ACE_IPC_SAP // = TITLE diff --git a/ace/config-win32-msvc4.0.h b/ace/config-win32-msvc4.0.h index aacf85f8d73..ab7d9e56eb6 100644 --- a/ace/config-win32-msvc4.0.h +++ b/ace/config-win32-msvc4.0.h @@ -78,6 +78,9 @@ #define ACE_LACKS_MODE_MASKS #define ACE_LACKS_STRRECVFD +// Compiler supports nested traits +#define ACE_HAS_NESTED_TRAITS + // Compiler/platform has correctly prototyped header files. #define ACE_HAS_CPLUSPLUS_HEADERS |