summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/Naming_Service
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-29 18:45:10 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-29 18:45:10 +0000
commit6346afb7b95dc07d789f3cef6b6bb001a28971c3 (patch)
tree55dcc576f141c3357209c77db92a0cec22d47a82 /TAO/orbsvcs/Naming_Service
parenta552484c6528edc1edf34753ae43be57b3d54bf9 (diff)
downloadATCD-6346afb7b95dc07d789f3cef6b6bb001a28971c3.tar.gz
ChangeLogTag:ed Apr 29 12:26:12 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs/Naming_Service')
-rw-r--r--TAO/orbsvcs/Naming_Service/Naming_Service.cpp37
-rw-r--r--TAO/orbsvcs/Naming_Service/Naming_Service.h15
2 files changed, 36 insertions, 16 deletions
diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.cpp b/TAO/orbsvcs/Naming_Service/Naming_Service.cpp
index 68f8b0d0edb..015959d055f 100644
--- a/TAO/orbsvcs/Naming_Service/Naming_Service.cpp
+++ b/TAO/orbsvcs/Naming_Service/Naming_Service.cpp
@@ -21,24 +21,26 @@
// Default Constructor.
Naming_Service::Naming_Service (void)
- :ior_output_file_ (0)
+ : ior_output_file_ (0),
+ pid_file_name_ (0)
{
}
// Constructor taking command-line arguments
Naming_Service::Naming_Service (int argc,
- char** argv)
- :ior_output_file_ (0)
+ char* argv[])
+ : ior_output_file_ (0),
+ pid_file_name_ (0)
{
- this->init (argc,argv);
+ this->init (argc, argv);
}
int
Naming_Service::parse_args (int argc,
- char **argv)
+ char *argv[])
{
- ACE_Get_Opt get_opts (argc,argv,"o:");
+ ACE_Get_Opt get_opts (argc,argv,"o:p:");
int c;
while ((c = get_opts ()) != -1)
@@ -51,11 +53,15 @@ Naming_Service::parse_args (int argc,
"Unable to open %s for writing: %p\n",
get_opts.optarg), -1);
break;
+ case 'p':
+ this->pid_file_name_ = get_opts.optarg;
+ break;
case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s"
- " [-o] <ior_output_file>"
+ "usage: %s "
+ "-o <ior_output_file> "
+ "-p <pid_file_name> "
"\n",
argv [0]),
-1);
@@ -66,7 +72,7 @@ Naming_Service::parse_args (int argc,
// Initialize the state of the Naming_Service object
int
Naming_Service::init (int argc,
- char** argv)
+ char* argv[])
{
int result;
@@ -110,6 +116,16 @@ Naming_Service::init (int argc,
str.in ());
ACE_OS::fclose (this->ior_output_file_);
}
+
+ if (this->pid_file_name_ != 0)
+ {
+ FILE* pidf = fopen (this->pid_file_name_, "w");
+ if (pidf != 0)
+ {
+ ACE_OS::fprintf (pidf, "%d\n", ACE_OS::getpid ());
+ ACE_OS::fclose (pidf);
+ }
+ }
return 0;
}
@@ -127,9 +143,8 @@ Naming_Service::~Naming_Service (void)
{
}
-
int
-main (int argc, char ** argv)
+main (int argc, char* argv[])
{
int init_result;
diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.h b/TAO/orbsvcs/Naming_Service/Naming_Service.h
index c3414273de0..c64444ca8a9 100644
--- a/TAO/orbsvcs/Naming_Service/Naming_Service.h
+++ b/TAO/orbsvcs/Naming_Service/Naming_Service.h
@@ -26,6 +26,7 @@ class Naming_Service
// =TITLE
// Defines a class that encapsulates the implementation of a
// naming service.
+ //
// =DESCRIPTION
// This class makes use of the TAO_Naming_Server and
// TAO_ORB_Manager class to implement the Naming_Service.
@@ -34,14 +35,12 @@ public:
Naming_Service (void);
// Default Constructor.
- Naming_Service (int argc,
- char** argv);
+ Naming_Service (int argc, char* argv[]);
// Constructor taking the command-line arguments.
int
- init (int argc,
- char** argv);
+ init (int argc, char* argv[]);
// Initialize the Naming Service with the arguments.
int
@@ -52,14 +51,20 @@ public:
// Destructor.
private:
- int parse_args (int argc,char **argv);
+ int parse_args (int argc,char *argv[]);
// parses the arguments.
+
TAO_ORB_Manager orb_manager_;
// The ORB manager.
+
TAO_Naming_Server my_naming_server_;
// Naming Server instance.
+
FILE *ior_output_file_;
// File to output the Naming Service IOR.
+
+ const char *pid_file_name_;
+ // File to output the process id.
};
#endif /* _NAMING_SERVICE_H */