summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-25 17:37:58 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-25 17:37:58 +0000
commit19d7c0c1fb1b7398b74433adc5c9ffb3a3ff677a (patch)
tree9ad61815043f0477bfd6cfbf977885ec62957eb3
parent4f1e4b05fd14bfd7453910cfeb68c10eab204dd0 (diff)
downloadATCD-19d7c0c1fb1b7398b74433adc5c9ffb3a3ff677a.tar.gz
added support for passing location and errno through minor status of SystemExceptions
-rw-r--r--TAO/tao/Environment.cpp21
-rw-r--r--TAO/tao/Exception.cpp89
-rw-r--r--TAO/tao/Exception.h10
-rw-r--r--TAO/tao/Invocation.cpp22
-rw-r--r--TAO/tao/corbafwd.h34
5 files changed, 126 insertions, 50 deletions
diff --git a/TAO/tao/Environment.cpp b/TAO/tao/Environment.cpp
index cf0713126d3..6240f4e93b3 100644
--- a/TAO/tao/Environment.cpp
+++ b/TAO/tao/Environment.cpp
@@ -206,23 +206,7 @@ CORBA::Environment::print_exception (const char *info,
if (x2 != 0)
{
-
- // @@ there are a other few "user exceptions" in the CORBA
- // scope, they're not all standard/system exceptions ... really
- // need to either compare exhaustively against all those IDs
- // (yeech) or (preferably) to represent the exception type
- // directly in the exception value so it can be queried.
-
- ACE_DEBUG ((LM_ERROR,
- "TAO: (%P|%t) system exception, ID '%s'\n",
- id));
- ACE_DEBUG ((LM_ERROR,
- "TAO: (%P|%t) minor code = %x, completed = %s\n",
- x2->minor (),
- (x2->completed () == CORBA::COMPLETED_YES) ? "YES" :
- (x2->completed () == CORBA::COMPLETED_NO) ? "NO" :
- (x2->completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
- "garbage"));
+ x2->print_exception_tao_ ();
}
else
// @@ we can use the exception's typecode to dump all the data
@@ -261,6 +245,3 @@ CORBA_Environment_var::operator= (const CORBA_Environment_var &r)
this->ptr_ = new CORBA::Environment (*r.ptr_);
return *this;
}
-
-
-
diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp
index bca1f293f1c..01b4b206b28 100644
--- a/TAO/tao/Exception.cpp
+++ b/TAO/tao/Exception.cpp
@@ -107,23 +107,7 @@ CORBA_Exception::print_exception (const char *info,
if (x2 != 0)
{
-
- // @@ there are a other few "user exceptions" in the CORBA
- // scope, they're not all standard/system exceptions ... really
- // need to either compare exhaustively against all those IDs
- // (yeech) or (preferably) to represent the exception type
- // directly in the exception value so it can be queried.
-
- ACE_DEBUG ((LM_ERROR,
- "(%P|%t) system exception, ID '%s'\n",
- id));
- ACE_DEBUG ((LM_ERROR,
- "(%P|%t) minor code = %x, completed = %s\n",
- x2->minor (),
- (x2->completed () == CORBA::COMPLETED_YES) ? "YES" :
- (x2->completed () == CORBA::COMPLETED_NO) ? "NO" :
- (x2->completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
- "garbage"));
+ x2->print_exception_tao_ ();
}
else
// @@ we can use the exception's typecode to dump all the data
@@ -248,6 +232,77 @@ CORBA_SystemException::_raise (void)
TAO_RAISE(*this);
}
+CORBA::ULong
+CORBA_SystemException::errno_tao_ (int errno_value)
+{
+ switch (errno_value) {
+ case ETIMEDOUT : return TAO_ETIMEDOUT_MINOR_CODE;
+ case ENFILE : return TAO_ENFILE_MINOR_CODE;
+ case EMFILE : return TAO_EMFILE_MINOR_CODE;
+ default : return TAO_UNKNOWN_MINOR_CODE;
+ }
+}
+
+CORBA::ULong
+CORBA_SystemException::minor_code_tao_ (u_int location, int errno_value)
+{
+ return TAO_DEFAULT_MINOR_CODE |
+ location |
+ errno_tao_ (errno_value);
+}
+
+void
+CORBA_SystemException::print_exception_tao_ (FILE *) const
+{
+ // @@ there are a other few "user exceptions" in the CORBA
+ // scope, they're not all standard/system exceptions ... really
+ // need to either compare exhaustively against all those IDs
+ // (yeech) or (preferably) to represent the exception type
+ // directly in the exception value so it can be queried.
+
+ ACE_DEBUG ((LM_ERROR,
+ "(%P|%t) system exception, ID '%s'\n",
+ _id ()));
+
+ const char *location;
+ switch (minor () & 0x00000FF0) {
+ case TAO_INVOCATION_CONNECT_MINOR_CODE :
+ location = "invocation connect failed";
+ break;
+ case TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE :
+ location = "location forward failed";
+ break;
+ case TAO_INVOCATION_SEND_REQUEST_MINOR_CODE :
+ location = "send request failed";
+ break;
+ default :
+ location = "unknown location";
+ }
+
+ const char *errno_indication;
+ switch (minor () & 0x0000000F) {
+ case TAO_ETIMEDOUT_MINOR_CODE :
+ errno_indication = "ETIMEOUT";
+ break;
+ case TAO_ENFILE_MINOR_CODE :
+ errno_indication = "ENFILE";
+ break;
+ case TAO_EMFILE_MINOR_CODE :
+ errno_indication = "EMFILE";
+ break;
+ default :
+ errno_indication = "unknown errno";
+ }
+
+ ACE_DEBUG ((LM_ERROR,
+ "(%P|%t) minor code = %x (%s; %s), completed = %s\n",
+ minor (), location, errno_indication,
+ (completed () == CORBA::COMPLETED_YES) ? "YES" :
+ (completed () == CORBA::COMPLETED_NO) ? "NO" :
+ (completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
+ "garbage"));
+}
+
// ****************************************************************
diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h
index 31539329182..ce7c326082c 100644
--- a/TAO/tao/Exception.h
+++ b/TAO/tao/Exception.h
@@ -174,6 +174,16 @@ public:
virtual void _raise (void);
+ void print_exception_tao_ (FILE *f = stdout) const;
+ // Print the system exception <ex> to output determined by f.
+ // This function is not CORBA compliant.
+
+ static CORBA::ULong minor_code_tao_ (u_int location, int errno_value);
+ // Helper to create a minor status value.
+
+ static CORBA::ULong errno_tao_ (int errno_value);
+ // Helper to translate a platform-specific errno to a TAO errno value.
+
private:
CORBA::ULong minor_;
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index 0f770c8b042..9b3f0ee2ecb 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -194,7 +194,11 @@ TAO_GIOP_Invocation::start (CORBA::Boolean is_roundtrip,
// Try moving to the next profile and starting over, if that
// fails then we must raise the TRANSIENT exception.
if (this->stub_->next_profile_retry () == 0)
- ACE_THROW (CORBA::TRANSIENT ());
+ ACE_THROW (CORBA::TRANSIENT (
+ CORBA_SystemException::minor_code_tao_ (
+ TAO_INVOCATION_CONNECT_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_NO));
}
const TAO_ObjectKey& key = this->profile_->object_key();
@@ -487,8 +491,12 @@ TAO_GIOP_Invocation::location_forward (TAO_InputCDR &inp_stream,
// get created on a per-call basis. For now we'll play it safe.
if (this->stub_->next_profile () == 0)
- ACE_THROW_RETURN (CORBA::TRANSIENT (),
- TAO_INVOKE_EXCEPTION);
+ ACE_THROW_RETURN (CORBA::TRANSIENT (
+ CORBA_SystemException::minor_code_tao_ (
+ TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_NO),
+ TAO_INVOKE_EXCEPTION);
return TAO_INVOKE_RESTART;
}
@@ -947,8 +955,12 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV)
// works? Or is that something that a higher level component
// should decide? Remember that LocateRequests are part of
// the strategy to establish a connection.
- ACE_THROW_RETURN (CORBA::TRANSIENT (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE),
- TAO_INVOKE_EXCEPTION);
+ ACE_THROW_RETURN (CORBA::TRANSIENT (
+ CORBA_SystemException::minor_code_tao_ (
+ TAO_INVOCATION_SEND_REQUEST_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_EXCEPTION);
}
// @@ Maybe the right place to do this is once the reply is
diff --git a/TAO/tao/corbafwd.h b/TAO/tao/corbafwd.h
index e40a14a40ff..4b0f97bc3e1 100644
--- a/TAO/tao/corbafwd.h
+++ b/TAO/tao/corbafwd.h
@@ -61,14 +61,6 @@
# endif
#endif /* _MSC_VER */
-// This number was assigned by the OMG do *NOT* change at random
-// The ASCII represetantion is TA0xxxx, close enough since they only
-// take 20 bits, the first 16 are TA, the next 4 are 0000.
-// Remember that we can only play with the last 12 bits,
-// TAO_MAX_MINOR_CODE is there to remind us of that.
-#define TAO_DEFAULT_MINOR_CODE 0x544F0000
-#define TAO_MAX_MINOR_CODE 0x544F0FFF
-
// Forward declarations of some data types are needed.
class CORBA_Any;
@@ -901,6 +893,32 @@ private:
// ****************************************************************
+// This number was assigned by the OMG. Do *NOT* change at random.
+// The ASCII represetantion is TA0xxxx, close enough since they only
+// take 20 bits, the first 16 are TA, the next 4 are 0000. Remember
+// that we can only play with the last 12 bits, TAO_MAX_MINOR_CODE is
+// there to remind us of that.
+#define TAO_DEFAULT_MINOR_CODE 0x54410000
+#define TAO_MAX_MINOR_CODE 0x54410FFF
+
+// Minor code encoding. Skip 4 bits, currently unused. Then, encode
+// the location in 4 bits, and the errno in 4 bits:
+// 0x 0101 0100 0100 0001 0000 ____ ____ ____
+// T A 0 location errno
+
+// Location encoding: next-to-last 8 bits.
+#define TAO_INVOCATION_CONNECT_MINOR_CODE (0x01u << 4)
+#define TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE (0x02u << 4)
+#define TAO_INVOCATION_SEND_REQUEST_MINOR_CODE (0x03u << 4)
+
+// errno encoding: bottom 4 bits.
+#define TAO_UNKNOWN_MINOR_CODE 0x00u
+#define TAO_ETIMEDOUT_MINOR_CODE 0x01u
+#define TAO_ENFILE_MINOR_CODE 0x02u
+#define TAO_EMFILE_MINOR_CODE 0x03u
+
+// ****************************************************************
+
// A helper clas to handle the various kinds of octet sequences used
// inside the ORB.