diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-30 08:40:22 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-30 08:40:22 +0000 |
commit | 453773bd3e69fb859f068cf0c16dc73db35492f6 (patch) | |
tree | 18de61635c0f0b348eb4d9248b994cf4355ec7ea | |
parent | 329bbbff96bff234b12823ddaa31bd738524c0bd (diff) | |
download | ATCD-453773bd3e69fb859f068cf0c16dc73db35492f6.tar.gz |
fixes
-rw-r--r-- | ace/Local_Name_Space_T.cpp | 185 | ||||
-rw-r--r-- | ace/Local_Name_Space_T.h | 16 | ||||
-rw-r--r-- | ace/Naming_Context.cpp | 14 | ||||
-rw-r--r-- | ace/Registry.cpp | 4 |
4 files changed, 135 insertions, 84 deletions
diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp index 2d62a3d19dc..b72c7134589 100644 --- a/ace/Local_Name_Space_T.cpp +++ b/ace/Local_Name_Space_T.cpp @@ -16,35 +16,6 @@ ACE_Name_Space_Map<ALLOCATOR>::ACE_Name_Space_Map (ALLOCATOR *allocator) ACE_TRACE ("ACE_Name_Space_Map::ACE_Name_Space_Map"); } -#if defined (ACE_WIN32) -template <class ALLOCATOR> int -ACE_Name_Space_Map<ALLOCATOR>::remap (EXCEPTION_POINTERS *ep, - ALLOCATOR* allocator) -{ - ACE_TRACE ("ACE_Name_Space_Map::remap"); - - void *addr = (void *) ep->ExceptionRecord->ExceptionInformation[1]; - - // The following requires Memory Pool to have ::remap() - // defined. Thus currently this will only work for - // ACE_MMap_Memory_Pool. - if (allocator->allocator ().memory_pool ().remap (addr) == -1) - // Kick it upstairs... - return (DWORD) EXCEPTION_CONTINUE_SEARCH; - -#if __X86__ - // This is 80x86-specific. - ep->ContextRecord->Edi = (DWORD) addr; -#elif __MIPS__ - ep->ContextRecord->IntA0 = - ep->ContextRecord->IntV0 = (DWORD) addr; - ep->ContextRecord->IntT5 = ep->ContextRecord->IntA0 + 3; -#endif /* __X86__ */ - // Resume execution at the original point of "failure." - return (DWORD) EXCEPTION_CONTINUE_EXECUTION; -} -#endif /* ACE_WIN32 */ - template <class ALLOCATOR> int ACE_Name_Space_Map<ALLOCATOR>::close (ALLOCATOR* allocator) { @@ -60,19 +31,9 @@ ACE_Name_Space_Map<ALLOCATOR>::bind (const ACE_NS_String &ext_id, ALLOCATOR *allocator) { ACE_TRACE ("ACE_Name_Space_Map::bind"); - int result = 0; this->allocator_ = allocator; - - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - ACE_SEH_TRY { - result = this->bind_i (ext_id, int_id); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation (), allocator)) { - } - return result; + return this->bind_i (ext_id, int_id); } template <class ALLOCATOR> int @@ -81,18 +42,9 @@ ACE_Name_Space_Map<ALLOCATOR>::unbind (const ACE_NS_String &ext_id, ALLOCATOR *allocator) { ACE_TRACE ("ACE_Name_Space_Map::unbind"); - int result = 0; + this->allocator_ = allocator; - - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - ACE_SEH_TRY { - result = this->unbind_i (ext_id, int_id); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation (), allocator)) { - } - return result; + return this->unbind_i (ext_id, int_id); } template <class ALLOCATOR> int @@ -103,18 +55,9 @@ ACE_Name_Space_Map<ALLOCATOR>::rebind (const ACE_NS_String &ext_id, ALLOCATOR *allocator) { ACE_TRACE ("ACE_Name_Space_Map::rebind"); - int result = 0; + this->allocator_ = allocator; - - // Note that we *must* use structured exception handling here - // because (1) we may need to commit virtual memory pages and (2) - // C++ exception handling doesn't support resumption. - ACE_SEH_TRY { - result = this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation (), allocator)) { - } - return result; + return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); } template <class ALLOCATOR> int @@ -123,26 +66,64 @@ ACE_Name_Space_Map<ALLOCATOR>::find (const ACE_NS_String &ext_id, ALLOCATOR *allocator) { ACE_TRACE ("ACE_Name_Space_Map::find"); - int result = 0; + this->allocator_ = allocator; + return this->find_i (ext_id, int_id); +} + +#if defined (ACE_WIN32) +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::remap (EXCEPTION_POINTERS *ep) +{ + ACE_TRACE ("ACE_Name_Space_Map::remap"); + + void *addr = (void *) ep->ExceptionRecord->ExceptionInformation[1]; + + // The following requires Memory Pool to have ::remap() + // defined. Thus currently this will only work for + // ACE_MMap_Memory_Pool. + if (this->allocator_->allocator ().memory_pool ().remap (addr) == -1) + // Kick it upstairs... + return (DWORD) EXCEPTION_CONTINUE_SEARCH; + +#if __X86__ + // This is 80x86-specific. + ep->ContextRecord->Edi = (DWORD) addr; +#elif __MIPS__ + ep->ContextRecord->IntA0 = + ep->ContextRecord->IntV0 = (DWORD) addr; + ep->ContextRecord->IntT5 = ep->ContextRecord->IntA0 + 3; +#endif /* __X86__ */ + // Resume execution at the original point of "failure." + return (DWORD) EXCEPTION_CONTINUE_EXECUTION; +} +#endif /* ACE_WIN32 */ +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::shared_bind (const ACE_WString &name, + const ACE_WString &value, + const char *type, + int rebind) +{ // Note that we *must* use structured exception handling here // because (1) we may need to commit virtual memory pages and (2) // C++ exception handling doesn't support resumption. - ACE_SEH_TRY { - result = this->find_i (ext_id, int_id); - } - ACE_SEH_EXCEPT (this->remap (GetExceptionInformation (), allocator)) { - } - return result; + ACE_SEH_TRY + { + return this->shared_bind_i (name, value, type, rebind); + } + ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) + { + } } template <ACE_MEM_POOL_1, class LOCK> int -ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::shared_bind (const ACE_WString &name, - const ACE_WString &value, - const char *type, - int rebind) +ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::shared_bind_i (const ACE_WString &name, + const ACE_WString &value, + const char *type, + int rebind) { + ACE_TRACE ("ACE_Local_Name_Space::shared_bind"); size_t name_len = (name.length () + 1) * sizeof (ACE_USHORT16); size_t value_len = (value.length () + 1) * sizeof (ACE_USHORT16); @@ -213,6 +194,22 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::shared_bind (const ACE_WString &name template <ACE_MEM_POOL_1, class LOCK> int ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::unbind (const ACE_WString &name) { + // Note that we *must* use structured exception handling here + // because (1) we may need to commit virtual memory pages and (2) + // C++ exception handling doesn't support resumption. + ACE_SEH_TRY + { + return this->unbind_i (name); + } + ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) + { + } + +} + +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::unbind_i (const ACE_WString &name) +{ ACE_TRACE ("ACE_Local_Name_Space::unbind"); ACE_WRITE_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, this->lock_, -1); @@ -258,6 +255,24 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::resolve (const ACE_WString &name, ACE_WString &value, char *&type) { + // Note that we *must* use structured exception handling here + // because (1) we may need to commit virtual memory pages and (2) + // C++ exception handling doesn't support resumption. + ACE_SEH_TRY + { + return this->resolve_i (name, value, type); + } + ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) + { + } +} + + +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::resolve_i (const ACE_WString &name, + ACE_WString &value, + char *&type) +{ ACE_TRACE ("ACE_Local_Name_Space::resolve"); ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, this->lock_, -1); @@ -330,6 +345,22 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::~ACE_Local_Name_Space (void) template <ACE_MEM_POOL_1, class LOCK> int ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::create_manager (void) { + // Note that we *must* use structured exception handling here + // because (1) we may need to commit virtual memory pages and (2) + // C++ exception handling doesn't support resumption. + ACE_SEH_TRY + { + return this->create_manager_i (); + } + ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ())) + { + } +} + + +template <ACE_MEM_POOL_1, class LOCK> int +ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::create_manager_i (void) +{ ACE_TRACE ("ACE_Local_Name_Space::create_manager"); // Get directory name const char *dir = this->name_options_->namespace_dir (); @@ -356,7 +387,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::create_manager (void) // Create the allocator with the appropriate options. ACE_NEW_RETURN (this->allocator_, ALLOCATOR (this->context_file_, 0, &options), -1); - if (ACE_LOG_MSG->errnum ()) + if (ACE_LOG_MSG->op_status ()) ACE_ERROR_RETURN ((LM_ERROR, "Allocator::Allocator\n"), -1); // Now check if the backing store has been created successfully @@ -407,9 +438,10 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::create_manager (void) return 0; } + template <ACE_MEM_POOL_1, class LOCK> int ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::list_names (ACE_PWSTRING_SET &set, - const ACE_WString &pattern) + const ACE_WString &pattern) { ACE_TRACE ("ACE_Local_Name_Space::list_names"); ACE_READ_GUARD_RETURN (ACE_RW_Process_Mutex, ace_mon, this->lock_, -1); @@ -674,3 +706,6 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, LOCK>::dump (void) const } #endif /* ACE_LOCAL_NAME_SPACE_T_C */ + + + diff --git a/ace/Local_Name_Space_T.h b/ace/Local_Name_Space_T.h index fdcef075c06..2cc52f516d7 100644 --- a/ace/Local_Name_Space_T.h +++ b/ace/Local_Name_Space_T.h @@ -79,10 +79,6 @@ public: int close (ALLOCATOR* allocator); private: -#if defined (ACE_WIN32) - int remap (EXCEPTION_POINTERS *ep, ALLOCATOR *allocator); - // Remap the backing store -#endif /* ACE_WIN32 */ }; template <ACE_MEM_POOL_1, class LOCK> @@ -132,12 +128,16 @@ public: // didn't exist yet. (Wide charcter strings interface). virtual int unbind (const ACE_WString &name); + virtual int unbind_i (const ACE_WString &name); // Delete a name from a ACE_Local_Name_Space (Wide charcter strings // Interface). virtual int resolve (const ACE_WString &name, ACE_WString &value, char *&type); + virtual int resolve_i (const ACE_WString &name, + ACE_WString &value, + char *&type); // Get value and type of a given name binding (Wide chars). The // caller is responsible for deleting <type>! @@ -178,11 +178,19 @@ public: // Dump the state of the object private: +#if defined (ACE_WIN32) + int remap (EXCEPTION_POINTERS *ep); + // Remap the backing store +#endif /* ACE_WIN32 */ + int shared_bind (const ACE_WString &name, const ACE_WString &value, const char *type, int rebind); + int shared_bind_i (const ACE_WString &name, const ACE_WString &value, + const char *type, int rebind); // Factor out code from bind() and rebind(). int create_manager (void); + int create_manager_i (void); // Allocate the appropriate type of map manager that stores the // key/value binding. diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp index e92659cad7c..9f0815ebb08 100644 --- a/ace/Naming_Context.cpp +++ b/ace/Naming_Context.cpp @@ -7,6 +7,7 @@ #include "ace/Naming_Context.h" #include "ace/Remote_Name_Space.h" #include "ace/Local_Name_Space.h" +#include "ace/Registry_Name_Space.h" // Make life easier later on... @@ -64,6 +65,10 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite) // Perform factory operation to select appropriate type of // Name_Space subclass. +#if defined (ACE_WIN32) + // Use ACE_Registry + ACE_NEW_RETURN (this->name_space_, ACE_Registry_Name_Space (this->name_options_), -1); +#else if (scope_in == ACE_Naming_Context::NET_LOCAL && this->local () == 0) { // Use NET_LOCAL name space, set up connection with remote server. @@ -71,8 +76,6 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite) 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. { @@ -80,10 +83,11 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite) ACE_NEW_RETURN (this->name_space_, LITE_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); } +#endif /* ACE_WIN32 */ + + if (ACE_LOG_MSG->op_status ()) + ACE_ERROR_RETURN ((LM_ERROR, "NAME_SPACE::NAME_SPACE\n"), -1); return 0; } diff --git a/ace/Registry.cpp b/ace/Registry.cpp index da1f780077c..2e5f3e360e6 100644 --- a/ace/Registry.cpp +++ b/ace/Registry.cpp @@ -1049,6 +1049,10 @@ ACE_Predefined_Naming_Contexts::connect (ACE_Registry::Naming_Context &naming_co LPCSTR machine_name) { long result = -1; + + if (machine_name != 0 && ACE_OS::strcmp ("localhost", machine_name) == 0) + machine_name = 0; + if (predefined == HKEY_LOCAL_MACHINE || predefined == HKEY_USERS) result = ::RegConnectRegistry ((LPSTR) machine_name, predefined, |