mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19: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,3 +1,5 @@
|
|||
// $Id: Logging_Strategy.cpp 96985 2013-04-11 15:50:32Z huangh $
|
||||
|
||||
#include "ace/Logging_Strategy.h"
|
||||
#include "ace/Service_Config.h"
|
||||
#include "ace/ACE.h"
|
||||
|
|
@ -173,11 +175,7 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[])
|
|||
case 'k':
|
||||
// Ensure that the LOGGER flag is set
|
||||
ACE_SET_BITS (this->flags_, ACE_Log_Msg::LOGGER);
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free(this->logger_key_);
|
||||
#else
|
||||
delete [] this->logger_key_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
this->logger_key_ = ACE::strnew (get_opt.opt_arg ());
|
||||
break;
|
||||
case 'm':
|
||||
|
|
@ -186,11 +184,7 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[])
|
|||
this->max_size_ <<= 10; // convert from KB to bytes.
|
||||
break;
|
||||
case 'n':
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free(this->program_name_);
|
||||
#else
|
||||
delete [] this->program_name_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
this->program_name_ = ACE::strnew (get_opt.opt_arg ());
|
||||
break;
|
||||
case 'N':
|
||||
|
|
@ -210,11 +204,7 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[])
|
|||
case 's':
|
||||
// Ensure that the OSTREAM flag is set
|
||||
ACE_SET_BITS (this->flags_, ACE_Log_Msg::OSTREAM);
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free(this->filename_);
|
||||
#else
|
||||
delete [] this->filename_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
this->filename_ = ACE::strnew (get_opt.opt_arg ());
|
||||
break;
|
||||
case 't':
|
||||
|
|
@ -253,13 +243,8 @@ ACE_Logging_Strategy::ACE_Logging_Strategy (void)
|
|||
#if defined (ACE_DEFAULT_LOGFILE)
|
||||
this->filename_ = ACE::strnew (ACE_DEFAULT_LOGFILE);
|
||||
#else /* ACE_DEFAULT_LOGFILE */
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_ALLOCATOR (this->filename_,
|
||||
static_cast<ACE_TCHAR *>(ACE_Allocator::instance()->malloc(sizeof(ACE_TCHAR) * (MAXPATHLEN + 1))));
|
||||
#else
|
||||
ACE_NEW (this->filename_,
|
||||
ACE_TCHAR[MAXPATHLEN + 1]);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
// Get the temporary directory
|
||||
if (ACE::get_temp_dir
|
||||
|
|
@ -282,30 +267,17 @@ ACE_Logging_Strategy::~ACE_Logging_Strategy (void)
|
|||
{
|
||||
// This is allocated in constructor, so it must be deallocated in
|
||||
// the destructor!
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free(this->filename_);
|
||||
#else
|
||||
delete [] this->filename_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
}
|
||||
|
||||
int
|
||||
ACE_Logging_Strategy::fini (void)
|
||||
{
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free(this->filename_);
|
||||
#else
|
||||
delete [] this->filename_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
this->filename_ = 0; // Avoid double deletions.
|
||||
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_Allocator::instance()->free(this->logger_key_);
|
||||
ACE_Allocator::instance()->free(this->program_name_);;
|
||||
#else
|
||||
delete [] this->logger_key_;
|
||||
delete [] this->program_name_;
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
if (this->reactor ()
|
||||
&& this->interval_ > 0 && this->max_size_ > 0)
|
||||
|
|
@ -506,14 +478,14 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
|
|||
|
||||
for (int i = max_num ; i > 1 ;i--)
|
||||
{
|
||||
ACE_OS::snprintf (backup, MAXPATHLEN + 1,
|
||||
ACE_TEXT ("%s.%d"),
|
||||
this->filename_,
|
||||
i);
|
||||
ACE_OS::snprintf (to_backup, MAXPATHLEN + 1,
|
||||
ACE_TEXT ("%s.%d"),
|
||||
this->filename_,
|
||||
i - 1);
|
||||
ACE_OS::sprintf (backup,
|
||||
ACE_TEXT ("%s.%d"),
|
||||
this->filename_,
|
||||
i);
|
||||
ACE_OS::sprintf (to_backup,
|
||||
ACE_TEXT ("%s.%d"),
|
||||
this->filename_,
|
||||
i - 1);
|
||||
|
||||
// Remove any existing old file; ignore error as
|
||||
// file may not exist.
|
||||
|
|
@ -523,19 +495,19 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
|
|||
// backup log file.
|
||||
ACE_OS::rename (to_backup, backup);
|
||||
}
|
||||
ACE_OS::snprintf (backup, MAXPATHLEN + 1,
|
||||
ACE_TEXT ("%s.1"),
|
||||
this->filename_);
|
||||
ACE_OS::sprintf (backup,
|
||||
ACE_TEXT ("%s.1"),
|
||||
this->filename_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fixed_number_ && count_>max_file_number_)
|
||||
count_ = 1; // start over from 1
|
||||
|
||||
ACE_OS::snprintf (backup, MAXPATHLEN + 1,
|
||||
ACE_TEXT ("%s.%d"),
|
||||
this->filename_,
|
||||
count_);
|
||||
ACE_OS::sprintf (backup,
|
||||
ACE_TEXT ("%s.%d"),
|
||||
this->filename_,
|
||||
count_);
|
||||
}
|
||||
|
||||
// Remove any existing old file; ignore error as file may
|
||||
|
|
@ -614,6 +586,8 @@ ACE_Logging_Strategy::log_msg (ACE_Log_Msg *log_msg)
|
|||
this->log_msg_ = log_msg;
|
||||
}
|
||||
|
||||
ACE_END_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
// The following is a "Factory" used by the ACE_Service_Config and
|
||||
// svc.conf file to dynamically initialize the state of the
|
||||
// Logging_Strategy.
|
||||
|
|
@ -627,8 +601,6 @@ ACE_STATIC_SVC_DEFINE (ACE_Logging_Strategy,
|
|||
|
||||
ACE_FACTORY_DEFINE (ACE, ACE_Logging_Strategy)
|
||||
|
||||
ACE_END_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
// _get_dll_unload_policy() prevents ACE from being unloaded and having its
|
||||
// framework components run down if/when the Logging Strategy is unloaded.
|
||||
extern "C" ACE_Export int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue