summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-03-03 05:56:10 +0000
committeriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-03-03 05:56:10 +0000
commitf066ed5ee1554c31e0c724df3bb8b6d8252a5ae3 (patch)
tree4de53b98d1ab8dcf05ac07ca15f0f0f22d4036ef
parent7ad916ac3ba1f7016558b181bbc5175eed50d1dd (diff)
downloadATCD-f066ed5ee1554c31e0c724df3bb8b6d8252a5ae3.tar.gz
ChangeLogTag: Mon Mar 3 05:53:49 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com>
-rw-r--r--TAO/ChangeLog.iliyan-gestalt12
-rw-r--r--TAO/tao/TAO_Internal.cpp275
-rw-r--r--TAO/tests/Bug_2735_Regression/server.cpp10
3 files changed, 159 insertions, 138 deletions
diff --git a/TAO/ChangeLog.iliyan-gestalt b/TAO/ChangeLog.iliyan-gestalt
index 935a66d98ff..1c49a7f5472 100644
--- a/TAO/ChangeLog.iliyan-gestalt
+++ b/TAO/ChangeLog.iliyan-gestalt
@@ -1,3 +1,15 @@
+Mon Mar 3 05:53:49 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com>
+
+ * tao/TAO_Internal.cpp:
+
+ Adding a call to parse_private_args_i in open_global_services to
+ be able to process all args intended for the global config.
+
+ * tests/Bug_2735_Regression/server.cpp:
+
+ The argv must be 0-terminated to fulfill the contract with C's
+ argv.
+
Mon Mar 3 00:43:17 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com>
* tao/ORB.h:
diff --git a/TAO/tao/TAO_Internal.cpp b/TAO/tao/TAO_Internal.cpp
index 6297a3a3c46..b962636e798 100644
--- a/TAO/tao/TAO_Internal.cpp
+++ b/TAO/tao/TAO_Internal.cpp
@@ -120,162 +120,171 @@ namespace
CORBA::StringSeq & svc_config_argv,
bool & skip_service_config_open);
- /**
- * Initialize ORB-local (private) ACE Service Configurator
- * repository.
- *
- * @return @c 0 if successful, @c -1 with @c errno set if failure.
- *
- */
- int open_private_services_i (ACE_Service_Gestalt_Auto_Ptr pcfg,
- int & argc,
- char ** argv,
- bool skip_service_config_open = false,
- bool ignore_default_svc_conf_file = false);
+ /**
+ * Initialize ORB-local (private) ACE Service Configurator
+ * repository.
+ *
+ * @return @c 0 if successful, @c -1 with @c errno set if failure.
+ *
+ */
+ int open_private_services_i (ACE_Service_Gestalt_Auto_Ptr pcfg,
+ int & argc,
+ char ** argv,
+ bool skip_service_config_open = false,
+ bool ignore_default_svc_conf_file = false);
+
+ /**
+ * Number of times open_services() has been called. Incremented by
+ * open_global_services_i(), and decremented by close_services().
+ *
+ * @note In/decrement operations are atomic.
+ */
+ long service_open_count = 0;
+
+ /**
+ * Part of a condition variable, which helps to ensure non-default
+ * ORBs can not proceed with their initialization, until the globaly
+ * required services have been instantiated by the default
+ * ORB. Usually, the first ORB to be created is designated the
+ * default ORB (reference the CORBA spec)
+ */
+ bool is_ubergestalt_ready = false;
+
+ char const * resource_factory_args =
+ TAO_DEFAULT_RESOURCE_FACTORY_ARGS;
+ char const * server_strategy_factory_args =
+ TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS;
+ char const * client_strategy_factory_args =
+ TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS;
+
+ #if (TAO_NEGOTIATE_CODESETS == 1)
+ bool negotiate_codesets = true;
+ #else
+ bool negotiate_codesets = false;
+ #endif /* TAO_NEGOTIATE_CODESETS */
+ } // anonymous namespace
+
+ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ #if defined (ACE_HAS_THREADS)
+ /// A little helper class to get around the TAO_Singleton::instance ()
+ /// inability to pass default initialization arguments to the
+ /// singleton ctor.
+
+ class TAO_Ubergestalt_Ready_Condition
+ : public ACE_SYNCH_RECURSIVE_CONDITION
+ {
+ public:
+ static TAO_Ubergestalt_Ready_Condition* instance (void)
+ {
+ return TAO_Singleton <TAO_Ubergestalt_Ready_Condition,
+ TAO_SYNCH_RECURSIVE_MUTEX>::instance ();
+ }
- /**
- * Number of times open_services() has been called. Incremented by
- * open_global_services_i(), and decremented by close_services().
- *
- * @note In/decrement operations are atomic.
- */
- long service_open_count = 0;
+ TAO_Ubergestalt_Ready_Condition (void)
+ : ACE_SYNCH_RECURSIVE_CONDITION (mutex_)
+ {
+ }
- /**
- * Part of a condition variable, which helps to ensure non-default
- * ORBs can not proceed with their initialization, until the globaly
- * required services have been instantiated by the default
- * ORB. Usually, the first ORB to be created is designated the
- * default ORB (reference the CORBA spec)
- */
- bool is_ubergestalt_ready = false;
-
- char const * resource_factory_args =
- TAO_DEFAULT_RESOURCE_FACTORY_ARGS;
- char const * server_strategy_factory_args =
- TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS;
- char const * client_strategy_factory_args =
- TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS;
-
-#if (TAO_NEGOTIATE_CODESETS == 1)
- bool negotiate_codesets = true;
-#else
- bool negotiate_codesets = false;
-#endif /* TAO_NEGOTIATE_CODESETS */
-} // anonymous namespace
-
-TAO_BEGIN_VERSIONED_NAMESPACE_DECL
-
-#if defined (ACE_HAS_THREADS)
-/// A little helper class to get around the TAO_Singleton::instance ()
-/// inability to pass default initialization arguments to the
-/// singleton ctor.
-
-class TAO_Ubergestalt_Ready_Condition
- : public ACE_SYNCH_RECURSIVE_CONDITION
-{
-public:
- static TAO_Ubergestalt_Ready_Condition* instance (void)
- {
- return TAO_Singleton <TAO_Ubergestalt_Ready_Condition,
- TAO_SYNCH_RECURSIVE_MUTEX>::instance ();
- }
+ private:
+ /// The mutex, associated with the condition. Do not use the ACE
+ /// global mutex, because it causes deadlocks with other threads that
+ /// may be in DLL_Manager::open()
+ ACE_Recursive_Thread_Mutex mutex_;
+ };
+ #endif // ACE_HAS_THREADS
- TAO_Ubergestalt_Ready_Condition (void)
- : ACE_SYNCH_RECURSIVE_CONDITION (mutex_)
- {
- }
-private:
- /// The mutex, associated with the condition. Do not use the ACE
- /// global mutex, because it causes deadlocks with other threads that
- /// may be in DLL_Manager::open()
- ACE_Recursive_Thread_Mutex mutex_;
-};
-#endif // ACE_HAS_THREADS
+ // ****************************************************************
+ /// Note that the argument vector will be corrupted upon return
+ int
+ TAO::ORB::open_global_services (int argc,
+ char **argv)
+ {
+ // Count of the number of (times we did this for all) ORBs.
+ static int orb_init_count = 0;
+ {
+ // Using ACE_Static_Object_Lock::instance() precludes ORB_init()
+ // from being called within a static object CTOR.
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ *ACE_Static_Object_Lock::instance (),
+ -1));
+
+ // Make sure TAO's singleton manager is initialized.
+ // We need to initialize before TAO_default_environment() is called
+ // since that call instantiates a TAO_TSS_Singleton.
+ if (TAO_Singleton_Manager::instance ()->init () == -1)
+ return -1;
+
+ // Prevent multiple initializations.
+ if (++orb_init_count > 1)
+ return 0;
-// ****************************************************************
-/// Note that the argument vector will be corrupted upon return
-int
-TAO::ORB::open_global_services (int argc,
- char **argv)
-{
- // Count of the number of (times we did this for all) ORBs.
- static int orb_init_count = 0;
+ }
- {
- // Using ACE_Static_Object_Lock::instance() precludes ORB_init()
- // from being called within a static object CTOR.
+ // Prevent any other thread from going through ORB initialization before the
+ // uber-gestalt is initialized.
ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
guard,
- *ACE_Static_Object_Lock::instance (),
+ TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
-1));
- // Make sure TAO's singleton manager is initialized.
- // We need to initialize before TAO_default_environment() is called
- // since that call instantiates a TAO_TSS_Singleton.
- if (TAO_Singleton_Manager::instance ()->init () == -1)
- return -1;
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Initializing the ")
+ ACE_TEXT ("process-wide service context\n")));
+ }
- // Prevent multiple initializations.
- if (++orb_init_count > 1)
- return 0;
+ ACE_Service_Gestalt* theone = ACE_Service_Config::global ();
+ ACE_Service_Config_Guard auto_config_guard (theone);
- }
+ register_global_services_i (theone);
- // Prevent any other thread from going through ORB initialization before the
- // uber-gestalt is initialized.
- ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
- guard,
- TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
- -1));
+ // Be certain to copy the program name so that service configurator
+ // has something to skip!
+ ACE_CString argv0 ((argc <= 0 || argv == 0) ? "" : ACE_TEXT_ALWAYS_CHAR (argv[0]));
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) Initializing the ")
- ACE_TEXT ("process-wide service context\n")));
- }
+ // Construct an argument vector specific to the process-wide
+ // (global) Service Configurator instance.
+ CORBA::StringSeq global_svc_config_argv;
+ global_svc_config_argv.length (1);
+ global_svc_config_argv[0] = argv0.c_str ();
- ACE_Service_Gestalt* theone = ACE_Service_Config::global ();
- ACE_Service_Config_Guard auto_config_guard (theone);
+ // Will expand the environment variables, if any were used. Is this a good thing?
+ // I guess it provides greater flexibility for deployment, so let's leave it.
+ ACE_ARGV copyargv (argv);
- register_global_services_i (theone);
+ // Adjust to proper TCHAR type
+ int tmpargc = argc;
+ ACE_Argv_Type_Converter cvtargv (tmpargc, copyargv.argv());
- // Be certain to copy the program name so that service configurator
- // has something to skip!
- ACE_CString argv0 ((argc <= 0 || argv == 0) ? "" : ACE_TEXT_ALWAYS_CHAR (argv[0]));
+ tmpargc = cvtargv.get_argc ();
+ ACE_TCHAR **tmpargv = cvtargv.get_TCHAR_argv ();
- // Construct an argument vector specific to the process-wide
- // (global) Service Configurator instance.
- CORBA::StringSeq global_svc_config_argv;
- global_svc_config_argv.length (1);
- global_svc_config_argv[0] = argv0.c_str ();
-
- // Will expand the environment variables, if any were used. Is this a good thing?
- // I guess it provides greater flexibility for deployment, so let's leave it.
- ACE_ARGV copyargv (argv);
-
- // Adjust to proper TCHAR type
- int tmpargc = argc;
- ACE_Argv_Type_Converter cvtargv (tmpargc, copyargv.argv());
-
- // Collect global SC parameters. True means "immediately
- // apply global setting" like debug flag, etc.
- if (parse_global_args_i (cvtargv.get_argc (),
- cvtargv.get_TCHAR_argv(),
- global_svc_config_argv,
- true) == -1)
- return -1;
+ // Collect global SC parameters. True means "immediately
+ // apply global setting" like debug flag, etc.
+ if (parse_global_args_i (tmpargc,
+ tmpargv,
+ global_svc_config_argv,
+ true) == -1)
+ return -1;
- bool skip_service_config_open = false; // by default we shouldn't
+ bool skip_service_config_open = false; // by default we shouldn't
- if (parse_svcconf_args_i (cvtargv.get_argc (),
- cvtargv.get_TCHAR_argv(),
- global_svc_config_argv) == -1)
+ if (parse_svcconf_args_i (tmpargc,
+ tmpargv,
+ global_svc_config_argv) == -1)
+ return -1;
+
+ if (parse_private_args_i (tmpargc,
+ tmpargv,
+ global_svc_config_argv,
+ skip_service_config_open) == -1)
return -1;
// Perform the open magic (unless SC::open() has been called already)
diff --git a/TAO/tests/Bug_2735_Regression/server.cpp b/TAO/tests/Bug_2735_Regression/server.cpp
index 5fa0f1e4591..8484e743e59 100644
--- a/TAO/tests/Bug_2735_Regression/server.cpp
+++ b/TAO/tests/Bug_2735_Regression/server.cpp
@@ -27,7 +27,7 @@ parse_args (int argc, ACE_TCHAR *argv[])
while ((c = get_opts ()) != -1)
switch (c)
- {
+ {
case 'f':
factory_strategy = FOO_STRATEGY;
break;
@@ -40,12 +40,12 @@ parse_args (int argc, ACE_TCHAR *argv[])
"usage: %s "
"-f "
"-s "
- "\n",
+ "\n",
argv [0]),
-1);
}
- return 0;
-}
+ return 0;
+}
int
@@ -57,7 +57,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
return -1;
int targc = 3;
- const char* targv[] = { "server", "-ORBSvcConfDirective", 0 };
+ const char* targv[] = { "server", "-ORBSvcConfDirective", 0, 0 }; // null-terminated!
switch (factory_strategy)
{
case FOO_STRATEGY: