diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2005-03-21 13:47:01 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2005-03-21 13:47:01 +0000 |
commit | 5e4e89f4b26a53be077a6ec17f9bbee9858b2227 (patch) | |
tree | 7afa698ad3d8d60fd566a02944903dfa8b873680 | |
parent | 189dcb302f2e7b6ff9bd95916c45a79d066d7df5 (diff) | |
download | ATCD-5e4e89f4b26a53be077a6ec17f9bbee9858b2227.tar.gz |
ChangeLogTag: Mon Mar 21 07:46:16 2005 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 33 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/CosNaming.mpc | 10 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Load_Average_Monitor.cpp | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Utilization_Monitor.cpp | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp | 93 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable.h | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable.inl | 43 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp | 28 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Shutdown_Utilities.cpp | 2 |
10 files changed, 226 insertions, 27 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index fa93b35eeba..7f5cb379016 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,36 @@ +Mon Mar 21 07:46:16 2005 Chad Elliott <elliott_c@ociweb.com> + + * orbsvcs/orbsvcs/CosNaming.mpc: + + Turn off optimization for the CosNaming_Serv library when using + cxx on Tru64. It's broken with respect to the binding iterator + template class. + + * orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Load_Average_Monitor.cpp: + * orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Utilization_Monitor.cpp: + + Corrected HP-UX and Windows related macros and added support for + MacOS X. + + * orbsvcs/orbsvcs/Naming/Naming_Server.h: + + Removed an unused data member. + + * orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp: + * orbsvcs/orbsvcs/Naming/Storable.h: + * orbsvcs/orbsvcs/Naming/Storable.inl: + * orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp: + + Added error indication to the flat file extraction operators and + error checking to the storable naming context loading code. + + Also, changed the initialization of String_var data member in + Storable_Naming_Context.cpp to duplicate the constant string (""). + + * orbsvcs/orbsvcs/Shutdown_Utilities.cpp: + + Added the method name to the %p parameter. + Mon Mar 21 06:56:10 2005 Chad Elliott <elliott_c@ociweb.com> * tao/IIOP_Connection_Handler.cpp: diff --git a/TAO/orbsvcs/orbsvcs/CosNaming.mpc b/TAO/orbsvcs/orbsvcs/CosNaming.mpc index 614cab7ba66..4ed766dbe09 100644 --- a/TAO/orbsvcs/orbsvcs/CosNaming.mpc +++ b/TAO/orbsvcs/orbsvcs/CosNaming.mpc @@ -108,4 +108,14 @@ project(CosNaming_Serv) : orbsvcslib, core, naming_skel, messaging, svc_utils, i Pkgconfig_Files { TAO_CosNaming_Serv.pc.in } + + verbatim(gnuace, local) { + ## The optimizer in cxx (as of V6.5-014) is broken. Evidence can + ## be found in the iterator portion of Simple_Naming test + ifeq ($(CXX), cxx) + ifeq ($(findstring Tru64, $(ACE_DU_SUBVERSION)), Tru64) + OCFLAGS += -O0 + endif + endif + } } diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Load_Average_Monitor.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Load_Average_Monitor.cpp index 3f2be9cd0f3..105c2f6a738 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Load_Average_Monitor.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Load_Average_Monitor.cpp @@ -6,7 +6,7 @@ #include "ace/os_include/os_netdb.h" #include "ace/os_include/sys/os_pstat.h" #include "ace/os_include/sys/os_loadavg.h" -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined (__APPLE__) #include <sys/sysctl.h> #endif @@ -89,7 +89,7 @@ TAO_LB_CPU_Load_Average_Monitor::loads (ACE_ENV_SINGLE_ARG_DECL) // the number of processors and assume that any processor failure // is a catastrophic one. -#if defined (WINDOWS) +#if 0 SYSTEM_INFO sys_info; ::GetSystemInfo (&sys_info); @@ -162,7 +162,7 @@ TAO_LB_CPU_Load_Average_Monitor::loads (ACE_ENV_SINGLE_ARG_DECL) else ACE_THROW_RETURN (CORBA::TRANSIENT (), 0); // Correct exception? -#elif defined (__NetBSD__) +#elif defined (__NetBSD__) || defined (__APPLE__) double loadavg[1]; @@ -189,7 +189,7 @@ TAO_LB_CPU_Load_Average_Monitor::loads (ACE_ENV_SINGLE_ARG_DECL) else ACE_THROW_RETURN (CORBA::TRANSIENT (), 0); // Correct exception? -#elif defined (hpux) +#elif defined (__hpux) struct pst_dynamic psd; @@ -209,7 +209,7 @@ TAO_LB_CPU_Load_Average_Monitor::loads (ACE_ENV_SINGLE_ARG_DECL) #endif -#if defined (WINDOWS) || defined (linux) || defined (sun) || defined (hpux) || defined(__NetBSD__) +#if defined (linux) || defined (sun) || defined (__hpux) || defined(__NetBSD__) || defined (__APPLE__) CosLoadBalancing::LoadList * tmp; ACE_NEW_THROW_EX (tmp, @@ -235,6 +235,6 @@ TAO_LB_CPU_Load_Average_Monitor::loads (ACE_ENV_SINGLE_ARG_DECL) ACE_UNUSED_ARG (load); ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); -#endif /* WINDOWS || linux || sun || hpux || __NetBSD__ */ +#endif /* linux || sun || __hpux || __NetBSD__ || __APPLE__ */ } diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Utilization_Monitor.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Utilization_Monitor.cpp index 24c8216a382..11ae897574e 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Utilization_Monitor.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Utilization_Monitor.cpp @@ -130,7 +130,7 @@ TAO_LB_CPU_Utilization_Monitor::loads (ACE_ENV_SINGLE_ARG_DECL) { CORBA::Float load = 0; -#if defined (linux) || defined (sun) || defined (hpux) +#if defined (linux) || defined (sun) double load_double = calc_cpu_loading (); load = load_double; @@ -161,6 +161,6 @@ TAO_LB_CPU_Utilization_Monitor::loads (ACE_ENV_SINGLE_ARG_DECL) ACE_UNUSED_ARG (load); ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); -#endif /* WINDOWS || linux || sun || hpux */ +#endif /* linux || sun */ } diff --git a/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp index fb71c6f1a4c..19c6ede797d 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp @@ -162,10 +162,26 @@ TAO_NS_FlatFileStream::operator >>( int destroyed; ACE_OS::rewind(this->fl_); - fscanf(fl_, "%u\n", &size); + switch (fscanf(fl_, "%u\n", &size)) + { + case 0: + this->setstate (badbit); + return *this; + case EOF: + this->setstate (eofbit); + return *this; + } header.size(size); - fscanf(fl_, "%d\n", &destroyed); + switch (fscanf(fl_, "%d\n", &destroyed)) + { + case 0: + this->setstate (badbit); + return *this; + case EOF: + this->setstate (eofbit); + return *this; + } header.destroyed(destroyed); return *this; @@ -204,39 +220,86 @@ TAO_NS_FlatFileStream::operator >>( ACE_TRACE("TAO_NS_FlatFileStream::operator >>"); TAO_NS_Persistence_Record::Record_Type type; int temp_type_in; - fscanf(fl_, "%d\n", &temp_type_in); + switch (fscanf(fl_, "%d\n", &temp_type_in)) + { + case 0: + this->setstate (badbit); + return *this; + case EOF: + this->setstate (eofbit); + return *this; + } type = (TAO_NS_Persistence_Record::Record_Type) temp_type_in; record.type(type); - size_t bufSize = 0; + int bufSize = 0; //id - fscanf(fl_, ACE_TEXT_ALWAYS_CHAR (ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("\n")), &bufSize); + switch (fscanf(fl_, "%d\n", &bufSize)) + { + case 0: + this->setstate (badbit); + return *this; + case EOF: + this->setstate (eofbit); + return *this; + } char *id = new char[bufSize+1]; //char *id; //ACE_NEW_RETURN (id, char[bufSize+1], 1); - ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(id), bufSize+1, fl_); + if (ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(id), bufSize+1, fl_) == 0 && + bufSize != 0) + { + this->setstate (badbit); + return *this; + } ACE_CString newId(id); record.id(newId); delete [] id; //kind - fscanf(fl_, ACE_TEXT_ALWAYS_CHAR (ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("\n")), &bufSize); + switch (fscanf(fl_, "%d\n", &bufSize)) + { + case 0: + this->setstate (badbit); + return *this; + case EOF: + this->setstate (eofbit); + return *this; + } char *kind = new char[bufSize+1]; //char *kind; //ACE_NEW (kind, char[bufSize+1]); - ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(kind), bufSize+1, fl_); + if (ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(kind), bufSize+1, fl_) == 0 && + bufSize != 0) + { + this->setstate (badbit); + return *this; + } kind[bufSize] = '\0'; ACE_CString newKind(kind); record.kind(newKind); delete [] kind; //ref - fscanf(fl_, ACE_TEXT_ALWAYS_CHAR (ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("\n")), &bufSize); + switch (fscanf(fl_, "%d\n", &bufSize)) + { + case 0: + this->setstate (badbit); + return *this; + case EOF: + this->setstate (eofbit); + return *this; + } char *ref = new char[bufSize+1]; //char *ref; //ACE_NEW(ref, char[bufSize+1]); - ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(ref), bufSize+1, fl_); + if (ACE_OS::fgets(ACE_TEXT_CHAR_TO_TCHAR(ref), bufSize+1, fl_) == 0 && + bufSize != 0) + { + this->setstate (badbit); + return *this; + } ACE_CString newRef(ref); record.ref(newRef); delete [] ref; @@ -265,7 +328,15 @@ TAO_NS_FlatFileStream::operator >>( unsigned int counter = 0; ACE_OS::rewind(this->fl_); - fscanf(fl_, "%u\n", &counter); + switch (fscanf(fl_, "%u\n", &counter)) + { + case 0: + this->setstate (badbit); + return *this; + case EOF: + this->setstate (eofbit); + return *this; + } global.counter(counter); return *this; diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h index 185773b357d..9777c7244d5 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Server.h @@ -204,10 +204,6 @@ protected: /// identified by the <persistence_file_name_>. void *base_address_; - /// After how long the server should stop listening to requests (in - /// seconds). - size_t time_; - /// If not zero multicast is enabled. int multicast_; diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable.h b/TAO/orbsvcs/orbsvcs/Naming/Storable.h index d15e4bbb38b..4e82d203852 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Storable.h +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable.h @@ -87,6 +87,28 @@ public: virtual time_t last_changed(void) = 0; + // Mimic a portion of the std::ios interface. We need to be able + // to indicate error states from the extraction operators below. + enum Storable_State { goodbit = 0, + badbit = 1, + eofbit = 2, + failbit = 4 + }; + + void clear (Storable_State state = goodbit); + + void setstate (Storable_State state); + + Storable_State rdstate (void) const; + + bool good (void) const; + + bool bad (void) const; + + bool eof (void) const; + + bool fail (void) const; + virtual TAO_Storable_Base& operator << ( const TAO_NS_Persistence_Header& header) = 0; @@ -105,6 +127,8 @@ public: virtual TAO_Storable_Base& operator >> ( TAO_NS_Persistence_Global& global) = 0; +private: + Storable_State state_; }; class TAO_Naming_Service_Persistence_Factory diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable.inl b/TAO/orbsvcs/orbsvcs/Naming/Storable.inl index ca417e0913d..c6eff092b53 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Storable.inl +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable.inl @@ -111,6 +111,7 @@ TAO_Naming_Service_Persistence_Factory::~TAO_Naming_Service_Persistence_Factory( ACE_INLINE TAO_Storable_Base::TAO_Storable_Base() + : state_ (goodbit) { } @@ -119,3 +120,45 @@ TAO_Storable_Base::~TAO_Storable_Base() { } +ACE_INLINE void +TAO_Storable_Base::clear (TAO_Storable_Base::Storable_State state) +{ + this->state_ = state; +} + +ACE_INLINE void +TAO_Storable_Base::setstate (TAO_Storable_Base::Storable_State state) +{ + this->clear (static_cast <TAO_Storable_Base::Storable_State> ( + this->rdstate () | state)); +} + +ACE_INLINE TAO_Storable_Base::Storable_State +TAO_Storable_Base::rdstate (void) const +{ + return this->state_; +} + +ACE_INLINE bool +TAO_Storable_Base::good (void) const +{ + return (this->state_ == goodbit); +} + +ACE_INLINE bool +TAO_Storable_Base::bad (void) const +{ + return (this->state_ & badbit); +} + +ACE_INLINE bool +TAO_Storable_Base::eof (void) const +{ + return (this->state_ & eofbit); +} + +ACE_INLINE bool +TAO_Storable_Base::fail (void) const +{ + return (this->state_ & failbit); +} diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp index 8e9ff4254ae..4ae1de02ed0 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp @@ -27,7 +27,7 @@ ACE_RCSID (Naming, "$Id$") TAO_Storable_IntId::TAO_Storable_IntId (void) - : ref_ (""), + : ref_ (CORBA::string_dup ("")), type_ (CosNaming::nobject) { } @@ -61,8 +61,8 @@ TAO_Storable_IntId::operator= (const TAO_Storable_IntId &rhs) } TAO_Storable_ExtId::TAO_Storable_ExtId (void) - : id_ (""), - kind_ ("") + : id_ (CORBA::string_dup ("")), + kind_ (CORBA::string_dup ("")) { } @@ -339,6 +339,11 @@ TAO_Storable_Naming_Context::load_map(File_Open_Lock_and_Check *flck // we are only using the size from this header flck->peer() >> header; + if (!flck->peer ().good ()) + { + flck->peer ().clear (); + ACE_THROW (CORBA::INTERNAL ()); + } // reset the destroyed flag this->destroyed_ = header.destroyed(); @@ -347,6 +352,11 @@ TAO_Storable_Naming_Context::load_map(File_Open_Lock_and_Check *flck for (unsigned int i=0; i<header.size(); i++) { flck->peer() >> record; + if (!flck->peer ().good ()) + { + flck->peer ().clear (); + ACE_THROW (CORBA::INTERNAL ()); + } if( record.type() == TAO_NS_Persistence_Record::NCONTEXT ) { PortableServer::ObjectId_var id = @@ -679,6 +689,12 @@ TAO_Storable_Naming_Context::new_context (ACE_ENV_SINGLE_ARG_DECL) CosNaming::NamingContext::_nil ()); // get the counter from disk *gfl_.get() >> global; + if (!gfl_.get ()->good () && + gfl_.get ()->rdstate () != TAO_Storable_Base::eofbit) + { + gfl_.get ()->clear (); + ACE_THROW (CORBA::INTERNAL ()); + } gcounter_ = global.counter(); // use it to generate a new name } @@ -1512,6 +1528,12 @@ CosNaming::NamingContext_ptr TAO_Storable_Naming_Context::recreate_all( // get the counter from disk TAO_NS_Persistence_Global global; *gfl_.get() >> global; + if (!gfl_.get ()->good () && + gfl_.get ()->rdstate () != TAO_Storable_Base::eofbit) + { + gfl_.get ()->clear (); + ACE_THROW (CORBA::INTERNAL ()); + } gcounter_ = global.counter(); if(redundant_) gfl_->close(); diff --git a/TAO/orbsvcs/orbsvcs/Shutdown_Utilities.cpp b/TAO/orbsvcs/orbsvcs/Shutdown_Utilities.cpp index 2229b7d3c3d..349ef74d6d4 100644 --- a/TAO/orbsvcs/orbsvcs/Shutdown_Utilities.cpp +++ b/TAO/orbsvcs/orbsvcs/Shutdown_Utilities.cpp @@ -51,7 +51,7 @@ Service_Shutdown::set_signals (ACE_Sig_Set& which_signals) if (this->shutdown_.register_handler (i, this) == -1) ACE_DEBUG ((LM_WARNING, "WARNING: Failed to register signal handler for signal %d: %p\n", - i, ACE_TEXT (""))); + i, ACE_TEXT ("register_handler"))); else did_register = 1; } |