summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-03-02 14:32:42 +0000
committerjtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-03-02 14:32:42 +0000
commit8d0ad617cadb18210ed3d9e05d2c3a4461495f7f (patch)
tree144b7d1c8f824cb4b00305657f345c93dfb7dbb5
parent48b9cc3823940e55a18f2b202e291f3af41a1d4f (diff)
downloadATCD-8d0ad617cadb18210ed3d9e05d2c3a4461495f7f.tar.gz
ChangeLogTag: Wed Mar 2 06:30:32 2005 J.T. Conklin <jtc@acorntoolworks.com>
-rw-r--r--TAO/ChangeLog12
-rw-r--r--TAO/orbsvcs/Concurrency_Service/Concurrency_Service.cpp41
-rw-r--r--TAO/orbsvcs/Concurrency_Service/Concurrency_Service.h7
3 files changed, 48 insertions, 12 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 47e7ae72b30..6fdfb164e00 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,15 @@
+Wed Mar 2 06:30:32 2005 J.T. Conklin <jtc@acorntoolworks.com>
+
+ * orbsvcs/Concurrency_Service/Concurrency_Service.cpp:
+ * orbsvcs/Concurrency_Service/Concurrency_Service.h:
+
+ Added '-p' command line option to write process id to file.
+
+ Changed to save the IOR file name instead of opening the IOR
+ file when parsing command line arguments. This avoids a file
+ descriptor leak if multiple "-o" options are specified on the
+ command line.
+
Wed Mar 2 06:22:37 2005 J.T. Conklin <jtc@acorntoolworks.com>
* orbsvcs/orbsvcs/Naming/Naming_Server.cpp:
diff --git a/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.cpp b/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.cpp
index d91467ed51d..ccb4b02fde3 100644
--- a/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.cpp
+++ b/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.cpp
@@ -29,7 +29,8 @@ ACE_RCSID(Concurrency_Service, Concurrency_Service, "$Id$")
Concurrency_Service::Concurrency_Service (void)
: use_naming_service_ (1),
- ior_output_file_ (0)
+ ior_file_name_ (0),
+ pid_file_name_ (0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT("Concurrency_Service::Concurrency_Service (void)\n")));
@@ -52,7 +53,7 @@ Concurrency_Service::parse_args (int argc, ACE_TCHAR** argv)
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT("Concurrency_Service::parse_args\n")));
- ACE_Get_Opt get_opts (argc, argv, ACE_LIB_TEXT("do:s"));
+ ACE_Get_Opt get_opts (argc, argv, ACE_LIB_TEXT("do:p:s"));
int c;
while ((c = get_opts ()) != -1)
@@ -62,11 +63,10 @@ Concurrency_Service::parse_args (int argc, ACE_TCHAR** argv)
TAO_debug_level++;
break;
case 'o': // output the IOR to a file
- this->ior_output_file_ = ACE_OS::fopen (get_opts.optarg, ACE_LIB_TEXT("w"));
- if (this->ior_output_file_ == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT("Unable to open %s for writing: %p\n"),
- get_opts.opt_arg ()), -1);
+ this->ior_file_name_ = get_opts.opt_arg();
+ break;
+ case 'p':
+ this->pid_file_name_ = get_opts.opt_arg();
break;
case 's':
this->use_naming_service_ = 0;
@@ -118,10 +118,31 @@ Concurrency_Service::init (int argc,
"The IOR is: <%s>\n",
ACE_TEXT_CHAR_TO_TCHAR(str.in ())));
- if (this->ior_output_file_)
+ if (this->ior_file_name_ != 0)
+ {
+ FILE* iorf = ACE_OS::fopen (ior_file_name_, ACE_LIB_TEXT("w"));
+ if (iorf == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s",
+ ior_file_name_),
+ -1);
+ }
+
+ ACE_OS::fprintf (iorf, "%s\n", str.in ());
+ ACE_OS::fclose (iorf);
+ }
+
+ if (this->pid_file_name_ != 0)
{
- ACE_OS::fprintf (this->ior_output_file_, "%s", str.in ());
- ACE_OS::fclose (this->ior_output_file_);
+ FILE* pidf = ACE_OS::fopen (pid_file_name_, ACE_LIB_TEXT("w"));
+ if (pidf != 0)
+ {
+ ACE_OS::fprintf (pidf,
+ "%ld\n",
+ static_cast<long> (ACE_OS::getpid ()));
+ ACE_OS::fclose (pidf);
+ }
}
if (this->use_naming_service_)
diff --git a/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.h b/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.h
index 1949fe51117..16cc020aae9 100644
--- a/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.h
+++ b/TAO/orbsvcs/Concurrency_Service/Concurrency_Service.h
@@ -74,8 +74,11 @@ private:
int use_naming_service_;
// Flag to tell wheter the naming service will be used.
- FILE *ior_output_file_;
- // File to output the concurrency server IOR.
+ const char *ior_file_name_;
+ // The name of the file where we output the IOR.
+
+ const char *pid_file_name_;
+ // The name of a file where the process stores its pid.
TAO_ORB_Manager orb_manager_;
// The ORB manager