mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
Some missing from merge.
Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
parent
ec939a5bce
commit
f4be15a7af
1895 changed files with 160408 additions and 53601 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// $Id: DLL_Manager.cpp 97888 2014-09-11 10:29:17Z mcorino $
|
||||
|
||||
#include "ace/DLL_Manager.h"
|
||||
|
||||
#include "ace/Auto_Ptr.h"
|
||||
#include "ace/Log_Category.h"
|
||||
#include "ace/ACE.h"
|
||||
#include "ace/Framework_Component.h"
|
||||
|
|
@ -29,15 +30,9 @@ ACE_DLL_Handle::~ACE_DLL_Handle (void)
|
|||
{
|
||||
ACE_TRACE ("ACE_DLL_Handle::~ACE_DLL_Handle");
|
||||
this->close (1);
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free(this->dll_name_);
|
||||
#else
|
||||
delete[] this->dll_name_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
}
|
||||
|
||||
ACE_ALLOC_HOOK_DEFINE(ACE_DLL_Handle)
|
||||
|
||||
const ACE_TCHAR *
|
||||
ACE_DLL_Handle::dll_name (void) const
|
||||
{
|
||||
|
|
@ -117,54 +112,123 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
|
|||
this->get_dll_names (dll_name, dll_names);
|
||||
#endif
|
||||
|
||||
ACE_Array_Iterator<ACE_TString> name_iter (dll_names);
|
||||
ACE_TString *name = 0;
|
||||
for (ACE_Array_Iterator<ACE_TString> name_iter (dll_names);
|
||||
name_iter.next (name); name_iter.advance ())
|
||||
while (name_iter.next (name))
|
||||
{
|
||||
if (this->open_i (name->c_str (), open_mode))
|
||||
// The ACE_SHLIB_HANDLE object is obtained.
|
||||
this->handle_ = ACE_OS::dlopen (name->c_str (),
|
||||
open_mode);
|
||||
|
||||
if (ACE::debug ())
|
||||
{
|
||||
ACE_TString err;
|
||||
ACELIB_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ")
|
||||
ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"),
|
||||
name->c_str (),
|
||||
open_mode,
|
||||
((this->handle_ != ACE_SHLIB_INVALID_HANDLE)
|
||||
? ACE_TEXT ("succeeded")
|
||||
: ACE_TEXT ("failed")),
|
||||
this->error (err).c_str()));
|
||||
}
|
||||
|
||||
if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) // Good one?
|
||||
break;
|
||||
|
||||
this->log_error (name->c_str (), errors);
|
||||
// If errno is ENOENT we just skip over this one,
|
||||
// anything else - like an undefined symbol, for
|
||||
// instance must be flagged here or the next error will
|
||||
// mask it.
|
||||
// @TODO: If we've found our DLL _and_ it's
|
||||
// broken, should we continue at all?
|
||||
if ((errno != 0) && (errno != ENOENT) && (errors || ACE::debug ()))
|
||||
{
|
||||
ACE_TString errtmp;
|
||||
if (errors)
|
||||
{
|
||||
errors->push (this->error (errtmp));
|
||||
}
|
||||
|
||||
if (ACE::debug ())
|
||||
{
|
||||
if (!errors)
|
||||
this->error (errtmp);
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ")
|
||||
ACE_TEXT ("(\'%s\') failed, errno=")
|
||||
ACE_TEXT ("%d: <%s>\n"),
|
||||
name->c_str (),
|
||||
ACE_ERRNO_GET,
|
||||
errtmp.c_str ()));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (AIX)
|
||||
# define SHR_O ACE_TEXT("(shr.o)")
|
||||
# define SHR_O_LEN (sizeof (SHR_O) / sizeof(ACE_TCHAR) - 1)
|
||||
// AIX often puts the shared library file (most often named
|
||||
// shr.o) inside an archive library. If this is an archive
|
||||
// library name, then try appending [shr.o] and retry.
|
||||
if (ACE_TString::npos != name->strstr (ACE_TEXT (".a")))
|
||||
{
|
||||
ACE_TCHAR aix_pathname[MAXPATHLEN + 1];
|
||||
if (name->length () + SHR_O_LEN <= MAXPATHLEN)
|
||||
ACE_OS::strncpy (aix_pathname,
|
||||
name->c_str (),
|
||||
name->length ());
|
||||
aix_pathname[name->length ()] = '\0';
|
||||
ACE_OS::strcat (aix_pathname, ACE_TEXT ("(shr.o)"));
|
||||
open_mode |= RTLD_MEMBER;
|
||||
|
||||
if (ACE::debug ())
|
||||
{
|
||||
ACE_OS::strcpy (aix_pathname, name->c_str());
|
||||
ACE_OS::strcat (aix_pathname, SHR_O);
|
||||
ACE_TString err;
|
||||
ACELIB_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ")
|
||||
ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"),
|
||||
aix_pathname,
|
||||
open_mode,
|
||||
(this->handle_ != ACE_SHLIB_INVALID_HANDLE
|
||||
? ACE_TEXT ("succeeded")
|
||||
: ACE_TEXT ("failed")),
|
||||
this->error(err).c_str()));
|
||||
}
|
||||
else
|
||||
|
||||
this->handle_ = ACE_OS::dlopen (aix_pathname, open_mode);
|
||||
if (this->handle_ != ACE_SHLIB_INVALID_HANDLE)
|
||||
break;
|
||||
|
||||
// If errno is ENOENT we just skip over this one, anything
|
||||
// else - like an undefined symbol, for instance
|
||||
// must be flagged here or the next error will mask it.
|
||||
//
|
||||
// @TODO: If we've found our DLL _and_ it's broken,
|
||||
// should we continue at all?
|
||||
if ((errno != 0) && (errno != ENOENT) && (errors || ACE::debug ()))
|
||||
{
|
||||
ACE_TString errtmp;
|
||||
if (errors)
|
||||
{
|
||||
errors->push ("path is too long");
|
||||
errors->push (this->error (errtmp));
|
||||
}
|
||||
|
||||
if (ACE::debug ())
|
||||
{
|
||||
if (!errors)
|
||||
this->error (errtmp);
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("ACE (%P|%t) DLL_Handle::open: ")
|
||||
ACE_TEXT ("('%s(shr.o)') is too long\n"),
|
||||
name->c_str()));
|
||||
ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ")
|
||||
ACE_TEXT ("(\'%s\') failed, errno=")
|
||||
ACE_TEXT ("%d: <%s>\n"),
|
||||
name->c_str (),
|
||||
ACE_ERRNO_GET,
|
||||
errtmp.c_str ()));
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
open_mode |= RTLD_MEMBER;
|
||||
|
||||
if (this->open_i (aix_pathname, open_mode))
|
||||
break;
|
||||
|
||||
this->log_error (aix_pathname, errors);
|
||||
}
|
||||
#endif /* AIX */
|
||||
|
||||
name_iter.advance ();
|
||||
}
|
||||
|
||||
if (this->handle_ == ACE_SHLIB_INVALID_HANDLE)
|
||||
|
|
@ -471,62 +535,6 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
|
|||
return;
|
||||
}
|
||||
|
||||
bool
|
||||
ACE_DLL_Handle::open_i (const ACE_TCHAR *dll_name, int open_mode)
|
||||
{
|
||||
// The ACE_SHLIB_HANDLE object is obtained.
|
||||
this->handle_ = ACE_OS::dlopen (dll_name, open_mode);
|
||||
|
||||
if (ACE::debug ())
|
||||
{
|
||||
ACE_TString err;
|
||||
ACELIB_DEBUG ((LM_DEBUG,
|
||||
ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ")
|
||||
ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"),
|
||||
dll_name,
|
||||
open_mode,
|
||||
((this->handle_ != ACE_SHLIB_INVALID_HANDLE)
|
||||
? ACE_TEXT ("succeeded")
|
||||
: ACE_TEXT ("failed")),
|
||||
this->error (err).c_str()));
|
||||
}
|
||||
|
||||
return this->handle_ != ACE_SHLIB_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
void
|
||||
ACE_DLL_Handle::log_error (const ACE_TCHAR *dll_name, ERROR_STACK *errors)
|
||||
{
|
||||
// If errno is ENOENT we just skip over this one, anything
|
||||
// else - like an undefined symbol, for instance
|
||||
// must be flagged here or the next error will mask it.
|
||||
//
|
||||
// @TODO: If we've found our DLL _and_ it's broken,
|
||||
// should we continue at all?
|
||||
if (errno != ENOENT && (errors || ACE::debug ()))
|
||||
{
|
||||
ACE_TString errtmp;
|
||||
if (errors)
|
||||
{
|
||||
errors->push (this->error (errtmp));
|
||||
}
|
||||
|
||||
if (ACE::debug ())
|
||||
{
|
||||
if (!errors)
|
||||
this->error (errtmp);
|
||||
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ")
|
||||
ACE_TEXT ("(\'%s\') failed, errno=")
|
||||
ACE_TEXT ("%d: <%s>\n"),
|
||||
dll_name,
|
||||
ACE_ERRNO_GET,
|
||||
errtmp.c_str ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
// Pointer to the Singleton instance.
|
||||
|
|
@ -590,8 +598,6 @@ ACE_DLL_Manager::~ACE_DLL_Manager (void)
|
|||
ACE_TEXT ("properly.\n")));
|
||||
}
|
||||
|
||||
ACE_ALLOC_HOOK_DEFINE(ACE_DLL_Manager)
|
||||
|
||||
ACE_DLL_Handle *
|
||||
ACE_DLL_Manager::open_dll (const ACE_TCHAR *dll_name,
|
||||
int open_mode,
|
||||
|
|
@ -707,15 +713,9 @@ ACE_DLL_Manager::open (int size)
|
|||
|
||||
ACE_DLL_Handle **temp = 0;
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_ALLOCATOR_RETURN (temp,
|
||||
static_cast<ACE_DLL_Handle**> (ACE_Allocator::instance()->malloc(sizeof (ACE_DLL_Handle*) * size)),
|
||||
-1);
|
||||
#else
|
||||
ACE_NEW_RETURN (temp,
|
||||
ACE_DLL_Handle *[size],
|
||||
-1);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
this->handle_vector_ = temp;
|
||||
this->total_size_ = size;
|
||||
|
|
@ -744,12 +744,7 @@ ACE_DLL_Manager::close (void)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free(this->handle_vector_);
|
||||
#else
|
||||
delete [] this->handle_vector_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
this->handle_vector_ = 0;
|
||||
this->current_size_ = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue