diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2006-06-19 12:51:17 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2006-06-19 12:51:17 +0000 |
commit | 8dcb9f7e1a3d81534f035279d169409851bd7e61 (patch) | |
tree | 12d20c11c135a57a7a982a127f964f4c31400814 | |
parent | 17c1f9e0cbcec4a4c55e226a8f1aeabbce336d0f (diff) | |
download | ATCD-8dcb9f7e1a3d81534f035279d169409851bd7e61.tar.gz |
ChangeLogTag:Mon
-rw-r--r-- | ChangeLog | 47 | ||||
-rw-r--r-- | THANKS | 3 | ||||
-rw-r--r-- | ace/CDR_Size.cpp | 5 | ||||
-rw-r--r-- | ace/Ping_Socket.cpp | 38 | ||||
-rw-r--r-- | ace/Signal.cpp | 32 | ||||
-rw-r--r-- | ace/Signal.inl | 35 | ||||
-rw-r--r-- | examples/Log_Msg/Log_Msg_MFC/README | 12 | ||||
-rw-r--r-- | examples/Log_Msg/test_callback.cpp | 23 | ||||
-rw-r--r-- | examples/Log_Msg/test_log_msg.cpp | 17 | ||||
-rw-r--r-- | examples/Log_Msg/test_ostream.cpp | 23 | ||||
-rw-r--r-- | examples/Misc/test_trace.cpp | 17 | ||||
-rw-r--r-- | netsvcs/clients/Logger/indirect_logging.cpp | 15 | ||||
-rw-r--r-- | netsvcs/lib/Client_Logging_Handler.cpp | 3 |
13 files changed, 174 insertions, 96 deletions
diff --git a/ChangeLog b/ChangeLog index 3e6dc31de9c..3a11033f591 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,50 @@ +Mon Jun 19 02:55:48 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * examples/Log_Msg/test_ostream.cpp (ACE_TMAIN): Enhanced the test to + show the ofstream output better. + +Mon Jun 19 01:31:46 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * examples/Log_Msg/test_callback.cpp (ACE_TMAIN): Zapped the + extraneous '\n' from the messages. + +Mon Jun 19 01:06:49 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * examples/Misc/test_trace.cpp: Enhanced to the the ACE_TRACE macro. + +Sun Jun 18 16:58:20 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * netsvcs/clients/Logger/indirect_logging.cpp (ACE_TMAIN): Cleaned + up the test to work if none of the daemons are running. + +Sun Jun 18 16:44:14 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * ace/Signal.{inl,cpp}: Moved the destructors out of the *.inl + file into the *.cpp file since inline destructors aren't really + a good idea. + +Sun Jun 18 16:35:13 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * netsvcs/lib/Client_Logging_Handler.cpp (send): Printout the type + of log message as a diagnostic to make it easier to see the + filtering that's going on! + +Fri Jun 16 17:48:18 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * ace/CDR_Size.cpp (adjust): Added a fix for the case where + ACE_LACKS_CDR_ALIGNMENT is undefined. Thanks to Aleksandar + Vukajlovic <vukajlo at finsoft dot co dot yu> for contributing + this. + +Fri Jun 16 13:57:53 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * ace/Ping_Socket.cpp: Replaced the use of char, short, int, + etc. for struct ip and icmp with the equivalent + ACE_UNIT[8,12,32] types to ensure a fixed size. Thanks to Paul + Daugherty <Paul at nextalk dot com> and Robert S. Iakobashvili + <coroberti at gmail dot com> for reporting this and contributing + a fix. + Mon Jun 19 11:37:17 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> * ace/OS_NS_unistd.{h,cpp,inl}: @@ -2098,7 +2098,7 @@ Dmitriy Kuznetsov <dk3 at garant dot ru> Steve Orner <saorner at rdainc dot com> Bob Ronak <ronak2121 at gmail dot com> Aleksandar Vukajlovic <vukajlo at finsoft dot co dot yu> -Ignacio Alvarez <support at xentient dot com> +esIgnacio Alvarez <support at xentient dot com> Sergey Zubarev <sergant128 at mail dot ru> Qingbo Cai <qingbo dot cai at case dot edu> David White <david dot white dot 7 at gmail dot com> @@ -2124,6 +2124,7 @@ David Highley <dhighley at highley-recommended dot com> Sonicfly Zhou <zhoucn at txsec dot com> Phil Billingham <phil_billingham at ml dot com> David Giovannini <giovannd at ociweb dot com> +Paul Daugherty <Paul at nextalk dot com> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/ace/CDR_Size.cpp b/ace/CDR_Size.cpp index 3f2829cc909..d447232f6d3 100644 --- a/ace/CDR_Size.cpp +++ b/ace/CDR_Size.cpp @@ -233,7 +233,10 @@ void ACE_SizeCDR::adjust (size_t size, size_t align) { - size_ = align * (size_ / align + (size_ % align ? 1 : 0)); +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + const size_t offset = ACE_align_binary (size_, align) - size_; + size_ += offset; +#endif */ ACE_LACKS_CDR_ALIGNMENT */ size_ += size; } diff --git a/ace/Ping_Socket.cpp b/ace/Ping_Socket.cpp index 23bff4cb52a..cf7655fdf6c 100644 --- a/ace/Ping_Socket.cpp +++ b/ace/Ping_Socket.cpp @@ -50,31 +50,35 @@ ACE_END_VERSIONED_NAMESPACE_DECL #define ICMP_ECHO 8 #define ICMP_ECHOREPLY 0 +#pragma pack(1) + struct ip { - unsigned int ip_hl:4; // length of the header - unsigned int version:4; // Version of IP - unsigned char tos; // Type of service - unsigned short total_len; // total length of the packet - unsigned short ident; // unique identifier - unsigned short frag_and_flags; // flags - unsigned char ip_ttl; // Time to live - unsigned char proto; // protocol (TCP, UDP etc) - unsigned short checksum; // IP checksum - unsigned int sourceIP; - unsigned int destIP; + ACE_UINT8 ip_hl:4; // length of the header + ACE_UINT8 version:4; // Version of IP + ACE_UINT8 tos; // Type of service + ACE_UINT16 total_len; // total length of the packet + ACE_UINT16 ident; // unique identifier + ACE_UINT16 frag_and_flags; // flags + ACE_UINT8 ip_ttl; // Time to live + ACE_UINT8 proto; // protocol (TCP, UDP etc) + ACE_UINT16 checksum; // IP checksum + ACE_UINT32 sourceIP; + ACE_UINT32 destIP; }; struct icmp { - unsigned char icmp_type; - unsigned char icmp_code; // type sub code - unsigned short icmp_cksum; - unsigned short icmp_id; - unsigned short icmp_seq; - unsigned long icmp_data; // time data + ACE_UINT8 icmp_type; + ACE_UINT8 icmp_code; // type sub code + ACE_UINT16 icmp_cksum; + ACE_UINT16 icmp_id; + ACE_UINT16 icmp_seq; + ACE_UINT32 icmp_data; // time data }; +#pragma pack() + #endif /* #if ! defined (ACE_WIN32) */ diff --git a/ace/Signal.cpp b/ace/Signal.cpp index 12ac1984605..c7099b7040f 100644 --- a/ace/Signal.cpp +++ b/ace/Signal.cpp @@ -65,6 +65,38 @@ ACE_Sig_Action::dump (void) const ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Set) +ACE_Sig_Set::~ACE_Sig_Set (void) +{ + ACE_TRACE ("ACE_Sig_Set::~ACE_Sig_Set"); + ACE_OS::sigemptyset (&this->sigset_); +} + +ACE_Sig_Action::~ACE_Sig_Action (void) +{ + ACE_TRACE ("ACE_Sig_Action::~ACE_Sig_Action"); +} + +// Restore the signal mask. + +ACE_Sig_Guard::~ACE_Sig_Guard (void) +{ + //ACE_TRACE ("ACE_Sig_Guard::~ACE_Sig_Guard"); + if (!this->condition_) + return; + +#if !defined (ACE_LACKS_UNIX_SIGNALS) +#if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) + ACE_OS::sigprocmask (SIG_SETMASK, + (sigset_t *) this->omask_, + 0); +#else + ACE_OS::thr_sigsetmask (SIG_SETMASK, + (sigset_t *) this->omask_, + 0); +#endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ +#endif /* !ACE_LACKS_UNIX_SIGNALS */ +} + void ACE_Sig_Set::dump (void) const { diff --git a/ace/Signal.inl b/ace/Signal.inl index ef871441aca..506a0506ab1 100644 --- a/ace/Signal.inl +++ b/ace/Signal.inl @@ -43,13 +43,6 @@ ACE_Sig_Set::ACE_Sig_Set (ACE_Sig_Set *ss) this->sigset_ = ss->sigset_; } -ACE_INLINE -ACE_Sig_Set::~ACE_Sig_Set (void) -{ - ACE_TRACE ("ACE_Sig_Set::~ACE_Sig_Set"); - ACE_OS::sigemptyset (&this->sigset_); -} - ACE_INLINE int ACE_Sig_Set::empty_set (void) { @@ -99,12 +92,6 @@ ACE_Sig_Set::sigset (void) const return this->sigset_; } -ACE_INLINE -ACE_Sig_Action::~ACE_Sig_Action (void) -{ - ACE_TRACE ("ACE_Sig_Action::~ACE_Sig_Action"); -} - ACE_INLINE int ACE_Sig_Action::flags (void) { @@ -271,28 +258,6 @@ ACE_Sig_Guard::ACE_Sig_Guard (ACE_Sig_Set *mask, #endif /* ACE_LACKS_UNIX_SIGNALS */ } -// Restore the signal mask. - -ACE_INLINE -ACE_Sig_Guard::~ACE_Sig_Guard (void) -{ - //ACE_TRACE ("ACE_Sig_Guard::~ACE_Sig_Guard"); - if (!this->condition_) - return; - -#if !defined (ACE_LACKS_UNIX_SIGNALS) -#if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) - ACE_OS::sigprocmask (SIG_SETMASK, - (sigset_t *) this->omask_, - 0); -#else - ACE_OS::thr_sigsetmask (SIG_SETMASK, - (sigset_t *) this->omask_, - 0); -#endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ -#endif /* !ACE_LACKS_UNIX_SIGNALS */ -} - ACE_INLINE ACE_Sig_Handler::ACE_Sig_Handler (void) { diff --git a/examples/Log_Msg/Log_Msg_MFC/README b/examples/Log_Msg/Log_Msg_MFC/README index 8c20059ba42..d64001aff87 100644 --- a/examples/Log_Msg/Log_Msg_MFC/README +++ b/examples/Log_Msg/Log_Msg_MFC/README @@ -3,13 +3,12 @@ by Craig Rodrigues <crodrigu@bbn.com> 2002/08/02 -The example in this directory is a Microsoft -Foundation Class (MFC) example which illustrates how to -write an ACE_Log_Msg_Callback which can -send debug output to the Microsoft debugger console. +The example in this directory is a Microsoft Foundation Class (MFC) +example which illustrates how to write an ACE_Log_Msg_Callback which +can send debug output to the Microsoft debugger console. -This is very useful when debugging an MFC GUI-based application -which uses ACE. +This is very useful when debugging an MFC GUI-based application which +uses ACE. NOTES ===== @@ -17,6 +16,7 @@ NOTES example. Follow the instructions in $ACE_ROOT/ACE-INSTALL.html for building ACE with Visual C++. Do a Batch Build of ACE, and make sure that you build the target "ACE DLL - Win32 MFC Debug". + - We must call ACE::init() and ACE::fini() in the right places otherwise we will get strange crashes and memory leaks when invoking ACE_Log_Msg::instance(). diff --git a/examples/Log_Msg/test_callback.cpp b/examples/Log_Msg/test_callback.cpp index 59f87bb4c44..51671fcd7f3 100644 --- a/examples/Log_Msg/test_callback.cpp +++ b/examples/Log_Msg/test_callback.cpp @@ -27,14 +27,16 @@ ACE_RCSID(Log_Msg, test_callback, "$Id$") class Logger : public ACE_Log_Msg_Callback +// Subclassing from ACE_Log_Msg_Callback means that an instance of +// Logger can be a target of a callback. { public: - Logger (int be_recursive = 1); // Constructor sets whether we're testing "recursive" callback // logging! + Logger (int be_recursive = 1); - void log (ACE_Log_Record &log_record); - // Logging callback + vritual void log (ACE_Log_Record &log_record); + // Logging callback hook. void verbose (int be_verbose); @@ -61,6 +63,7 @@ void Logger::log (ACE_Log_Record &log_record) { int use_log_msg = 0; + if (this->recursive_) { this->recursive_ = 0; @@ -71,10 +74,10 @@ Logger::log (ACE_Log_Record &log_record) { if (use_log_msg) ACE_DEBUG ((LM_DEBUG, - "Logger::log->%s\n", + "Logger::log->%s", log_record.msg_data ())); else - ACE_OS::printf ("Recursive Logger callback = %s\n", + ACE_OS::printf ("Recursive Logger callback = %s", log_record.msg_data ()); } else @@ -87,10 +90,10 @@ Logger::log (ACE_Log_Record &log_record) { if (use_log_msg) ACE_DEBUG ((LM_DEBUG, - "Logger::log->%s\n", + "Logger::log->%s", verbose_msg)); else - ACE_OS::printf ("Recursive Logger callback = %s\n", + ACE_OS::printf ("Recursive Logger callback = %s", verbose_msg); } } @@ -109,7 +112,7 @@ ACE_TMAIN (int, ACE_TCHAR *[]) ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR); - // This message should not show up anywhere. + // This message should not show up anywhere since we disabled STDERR. ACE_DEBUG ((LM_DEBUG, "(%t) second message\n")); @@ -129,7 +132,7 @@ ACE_TMAIN (int, ACE_TCHAR *[]) // This message should show up via the Logger callback. ACE_DEBUG ((LM_DEBUG, - "(%t) forth message\n")); + "(%t) fourth message\n")); ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); @@ -158,6 +161,6 @@ ACE_TMAIN (int, ACE_TCHAR *[]) // The one from the Logger callback will not be verbose, but the one // from stderr should be verbose. ACE_DEBUG ((LM_DEBUG, - "(%t) eight message\n")); + "(%t) eighth message\n")); return 0; } diff --git a/examples/Log_Msg/test_log_msg.cpp b/examples/Log_Msg/test_log_msg.cpp index 8cead2e06f7..a2d40770f56 100644 --- a/examples/Log_Msg/test_log_msg.cpp +++ b/examples/Log_Msg/test_log_msg.cpp @@ -9,8 +9,8 @@ // test_log_msg.cpp // // = DESCRIPTION -// This program tests the Log_Msg abstraction and demontrates -// several use cases. +// This program tests the ACE_Log_Msg abstraction and demontrates +// several common use cases. // // = AUTHOR // Douglas Schmidt <schmidt@cs.wustl.edu> @@ -46,11 +46,9 @@ cause_error (void) int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - // Note that the default behavior is to log to STDERR... + int counter = 1; - int counter = 1 ; - - if (argc > 1) + if (argc > 1) // Just give a dummy command-line argument to trigger this path. { if (ACE_LOG_MSG->open (argv[0], ACE_Log_Msg::OSTREAM) == -1) @@ -67,7 +65,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_ERROR ((LM_ERROR, "op_status and errnum failed!\n")); } - else + else // The default behavior is to log to STDERR... { if (ACE_LOG_MSG->open (argv[0]) == -1) ACE_ERROR ((LM_ERROR, @@ -87,7 +85,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Exercise many different combinations of STDERR and OSTREAM. double f = 3.1416 * counter++; - int i = 10000; + int i = 10000; ACE_DEBUG ((LM_INFO, "%10f, %*s%s = %d\n", @@ -105,6 +103,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) f = 3.1416 * counter; i = 10000 * counter++; + // This message will print twice - once for OSTREAM and once for + // STDERR. + ACE_DEBUG ((LM_INFO, "%10f, %*s%s = %d\n", f, diff --git a/examples/Log_Msg/test_ostream.cpp b/examples/Log_Msg/test_ostream.cpp index 6f4dbd0770b..82bc6007b07 100644 --- a/examples/Log_Msg/test_ostream.cpp +++ b/examples/Log_Msg/test_ostream.cpp @@ -13,7 +13,7 @@ // stderr and to a file. // // = AUTHOR -// Irfan Pyarali +// Irfan Pyarali <irfan@cse.wustl.edu> // // ============================================================================ @@ -49,14 +49,14 @@ ACE_TMAIN (int, ACE_TCHAR *[]) #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) // Create a persistent store. const char *filename = "output"; - ofstream myostream (filename, ios::out | ios::trunc); + ofstream outfile (filename, ios::out | ios::trunc); // Check for errors. - if (myostream.bad ()) + if (outfile.bad ()) return 1; // Set the ostream. - ACE_LOG_MSG->msg_ostream (&myostream); + ACE_LOG_MSG->msg_ostream (&outfile); // This message should show up in the ostream. ACE_DEBUG ((LM_DEBUG, @@ -70,5 +70,20 @@ ACE_TMAIN (int, ACE_TCHAR *[]) ACE_DEBUG ((LM_DEBUG, "fifth message\n")); +#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) + ifstream infile (filename, ios::in); + + if (infile.bad ()) + return 1; + + // This loop should print out the contents of file "output", which should + // have the strings "fourth\n" and "fifth\n" in them. + + std::string line; + + while (std::getline (infile, line)) + std::cout << line << std::endl; + +#endif /* ACE_LACKS_IOSTREAM_TOTALLY */ return 0; } diff --git a/examples/Misc/test_trace.cpp b/examples/Misc/test_trace.cpp index 338cf8eaa77..ef8ae33eef4 100644 --- a/examples/Misc/test_trace.cpp +++ b/examples/Misc/test_trace.cpp @@ -10,7 +10,8 @@ // // = DESCRIPTION // This example illustrates how to use the ACE tracing feature and -// also illustrates how to redirect the output to a file. +// the ACE_TRACE macro. It also shows the use of the ACE_Task_Base +// class running as an "active object". // // = AUTHOR // Douglas C. Schmidt <schmidt@cs.wustl.edu> and @@ -47,13 +48,10 @@ private: // Depth of the recursion. }; - int My_Task::recursive (size_t depth) { - ACE_Trace trace (ACE_TEXT("int recursive (size_t depth)"), - __LINE__, - ACE_TEXT(__FILE__)); + ACE_TRACE ("int My_Test::recursive (size_t depth)"); if (depth > 0) return recursive (depth - 1); @@ -66,6 +64,8 @@ extern "C" void exithook (void) { + ACE_TRACE ("void exithook (void)"); + ACE_DEBUG ((LM_DEBUG, "we're outta here!\n")); } @@ -80,11 +80,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) if (argc > 2) ACE_Trace::set_nesting_indent (ACE_OS::atoi (argv[2])); - ACE_Trace trace (ACE_TEXT("int ACE_TMAIN (int argc, ACE_TCHAR *argv[])"), - __LINE__, - ACE_TEXT(__FILE__)); + ACE_TRACE ("int ACE_TMAIN (int argc, ACE_TCHAR *argv[])"); - // The following won't work on MVS OpenEdition... ACE_Sig_Action sig1 ((ACE_SignalHandler) ACE_Trace::start_tracing, SIGUSR1); ACE_UNUSED_ARG (sig1); @@ -94,7 +91,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) My_Task task (MAX_DEPTH); -#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) int n_threads = argc > 3 ? ACE_OS::atoi (argv[3]) : 4; if (task.activate (THR_BOUND | THR_DETACHED, n_threads) == -1) diff --git a/netsvcs/clients/Logger/indirect_logging.cpp b/netsvcs/clients/Logger/indirect_logging.cpp index e5e2e028e29..40cd0d61e10 100644 --- a/netsvcs/clients/Logger/indirect_logging.cpp +++ b/netsvcs/clients/Logger/indirect_logging.cpp @@ -8,6 +8,7 @@ #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdlib.h" #include "ace/Log_Msg.h" +#include "ace/Log_Record.h" ACE_RCSID(Logger, indirect_logging, "$Id$") @@ -17,11 +18,17 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) const ACE_TCHAR *prog_name = argv[0]; int iterations = argc < 2 ? 10 : ACE_OS::atoi (argv[1]); const ACE_TCHAR *logger_key = argc < 3 ? ACE_DEFAULT_LOGGER_KEY : argv[2]; + int verbose = argc < 4 ? 0 : ACE_Log_Msg::VERBOSE; ACE_OS::srand ((u_int) ACE_OS::time (0)); if (ACE_LOG_MSG->open (prog_name, ACE_Log_Msg::LOGGER, logger_key) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Cannot open logger\n"), -1); + { + ACE_ERROR ((LM_ERROR, "Cannot open logger, using STDERR\n")); + + if (ACE_LOG_MSG->open (prog_name, ACE_Log_Msg::STDERR | verbose) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "Cannot open logger\n"), -1); + } ACE_DEBUG ((LM_STARTUP, "starting up the test\n")); @@ -29,8 +36,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { size_t priority = ACE_OS::rand () % int (LM_MAX); ACE_POW (priority); - ACE_DEBUG ((ACE_Log_Priority (priority), - "random message %d...\n", + ACE_Log_Priority log_priority = ACE_Log_Priority (priority); + ACE_DEBUG ((log_priority, + "random message %s (%d)...\n", + ACE_Log_Record::priority_name (log_priority), priority)); } diff --git a/netsvcs/lib/Client_Logging_Handler.cpp b/netsvcs/lib/Client_Logging_Handler.cpp index 4c574173941..eb00b21d89c 100644 --- a/netsvcs/lib/Client_Logging_Handler.cpp +++ b/netsvcs/lib/Client_Logging_Handler.cpp @@ -387,7 +387,8 @@ ACE_Client_Logging_Handler::send (ACE_Log_Record &log_record) } else ACE_DEBUG ((LM_DEBUG, - "Sent logging message successfully to Server Logging Daemon!\n")); + "Sent logging message %s successfully to Server Logging Daemon!\n", + log_record.priority_name (ACE_Log_Priority (log_record.type ())))); } return 0; |